KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > webservice > PortComponentInfo


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.webservice;
8
9 // $Id: PortComponentInfo.java,v 1.5.4.7 2005/04/26 19:57:22 tdiesler Exp $
10

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 JavaDoc;
17 import javax.management.ObjectName JavaDoc;
18
19 /**
20  * This object registered with the AxisService.
21  * <p/>
22  * The key is [deploymentName]#[port-component-name]
23  *
24  * @author Thomas.Diesler@jboss.org
25  * @since 28-May-2004
26  */

27 public class PortComponentInfo
28 {
29    private DeploymentInfo di;
30    private PortComponentMetaData pcMetaData;
31    private ServiceDescription serviceDesc;
32    private String JavaDoc serviceID;
33    private ObjectName JavaDoc 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 JavaDoc e)
46       {
47          throw new IllegalArgumentException JavaDoc("Invalid serviceID: " + serviceID);
48       }
49    }
50
51    public String JavaDoc getServiceID()
52    {
53       return serviceID;
54    }
55
56    public ObjectName JavaDoc 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 JavaDoc 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    /** Get the port component classloader */
87    public ClassLoader JavaDoc getPortComponentClassLoader()
88    {
89       if (di.metaData instanceof WebMetaData)
90          return ((WebMetaData)di.metaData).getContextLoader();
91       else
92          return di.ucl;
93    }
94
95    /**
96     * Returns a string representation of the object.
97     */

98    public String JavaDoc toString()
99    {
100       return "[id=" + serviceID + ",address=" + pcMetaData.getServiceEndpointURL() + "]";
101    }
102 }
103
104
Popular Tags