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.WSCFPortComponent; 20 import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFServiceImplBean; 21 import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFWSDLPort; 22 23 import java.util.HashMap; 24 25 /*** 26 * This encapsulates the level 2 Elemenr PortComponent which is a child element of the webservice-description element. 27 * It is also the concrete implmentation of the WSCFPortComponent. 28 */ 29 public abstract class AbstractWSCFPortComponent extends WSCFElement implements WSCFPortComponent { 30 31 /*** 32 * port-component description 33 */ 34 protected String description; 35 36 /*** 37 * port-component display name 38 */ 39 protected String displayName; 40 41 /*** 42 * port-component small icon 43 */ 44 protected String smallIcon; 45 46 /*** 47 * port-component large icon 48 */ 49 protected String largeIcon; 50 51 /*** 52 * port-component name 53 */ 54 protected String portComponentName; 55 56 /*** 57 * port-component wsdl port 58 */ 59 protected WSCFWSDLPort wsdlPort; 60 61 /*** 62 * port-component service endpoint interface 63 */ 64 protected String serviceEndpointInterface; 65 66 /*** 67 * port-component service implementation bean 68 */ 69 protected WSCFServiceImplBean serviceImplBean; 70 71 /*** 72 * port-component handlers 73 */ 74 protected HashMap handlers = new HashMap(); 75 76 77 //////////////////////////////jaxb interfacing block/////////////////////////////////// 78 79 // public WSCFPortComponentImpl(PortComponentType jaxbPortComponent){ 80 // this.jaxbPortComponent = jaxbPortComponent; 81 // 82 //// /////////////assigning the values ////////////// 83 // if(null != jaxbPortComponent.getDescription()) 84 // this.description =jaxbPortComponent.getDescription().getValue(); 85 // 86 // if(null != jaxbPortComponent.getDisplayName()) 87 // this.displayName =jaxbPortComponent.getDisplayName().getValue(); 88 // 89 // if(null != jaxbPortComponent.getIcon()) 90 // this.smallIcon =((PathType)(jaxbPortComponent.getIcon()).getSmallIcon()).getValue(); 91 // 92 // if(null != jaxbPortComponent.getIcon()) 93 // this.largeIcon =((PathType)(jaxbPortComponent.getIcon()).getLargeIcon()).getValue(); 94 // 95 // if(null != jaxbPortComponent.getPortComponentName()) 96 // this.portComponentName = jaxbPortComponent.getPortComponentName().getValue(); 97 // 98 // if(null != jaxbPortComponent.getServiceEndpointInterface()) 99 // this.serviceEndpointInterface = (jaxbPortComponent.getServiceEndpointInterface()).getValue(); 100 // 101 // 102 // this.wsdlPort = new WSCFWSDLPortImpl(jaxbPortComponent.getWsdlPort()); 103 // this.serviceImplBean = new WSCFServiceImplBeanImpl(jaxbPortComponent.getServiceImplBean()); 104 // java.util.List list = this.jaxbPortComponent.getHandler(); 105 // for(int i=0; i < list.size(); i++){ 106 // WSCFHandler handler = new AbstractWSCFHandlerImpl(((PortComponentHandlerType)list.get(i))); 107 // this.handlers.put(handler.getHandlerName(), handler); 108 // } 109 // } 110 111 112 /////////////////////////////////////////////////////////////////////////////////////// 113 114 115 // /*** 116 // * The constructor. This will recursively parse the child elements in depth first manner. 117 // * @param e PortComponent Element 118 // * @throws WSCFException 119 // */ 120 // public WSCFPortComponentImpl(Element e)throws WSCFException{ 121 // super(e); 122 // 123 // //extract the description. 124 // Element element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_DESCRIPTION); 125 // if(null != element){this.description = element.getChildNodes().item(0).toString();} 126 // 127 // //extract the display name 128 // element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_DISPLAY_NAME); 129 // if(null != element){this.displayName = element.getChildNodes().item(0).toString();} 130 // 131 // //extract the small icon 132 // element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_SMALL_ICON); 133 // if(null != element){this.smallIcon = element.getChildNodes().item(0).toString();} 134 // 135 // //extract the large icon 136 // element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_LARGE_ICON); 137 // if(null != element){this.largeIcon = element.getChildNodes().item(0).toString();} 138 // 139 // //extract the port component name 140 // element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_PORT_COMPONENT_NAME); 141 // if(null != element){this.portComponentName = element.getChildNodes().item(0).toString();} 142 // 143 // //extract the wsdl port 144 // element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_WSDL_PORT); 145 // if(null != element){this.wsdlPort = new WSCFWSDLPortImpl(element);} 146 // 147 // //extracting the SEI 148 // element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_SERVICE_ENDPOINT_INTERFACE); 149 // if(null != element){this.serviceEndpointInterface = element.getChildNodes().item(0).toString();} 150 // 151 // //extracting the service implementation bean 152 // element = this.getChildElement(e, WSCFConstants.ELEM_WSCF_SERVICE_IMPLEMENTATION_BEAN); 153 // if(null != element){this.serviceImplBean = new WSCFServiceImplBeanImpl(element);} 154 // 155 // Element[] elements = this.getChildElements(e, WSCFConstants.ELEM_WSCF_HANDLER); 156 // for(int i=0; i < elements.length; i++){ 157 // WSCFHandler handler = new AbstractWSCFHandlerImpl(elements[i]); 158 // this.handlers.put(handler.getHandlerName(), handler); 159 // } 160 // 161 // } 162 163 164 165 166 /*** 167 * Gets the description of the port component Element 168 * 169 * @return description 170 */ 171 public String getDescription() { 172 return description; 173 } 174 175 /*** 176 * Gets the display name of the port component Element 177 * 178 * @return display name 179 */ 180 public String getDisplayName() { 181 return displayName; 182 } 183 184 /*** 185 * Gets the handlers of the port component Element as an array 186 * 187 * @return handlers 188 */ 189 public WSCFHandler[] getHandlers() { 190 WSCFHandler[] handler = new WSCFHandler[this.handlers.size()]; 191 this.handlers.values().toArray(handler); 192 return handler; 193 } 194 195 /*** 196 * Gets the large icon of the port component Element 197 * 198 * @return large icon 199 */ 200 public String getLargeIcon() { 201 return largeIcon; 202 } 203 204 /*** 205 * Gets the port componenet name of the port component Element 206 * 207 * @return name 208 */ 209 public String getPortComponentName() { 210 return portComponentName; 211 } 212 213 /*** 214 * Gets the SEI of the port component Element 215 * 216 * @return SEI 217 */ 218 public String getServiceEndpointInterface() { 219 return serviceEndpointInterface; 220 } 221 222 /*** 223 * Gets the service implimentation bean of the port component Element 224 * 225 * @return service inplinmentation bean 226 */ 227 public WSCFServiceImplBean getServiceImplBean() { 228 return serviceImplBean; 229 } 230 231 /*** 232 * Gets the small icon of the port component Element 233 * 234 * @return small icon 235 */ 236 public String getSmallIcon() { 237 return smallIcon; 238 } 239 240 /*** 241 * Gets the wsdl port of the port component Element 242 * 243 * @return wsd; port 244 */ 245 public WSCFWSDLPort getWsdlPort() { 246 return wsdlPort; 247 } 248 249 // /*** 250 // * @return 251 // */ 252 // public PortComponentType getJaxbPortComponent() { 253 // return jaxbPortComponent; 254 // } 255 256 }