View Javadoc

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.geronimo.ews.ws4j2ee.context.webservices.server;
17  
18  import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFHandler;
19  import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFInitParam;
20  import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFSOAPHeader;
21  
22  import java.util.HashMap;
23  import java.util.Vector;
24  
25  /***
26   * This encapsulates the layer 3 handler element of the webservices.xml. This
27   * is also the concrete implementation of the WSCFHandler.
28   */
29  public abstract class AbstractWSCFHandler extends WSCFElement implements WSCFHandler {
30  
31      /***
32       * handler derscription
33       */
34      protected String description;
35  
36      /***
37       * handler display name
38       */
39      protected String displayName;
40  
41      /***
42       * handler small icon
43       */
44      protected String smallIcon;
45  
46      /***
47       * handler  large icon
48       */
49      protected String largeIcon;
50  
51      /***
52       * handler name
53       */
54      protected String handlerName;
55  
56      /***
57       * handler class
58       */
59      protected String handlerClass;
60  
61      /***
62       * handler init parameters as a collection
63       */
64      protected HashMap initParam = new HashMap();
65  
66      /***
67       * handler soap headers as a collection
68       */
69      protected Vector soapHeader = new Vector();
70  
71      /***
72       * handler soap roles as a collection
73       */
74      protected Vector soapRole = new Vector();
75  	
76  	
77  	
78  	
79  	
80  //	/////////////////////////////////////////////////////////////////////////////////////
81  //	
82  //	/***
83  //	 * The constructor. This will parse the chaild elementsin a depth first manner.
84  //	 * @param e handler Element
85  //	 * @throws WSCFException
86  //	 */
87  //	public AbstractWSCFHandlerImpl(Element e)throws WSCFException{
88  //		super(e);
89  //		
90  //		//extract description
91  //		Element element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_DESCRIPTION);
92  //		if(null != element){this.description = element.getChildNodes().item(0).toString();}
93  //		
94  //		//extracting the display name
95  //		element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_DISPLAY_NAME);
96  //		if(null != element){this.displayName = element.getChildNodes().item(0).toString();}
97  //		
98  //		//extract small icon
99  //		element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_SMALL_ICON);
100 //		if(null != element){this.smallIcon = element.getChildNodes().item(0).toString();}
101 //		
102 //		//extract handler name
103 //		element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_HANDLER_NAME);
104 //		if(null != element){this.handlerName = element.getChildNodes().item(0).toString();}
105 //		
106 //		// extract handler class
107 //		element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_HANDLER_CLASS);
108 //		if(null != element){this.handlerClass = element.getChildNodes().item(0).toString();}
109 //		
110 //		//extracting the params
111 //		Element[] elements = this.getChildElements(e, WSCFConstants.ELEM_WSCF_INIT_PARAM);
112 //		for(int i=0; i < elements.length; i++){
113 //			WSCFInitParam initparam = new WSCFInitParamImpl(elements[i]);
114 //			this.initParam.put(initparam.getParamName(), initparam);
115 //		}
116 //		
117 //		//extracting the soap headers
118 //		elements = this.getChildElements(e, WSCFConstants.ELEM_WSCF_SOAP_HEADER);
119 //		for(int i=0; i < elements.length; i++){
120 //			this.soapHeader.add(new WSCFSOAPHeaderImpl(elements[i]));
121 //		}
122 //		
123 //		//extract the SOAP roles
124 //		elements = this.getChildElements(e, WSCFConstants.ELEM_WSCF_SOAP_ROLE);
125 //		for(int i=0; i < elements.length; i++){
126 //			this.soapRole.add(elements[i].getChildNodes().item(0).toString());			
127 //		}
128 //		
129 //	}
130 		
131 	
132 
133     /***
134      * Gets the description of the handler element
135      *
136      * @return description
137      */
138     public String getDescription() {
139         return description;
140     }
141 
142     /***
143      * Gets the display name of the handler element
144      *
145      * @return display-name
146      */
147     public String getDisplayName() {
148         return displayName;
149     }
150 
151     /***
152      * Gets the class of the handler element
153      *
154      * @return handler-class
155      */
156     public String getHandlerClass() {
157         return handlerClass;
158     }
159 
160     /***
161      * Gets the name of the handler element
162      *
163      * @return handler-name
164      */
165     public String getHandlerName() {
166         return handlerName;
167     }
168 
169     /***
170      * Gets the init paramaeters of the handler element as a array
171      *
172      * @return init-parameters
173      */
174     public WSCFInitParam[] getInitParam() {
175         WSCFInitParam[] initparam = new WSCFInitParam[this.initParam.size()];
176         this.initParam.values().toArray(initparam);
177         return initparam;
178     }
179 
180     /***
181      * Gets the large icon of the handler element
182      *
183      * @return large-icon
184      */
185     public String getLargeIcon() {
186         return largeIcon;
187     }
188 
189     /***
190      * Gets the small icon of the handler element
191      *
192      * @return small-icon
193      */
194     public String getSmallIcon() {
195         return smallIcon;
196     }
197 
198     /***
199      * Gets the soap headers of the handler element
200      *
201      * @return soap-headers
202      */
203     public WSCFSOAPHeader[] getSoapHeader() {
204         WSCFSOAPHeader[] soapheader = new WSCFSOAPHeader[this.soapHeader.size()];
205         int size = soapHeader.size();
206         for (int i = 0; i < size; i++) {
207             soapheader[i] = ((WSCFSOAPHeader) soapHeader.get(i));
208         }
209         return soapheader;
210     }
211 
212     /***
213      * Gets the soap roles of the handler element
214      *
215      * @return soap-roles
216      */
217     public String[] getSoapRole() {
218         String[] soaprole = new String[this.soapRole.size()];
219         int size = soapRole.size();
220         for (int i = 0; i < size; i++) {
221             soaprole[i] = (String) soapRole.get(i);
222         }
223         return soaprole;
224     }
225 
226 //	/***
227 //	 * @return
228 //	 */
229 //	public PortComponentHandlerType getJaxbHandler() {
230 //		return jaxbHandler;
231 //	}
232 
233 }