1 7 package org.jboss.webservice; 8 9 11 import org.jboss.deployment.DeploymentInfo; 12 import org.jboss.webservice.deployment.ServiceDescription; 13 import org.jboss.webservice.metadata.PortComponentMetaData; 14 import org.jboss.metadata.WebMetaData; 15 16 import javax.management.MalformedObjectNameException ; 17 import javax.management.ObjectName ; 18 19 27 public class PortComponentInfo 28 { 29 private DeploymentInfo di; 30 private PortComponentMetaData pcMetaData; 31 private ServiceDescription serviceDesc; 32 private String serviceID; 33 private ObjectName objectName; 34 35 public PortComponentInfo(DeploymentInfo di, PortComponentMetaData pcMetaData) 36 { 37 this.di = di; 38 this.pcMetaData = pcMetaData; 39 this.serviceID = di.getCanonicalName() + "#" + pcMetaData.getPortComponentName(); 40 41 try 42 { 43 this.objectName = ObjectName.getInstance("jboss.ws4ee:port-component=" + serviceID); 44 } 45 catch (MalformedObjectNameException e) 46 { 47 throw new IllegalArgumentException ("Invalid serviceID: " + serviceID); 48 } 49 } 50 51 public String getServiceID() 52 { 53 return serviceID; 54 } 55 56 public ObjectName getObjectName() 57 { 58 return objectName; 59 } 60 61 public DeploymentInfo getDeploymentInfo() 62 { 63 return di; 64 } 65 66 public PortComponentMetaData getPortComponentMetaData() 67 { 68 return pcMetaData; 69 } 70 71 public String getServiceEndpointURL() 72 { 73 return pcMetaData.getServiceEndpointURL().toExternalForm(); 74 } 75 76 public void setServiceDesc(ServiceDescription serviceDesc) 77 { 78 this.serviceDesc = serviceDesc; 79 } 80 81 public ServiceDescription getServiceDescription() 82 { 83 return serviceDesc; 84 } 85 86 87 public ClassLoader getPortComponentClassLoader() 88 { 89 if (di.metaData instanceof WebMetaData) 90 return ((WebMetaData)di.metaData).getContextLoader(); 91 else 92 return di.ucl; 93 } 94 95 98 public String toString() 99 { 100 return "[id=" + serviceID + ",address=" + pcMetaData.getServiceEndpointURL() + "]"; 101 } 102 } 103 104 | Popular Tags |