KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > jbi > serviceengine > core > ServiceEngineEndpoint


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.jbi.serviceengine.core;
24 import java.io.BufferedInputStream JavaDoc;
25 import java.io.File JavaDoc;
26 import java.io.FileInputStream JavaDoc;
27 import javax.jbi.servicedesc.ServiceEndpoint;
28 import javax.xml.parsers.DocumentBuilderFactory JavaDoc;
29 import javax.xml.namespace.QName JavaDoc;
30 import org.w3c.dom.Document JavaDoc;
31 import org.xml.sax.InputSource JavaDoc;
32
33 /**
34  *
35  * @author Manisha Umbarje
36  */

37 public class ServiceEngineEndpoint {
38     
39     private String JavaDoc wsdlFilePath;
40     private ServiceEndpoint jbiEndpoint;
41     //private WebServiceEndpoint endpoint;
42
private String JavaDoc url;
43     private String JavaDoc sei;
44     private String JavaDoc implClass;
45     private boolean jaxwsFlag;
46     private boolean ejbType;
47     private boolean enabled ;
48     private String JavaDoc contextRoot;
49     private QName JavaDoc serviceName;
50     private String JavaDoc endpointName;
51     private ClassLoader JavaDoc classLoader;
52
53     /** Creates a new instance of Endpoint */
54     public ServiceEngineEndpoint(ServiceEndpoint jbiEndpoint, String JavaDoc wsdlFilePath,
55             String JavaDoc sei, String JavaDoc implClass, String JavaDoc addressURI, String JavaDoc contextRoot,
56             boolean ejbType,
57             boolean jaxwsFlag, boolean enabled, ClassLoader JavaDoc 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 JavaDoc serviceName, String JavaDoc endpointName, String JavaDoc wsdlFilePath,
65             String JavaDoc sei, String JavaDoc implClass, String JavaDoc addressURI, String JavaDoc contextRoot,
66             boolean ejbType,
67             boolean jaxwsFlag, boolean enabled, ClassLoader JavaDoc 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 JavaDoc getServiceDescription() throws Exception JavaDoc {
83         try {
84             if (wsdlFilePath==null) {
85                 return null;
86             }
87             File JavaDoc wsdlFile = new File JavaDoc(wsdlFilePath);
88             if (!wsdlFile.exists())
89                 return null;
90
91             InputSource JavaDoc inputSource =
92                     new InputSource JavaDoc(new BufferedInputStream JavaDoc(
93                     new FileInputStream JavaDoc(wsdlFile)));
94             return DocumentBuilderFactory.newInstance().newDocumentBuilder().
95                     parse(new BufferedInputStream JavaDoc(
96                     new FileInputStream JavaDoc(wsdlFile)));
97         } catch(Exception JavaDoc e) {
98             throw new Exception JavaDoc(e.getMessage());
99         }
100     }
101     
102     public String JavaDoc getServiceEndpointInterface() {
103         return sei;
104     }
105     
106     public String JavaDoc getURI() {
107         return url;
108     }
109     
110     public boolean isImplementedByEJB() {
111         return ejbType;
112     }
113     
114     public String JavaDoc getImplementationClass() {
115         return implClass;
116     }
117     
118     public String JavaDoc 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 JavaDoc getServiceName() {
133         return serviceName;
134     }
135     
136     public String JavaDoc 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 JavaDoc getClassLoader() {
152         return classLoader;
153     }
154     
155     public String JavaDoc getWsdlPath() {
156         return wsdlFilePath;
157     }
158     
159     private void setServiceName(QName JavaDoc svcName) {
160         serviceName = svcName;
161     }
162     
163     private void setEndpointName(String JavaDoc epName) {
164         endpointName = epName;
165     }
166
167 }
168
Popular Tags