1 26 27 package org.objectweb.jonas_ws.deployment.api; 28 29 import java.net.URL ; 30 import java.util.Iterator ; 31 import java.util.List ; 32 import java.util.Vector ; 33 34 import javax.xml.namespace.QName ; 35 36 import org.objectweb.jonas_lib.I18n; 37 import org.objectweb.jonas_lib.deployment.api.DeploymentDescException; 38 import org.objectweb.jonas_lib.deployment.api.HandlerDesc; 39 import org.objectweb.jonas_lib.deployment.xml.Handler; 40 41 import org.objectweb.jonas_ws.deployment.xml.JonasPortComponent; 42 import org.objectweb.jonas_ws.deployment.xml.PortComponent; 43 44 45 46 52 53 public abstract class PortComponentDesc { 54 55 58 private static I18n i18n = I18n.getInstance(PortComponentDesc.class); 59 60 63 private String name; 64 65 68 private Class sei; 69 70 73 private String sibLink; 74 75 78 private String sib; 79 80 83 private List handlers = new Vector (); 84 85 88 private QName portQName; 89 90 93 private URL endpoint = null; 94 95 98 private ServiceDesc parent = null; 99 100 103 private String endpointURI = null; 104 105 108 private String mapping = null; 109 110 113 private String serviceName = null; 114 115 125 protected PortComponentDesc(ClassLoader jarCL, 126 PortComponent pc, 127 JonasPortComponent jpc, 128 ServiceDesc parent) 129 throws WSDeploymentDescException { 130 131 this.parent = parent; 132 133 name = pc.getPortComponentName(); 135 if ("".equals(name)) { String err = getI18n().getMessage("PortComponentDesc.noPCName"); throw new WSDeploymentDescException(err); 138 } 139 140 String seiClassName = pc.getServiceEndpointInterface(); 142 if ("".equals(seiClassName)) { String err = getI18n().getMessage("PortComponentDesc.noInterfaceName"); throw new WSDeploymentDescException(err); 145 } 146 147 try { 148 sei = jarCL.loadClass(seiClassName); 149 } catch (ClassNotFoundException e) { 150 String err = getI18n().getMessage("PortComponentDesc.loadError", seiClassName); System.out.println("***** used ClassLoader : " + jarCL); 152 throw new WSDeploymentDescException(err, e); 153 } 154 155 List hl = pc.getHandlerList(); 157 Handler h = null; 158 159 for (int i = 0; i < hl.size(); i++) { 160 if (hl.get(i) != null) { 162 h = (Handler) hl.get(i); 164 try { 166 handlers.add(new HandlerDesc(jarCL, h)); 167 } catch (DeploymentDescException dde) { 168 throw new WSDeploymentDescException(dde); 169 } 170 } 171 } 172 173 portQName = pc.getWsdlPort().getQName(); 175 176 if (jpc != null) { 178 endpointURI = jpc.getEndpointURI(); 180 181 int lastSlash = endpointURI.lastIndexOf("/"); mapping = endpointURI.substring(0, lastSlash + 1) + "*"; 185 String [] parts = endpointURI.split("/"); serviceName = parts[parts.length - 1]; 188 } else { 189 serviceName = portQName.getLocalPart(); 191 } 192 193 194 } 195 196 201 public ServiceDesc getServiceDesc() { 202 return parent; 203 } 204 205 210 public String getName() { 211 return name; 212 } 213 214 219 public Class getServiceEndpointInterface() { 220 return sei; 221 } 222 223 229 public String getSIBClassname() { 230 return sib; 231 } 232 233 241 protected void setSIBClassname(String sibClassName) { 242 this.sib = sibClassName; 243 } 244 245 250 public QName getQName() { 251 return portQName; 252 } 253 254 259 public List getHandlers() { 260 return handlers; 261 } 262 263 268 public String getSibLink() { 269 return sibLink; 270 } 271 272 277 public abstract boolean hasBeanImpl(); 278 279 284 public abstract boolean hasJaxRpcImpl(); 285 286 291 public URL getEndpointURL() { 292 return endpoint; 293 } 294 295 300 public void setEndpointURL(URL url) { 301 endpoint = url; 302 } 303 304 307 public String getMapping() { 308 return mapping; 309 } 310 311 314 public String getServiceName() { 315 return serviceName; 316 } 317 318 323 public abstract void setDesc(Object desc) throws WSDeploymentDescException; 324 325 328 public String toString() { 329 330 StringBuffer sb = new StringBuffer (); 331 332 sb.append("\n" + getClass().getName()); sb.append("\ngetName()=" + getName()); sb.append("\ngetServiceEndpointInterface()=" + getServiceEndpointInterface()); sb.append("\ngetSibLink()=" + getSibLink()); sb.append("\ngetSIBClassname()=" + getSIBClassname()); sb.append("\ngetQName()=" + getQName()); 339 for (Iterator i = getHandlers().iterator(); i.hasNext();) { 340 sb.append("\ngetHandlers()=" + ((Handler) i.next()).toString()); } 342 343 return sb.toString(); 344 345 } 346 347 350 public String getSib() { 351 return sib; 352 } 353 354 357 public void setSib(String sib) { 358 this.sib = sib; 359 } 360 361 364 public void setSibLink(String sibLink) { 365 this.sibLink = sibLink; 366 } 367 368 371 public static I18n getI18n() { 372 return i18n; 373 } 374 375 378 public String getEndpointURI() { 379 return endpointURI; 380 } 381 } 382 | Popular Tags |