Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/apache/axis/deployment/wsdd/WSDDGlobalConfiguration.java


1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.axis.deployment.wsdd;
17  
18  import org.apache.axis.ConfigurationException;
19  import org.apache.axis.EngineConfiguration;
20  import org.apache.axis.Handler;
21  import org.apache.axis.encoding.SerializationContext;
22  import org.apache.axis.utils.Messages;
23  import org.apache.axis.utils.XMLUtils;
24  import org.w3c.dom.Element;
25  
26  import javax.xml.namespace.QName;
27  import java.io.IOException;
28  import java.util.List;
29  import java.util.ArrayList;
30  
31  
32  /**
33   * Represents the global configuration of the Axis engine.
34   *
35   * @author James Snell
36   */
37  public class WSDDGlobalConfiguration
38      extends WSDDDeployableItem
39  {
40      private WSDDRequestFlow requestFlow;
41      private WSDDResponseFlow responseFlow;
42      private ArrayList roles = new ArrayList();
43  
44      /**
45       * Default constructor
46       */ 
47      public WSDDGlobalConfiguration()
48      {
49      }
50      
51      /**
52       *
53       * @param e (Element) XXX
54       * @throws WSDDException XXX
55       */
56      public WSDDGlobalConfiguration(Element e)
57          throws WSDDException
58      {
59          super(e);
60          Element reqEl = getChildElement(e, ELEM_WSDD_REQFLOW);
61          if (reqEl != null && reqEl.getElementsByTagName("*").getLength()>0) {
62              requestFlow = new WSDDRequestFlow(reqEl);
63          }
64          Element respEl = getChildElement(e, ELEM_WSDD_RESPFLOW);
65          if (respEl != null && respEl.getElementsByTagName("*").getLength()>0) {
66              responseFlow = new WSDDResponseFlow(respEl);
67          }
68  
69          Element [] roleElements = getChildElements(e, ELEM_WSDD_ROLE);
70          for (int i = 0; i < roleElements.length; i++) {
71              String role = XMLUtils.getChildCharacterData(roleElements[i]);
72              roles.add(role);
73          }
74      }
75      
76      protected QName getElementName()
77      {
78          return WSDDConstants.QNAME_GLOBAL;
79      }
80  
81      /**
82       * Get our request flow 
83       */
84      public WSDDRequestFlow getRequestFlow()
85      {
86          return requestFlow;
87      }
88      
89      /**
90       * Set our request flow
91       */ 
92      public void setRequestFlow(WSDDRequestFlow reqFlow)
93      {
94          requestFlow = reqFlow;
95      }
96  
97      /**
98       * Get our response flow
99       */
100     public WSDDResponseFlow getResponseFlow()
101     {
102         return responseFlow;
103     }
104     
105     /**
106      * Set the response flow
107      */
108     public void setResponseFlow(WSDDResponseFlow responseFlow) {
109         this.responseFlow = responseFlow;
110     }
111 
112     /**
113      *
114      * @return XXX
115      */
116     public WSDDFaultFlow[] getFaultFlows()
117     {
118         return null;
119     }
120 
121     /**
122      *
123      * @param name XXX
124      * @return XXX
125      */
126     public WSDDFaultFlow getFaultFlow(QName name)
127     {
128 
129         WSDDFaultFlow[] t = getFaultFlows();
130 
131         for (int n = 0; n < t.length; n++) {
132             if (t[n].getQName().equals(name)) {
133                 return t[n];
134             }
135         }
136 
137         return null;
138     }
139 
140     /**
141      *
142      * @return XXX
143      */
144     public QName getType()
145     {
146         return null;
147     }
148 
149     /**
150      *
151      * @param type XXX
152      */
153     public void setType(String type) throws WSDDException
154     {
155         throw new WSDDException(Messages.getMessage("noTypeOnGlobalConfig00"));
156     }
157 
158 
159 
160     /**
161      *
162      * @param registry XXX
163      * @return XXX
164      */
165     public Handler makeNewInstance(EngineConfiguration registry)
166     {
167         return null;
168     }
169 
170     /**
171      * Write this element out to a SerializationContext
172      */
173     public void writeToContext(SerializationContext context)
174             throws IOException {
175         context.startElement(QNAME_GLOBAL, null);
176         writeParamsToContext(context);
177         if (requestFlow != null)
178             requestFlow.writeToContext(context);
179         if (responseFlow != null)
180             responseFlow.writeToContext(context);
181         context.endElement();
182     }
183 
184     public void deployToRegistry(WSDDDeployment registry)
185             throws ConfigurationException {
186         if (requestFlow != null)
187             requestFlow.deployToRegistry(registry);
188         if (responseFlow != null)
189             responseFlow.deployToRegistry(registry);
190     }
191 
192     public List getRoles() {
193         return (List)roles.clone();
194     }
195 }
196