1 23 package com.sun.enterprise.jbi.serviceengine.core; 24 import java.io.BufferedInputStream ; 25 import java.io.File ; 26 import java.io.FileInputStream ; 27 import javax.jbi.servicedesc.ServiceEndpoint; 28 import javax.xml.parsers.DocumentBuilderFactory ; 29 import javax.xml.namespace.QName ; 30 import org.w3c.dom.Document ; 31 import org.xml.sax.InputSource ; 32 33 37 public class ServiceEngineEndpoint { 38 39 private String wsdlFilePath; 40 private ServiceEndpoint jbiEndpoint; 41 private String url; 43 private String sei; 44 private String implClass; 45 private boolean jaxwsFlag; 46 private boolean ejbType; 47 private boolean enabled ; 48 private String contextRoot; 49 private QName serviceName; 50 private String endpointName; 51 private ClassLoader classLoader; 52 53 54 public ServiceEngineEndpoint(ServiceEndpoint jbiEndpoint, String wsdlFilePath, 55 String sei, String implClass, String addressURI, String contextRoot, 56 boolean ejbType, 57 boolean jaxwsFlag, boolean enabled, ClassLoader classLoader) { 58 this(jbiEndpoint.getServiceName(), jbiEndpoint.getEndpointName(), 59 wsdlFilePath, sei, implClass, addressURI, contextRoot, ejbType, 60 jaxwsFlag, enabled, classLoader); 61 this.jbiEndpoint = jbiEndpoint; 62 } 63 64 public ServiceEngineEndpoint(QName serviceName, String endpointName, String wsdlFilePath, 65 String sei, String implClass, String addressURI, String contextRoot, 66 boolean ejbType, 67 boolean jaxwsFlag, boolean enabled, ClassLoader classLoader) { 68 this.wsdlFilePath = wsdlFilePath; 69 this.serviceName = serviceName; 70 this.endpointName = endpointName; 71 this.url = addressURI; 72 this.ejbType = ejbType; 73 this.sei = sei; 74 this.implClass = implClass; 75 this.jaxwsFlag = jaxwsFlag; 76 this.enabled = enabled; 77 this.contextRoot = contextRoot; 78 this.classLoader = classLoader; 79 80 } 81 82 public Document getServiceDescription() throws Exception { 83 try { 84 if (wsdlFilePath==null) { 85 return null; 86 } 87 File wsdlFile = new File (wsdlFilePath); 88 if (!wsdlFile.exists()) 89 return null; 90 91 InputSource inputSource = 92 new InputSource (new BufferedInputStream ( 93 new FileInputStream (wsdlFile))); 94 return DocumentBuilderFactory.newInstance().newDocumentBuilder(). 95 parse(new BufferedInputStream ( 96 new FileInputStream (wsdlFile))); 97 } catch(Exception e) { 98 throw new Exception (e.getMessage()); 99 } 100 } 101 102 public String getServiceEndpointInterface() { 103 return sei; 104 } 105 106 public String getURI() { 107 return url; 108 } 109 110 public boolean isImplementedByEJB() { 111 return ejbType; 112 } 113 114 public String getImplementationClass() { 115 return implClass; 116 } 117 118 public String getContextRoot() { 119 return contextRoot; 120 } 121 122 public ServiceEndpoint getServiceEndpoint() { 123 return jbiEndpoint; 124 } 125 126 public void setServiceEndpoint(ServiceEndpoint jbiEp) { 127 jbiEndpoint = jbiEp; 128 setServiceName(jbiEp.getServiceName()); 129 setEndpointName(jbiEp.getEndpointName()); 130 } 131 132 public QName getServiceName() { 133 return serviceName; 134 } 135 136 public String getEndpointName() { 137 return endpointName; 138 } 139 140 public boolean isEnabled() { 141 return enabled; 142 } 143 144 public void setEnabled(boolean flag) { 145 enabled = flag; 146 } 147 public boolean isJAXWSEndpoint() { 148 return jaxwsFlag; 149 } 150 151 public ClassLoader getClassLoader() { 152 return classLoader; 153 } 154 155 public String getWsdlPath() { 156 return wsdlFilePath; 157 } 158 159 private void setServiceName(QName svcName) { 160 serviceName = svcName; 161 } 162 163 private void setEndpointName(String epName) { 164 endpointName = epName; 165 } 166 167 } 168 | Popular Tags |