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.WSCFWebserviceDescription;
19  import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFWebservices;
20  
21  import java.util.HashMap;
22  
23  /***
24   * This is the class that will represent the webservices element in the runtime.
25   * This is the root element of the webservices.xml file. The parsing of elements will be initiated from here and will be
26   * parsed in a depth first manner
27   */
28  public class AbstractWSCFWebservices extends WSCFElement implements WSCFWebservices {
29  
30      //TODO figure out how the id should be encapsulated
31  	
32      /***
33       * This will refer to the multiple webservice descriptions elements that the
34       * webservice element can support
35       */
36      protected HashMap webServiceDescriptions = new HashMap();
37  
38      /***
39       * Webservice description.
40       */
41      protected String description;
42  
43      /***
44       * Webservice display name
45       */
46      protected String displayName;
47  
48      /***
49       * Webservice small Icon.
50       */
51      protected String smallIcon;
52  
53      /***
54       * Webservice large icon.
55       */
56      protected String largeIcon;
57  
58  ////////////////////////////////////////////jaxb interfacing block/////////////////////////////////////////
59  //
60  ////This is kept basically to meet the future demands of the serialising.
61  //	protected Webservices jaxbWebservices;
62  //
63  //		/***
64  //		 * Constructor
65  //		 * This is the constructor that was written to make the code jaxb complient. THis class
66  //		 * basically wrap the jaxb webservides element.
67  //		 */
68  //	public WSCFWebservicesImpl(Webservices jaxbWebservices)throws WSCFException{
69  //		if(null == jaxbWebservices) return;
70  //		this.jaxbWebservices = jaxbWebservices;
71  //
72  //		////////////assigning the values //////////////
73  //		List temp = null; 
74  //		
75  //		temp = jaxbWebservices.getDescription();
76  //		if(0 != temp.size())
77  //			this.description =((DescriptionType)temp.get(0)).getValue();		
78  //		
79  //		temp = jaxbWebservices.getDisplayName();
80  //		if(0 != temp.size())
81  //			this.displayName =((DisplayNameType)temp.get(0)).getValue();
82  //		
83  //		temp = jaxbWebservices.getIcon();
84  //		
85  //		if(0 != temp.size()){
86  //			if(null != (PathType)((IconType)temp.get(0)).getSmallIcon())
87  //				this.smallIcon =((PathType)((IconType)temp.get(0)).getSmallIcon()).getValue();
88  //			
89  //			if(null != (PathType)((IconType)temp.get(0)).getLargeIcon())
90  //				this.largeIcon =((PathType)((IconType)temp.get(0)).getLargeIcon()).getValue();
91  //		}	
92  //		
93  //		java.util.List list = this.jaxbWebservices.getWebserviceDescription();
94  //		if(0 == list.size()){throw new WSCFException("The webservices description element does not exist");}
95  //		for(int i=0; i < list.size(); i++){
96  //			WSCFWebserviceDescription webservicesDescription = new AbstractWSCFWebserviceDescriptionImpl(((WebserviceDescriptionType)list.get(i)));
97  //			this.webServiceDescriptions.put(webservicesDescription.getDisplayName(), webservicesDescription);
98  //		}
99  //		
100 //	}
101 //
102 //
103 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
104 //
105 //
106 //
107 //
108 //
109 //	/***
110 //	 * Constructor
111 //	 * @param e  Webservices element
112 //	 * @throws WSCFException
113 //	 * 
114 //	 * !!!!!!!!!!!!!!!!!!!!!!!!Deprecated!!!!!!!!!!!!!!!!!!!!!!!!!!
115 //	 */
116 //	public WSCFWebservicesImpl(Element e) throws WSCFException{
117 //		super(e);
118 //		//extracting the description
119 //		Element element = this.getChildElement(e,WSCFConstants.ELEM_WSCF_DESCRIPTION);
120 //		if(null != element){this.description = (element.getChildNodes()).item(0).toString();}
121 //		
122 //		//extraction the dispaly-name
123 //		element = this.getChildElement(e,WSCFConstants.ELEM_WSCF_DISPLAY_NAME);
124 //		if(null != element){this.displayName = element.getChildNodes().item(0).toString();}
125 //		
126 //		//extraction the small icon
127 //		 element = this.getChildElement(e,WSCFConstants.ELEM_WSCF_SMALL_ICON);
128 //		if(null != element){this.smallIcon = element.getChildNodes().item(0).toString();}
129 //				
130 //		//extracting the large icon
131 //		element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_LARGE_ICON);
132 //		if(null != element){this.largeIcon = element.getChildNodes().item(0).toString();}
133 //		//TODO ********whether this is the most appropreate way to do this
134 //		// getting the webservice description.
135 //		Element[] elements = this.getChildElements(e, WSCFConstants.ELEM_WSCF_WEBSERVICES_DESCRIPTION);
136 //		for (int i=0; i< elements.length; i++){
137 //			WSCFWebserviceDescription webservice = new AbstractWSCFWebserviceDescriptionImpl(elements[i]);
138 //			this.webServiceDescriptions.put(webservice.getWebserviceDescriptionName(), webservice);
139 //		}
140 //		
141 //	}
142 
143 
144     /***
145      * Gets all the webservice descriptions as a array of such elements
146      *
147      * @return Webservice description array.
148      */
149     public WSCFWebserviceDescription[] getWebServiceDescriptions() {
150         WSCFWebserviceDescription[] wsdescArray = new WSCFWebserviceDescription[this.webServiceDescriptions.size()];
151         this.webServiceDescriptions.values().toArray(wsdescArray);
152         return wsdescArray;
153     }	
154 
155 
156 //TODO *throw an exception appropreately if the value is null
157 
158     /***
159      * Gets the description of the webservices Element
160      *
161      * @return The description
162      */
163     public String getDescription() {
164         return description;
165     }
166 
167     /***
168      * Gets the displayname of the webservices element
169      *
170      * @return The Display name
171      */
172     public String getDisplayName() {
173         return displayName;
174     }
175 
176     /***
177      * Gets the description of the large icon Element
178      *
179      * @return The large icon
180      */
181     public String getLargeIcon() {
182         return largeIcon;
183     }
184 
185     /***
186      * Gets the description of the small icon Element
187      *
188      * @return The small icon
189      */
190     public String getSmallIcon() {
191         return smallIcon;
192     }
193 
194 //	/***
195 //	 * @param description - Description of the webservice
196 //	 */
197 //	public void setDescription(String description) {
198 //		this.description = description;
199 //	}
200 //
201 //	/***
202 //	 * @param displayName
203 //	 */
204 //	public void setDisplayName(String displayName) {
205 //		this.displayName = displayName;
206 //	}
207 //
208 //	/***
209 //	 * @param largeIcon
210 //	 */
211 //	public void setLargeIcon(String largeIcon) {
212 //		this.largeIcon = largeIcon;
213 //	}
214 //
215 //	/***
216 //	 * @param smallIcon
217 //	 */
218 //	public void setSmallIcon(String smallIcon) {
219 //		this.smallIcon = smallIcon;
220 //	}
221 
222 ///***
223 // * @return
224 // */
225 //public Webservices getJaxbWebservices() {
226 //	return jaxbWebservices;
227 //}
228 //
229 }