PortComponentRefDesc.java

00001 
00027 package org.objectweb.jonas_ws.deployment.api;
00028 
00029 import java.util.Iterator;
00030 import java.util.Properties;
00031 
00032 import javax.xml.namespace.QName;
00033 
00034 import org.objectweb.jonas_lib.I18n;
00035 import org.objectweb.jonas_lib.deployment.xml.JonasCallProperty;
00036 import org.objectweb.jonas_lib.deployment.xml.JonasPortComponentRef;
00037 import org.objectweb.jonas_lib.deployment.xml.JonasStubProperty;
00038 import org.objectweb.jonas_lib.deployment.xml.PortComponentRef;
00039 
00046 public class PortComponentRefDesc {
00047 
00049     private Class sei;
00050 
00052     private String pcLink = null;
00053 
00055     private PortComponentDesc pcDesc = null;
00056 
00060     private Properties stubProperties = null;
00061 
00065     private Properties callProperties = null;
00066 
00070     private QName wsdlPort = null;
00071 
00075     private static I18n i18n = I18n.getInstance(PortComponentRefDesc.class);
00076 
00086     public PortComponentRefDesc(ClassLoader classLoader, PortComponentRef pcr, JonasPortComponentRef jpcr) throws WSDeploymentDescException {
00087 
00088         String className = null;
00089         stubProperties = new Properties();
00090         callProperties = new Properties();
00091 
00092         try {
00093             // load service endpoint interface
00094             className = pcr.getServiceEndpointInterface().trim();
00095             sei = classLoader.loadClass(className);
00096 
00097             // get port link if any
00098             if (pcr.getPortComponentLink() != null) {
00099                 pcLink = pcr.getPortComponentLink().trim();
00100             }
00101 
00102             // load properties
00103             if (jpcr != null) {
00104                 for (Iterator i = jpcr.getJonasCallPropertyList().iterator(); i.hasNext();) {
00105                     JonasCallProperty jp = (JonasCallProperty) i.next();
00106                     callProperties.setProperty(jp.getParamName(), jp.getParamValue());
00107                 }
00108                 for (Iterator i = jpcr.getJonasStubPropertyList().iterator(); i.hasNext();) {
00109                     JonasStubProperty jp = (JonasStubProperty) i.next();
00110                     stubProperties.setProperty(jp.getParamName(), jp.getParamValue());
00111                 }
00112                 if (jpcr.getWsdlPort() != null) {
00113                     wsdlPort = jpcr.getWsdlPort().getQName();
00114                 }
00115             }
00116         } catch (ClassNotFoundException e) {
00117             throw new WSDeploymentDescException(getI18n().getMessage("PortComponentRefDesc.seiNotFound", className), e); //$NON-NLS-1$
00118         }
00119     }
00120 
00125     public String getPortComponentLink() {
00126         return pcLink;
00127     }
00128 
00133     public void setPortComponentDesc(PortComponentDesc pcd) {
00134         pcDesc = pcd;
00135     }
00136 
00141     public PortComponentDesc getPortComponentDesc() {
00142         return pcDesc;
00143     }
00144 
00149     public Class getSEI() {
00150         return sei;
00151     }
00152 
00156     public int hashCode() {
00157         return sei.getName().hashCode();
00158     }
00159 
00165     public boolean equals(Object other) {
00166         if (other == null) {
00167             return false;
00168         }
00169 
00170         if (!(other instanceof PortComponentRefDesc)) {
00171             return false;
00172         }
00173 
00174         PortComponentRefDesc ref = (PortComponentRefDesc) other;
00175 
00176         if (!sei.getName().equals(ref.getSEI().getName())) {
00177             return false;
00178         }
00179 
00180         if (!pcLink.equals(ref.getPortComponentLink())) {
00181             return false;
00182         }
00183 
00184         // After all theses tests, the 2 objects are equals in value
00185         return true;
00186     }
00187 
00191     protected static I18n getI18n() {
00192         return i18n;
00193     }
00194 
00198     public Properties getCallProperties() {
00199         return callProperties;
00200     }
00201 
00205     public Properties getStubProperties() {
00206         return stubProperties;
00207     }
00208 
00212     public QName getWsdlPort() {
00213         return wsdlPort;
00214     }
00215 }

Generated on Tue Feb 15 15:05:59 2005 for JOnAS by  doxygen 1.3.9.1