KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jass > examples > travelagency > ws > TravelAgencyServiceLocator


1 /**
2  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3  -
4  - JASS: Java Advanced tranSaction Support
5  -
6  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7  -
8  - This module was originally developed by
9  -
10  - LSD (Distributed Systems Lab, http://lsd.ls.fi.upm.es/lsd/lsd.htm)
11  - at Universidad Politecnica de Madrid (UPM) as an ObjectWeb Consortium
12  - (http://www.objectweb.org) project.
13  -
14  - This project has been partially funded by the European Commission under
15  - the IST programme of V FP grant IST-2001-37126 and by the Spanish
16  - Ministry of Science & Technology (MCyT) grants TIC2002-10376-E and
17  - TIC2001-1586-C03-02
18  -
19  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20  - The original code and portions created by LSD are
21  - Copyright (c) 2004 LSD (UPM)
22  - All rights reserved.
23  -
24  - Redistribution and use in source and binary forms, with or without
25  - modification, are permitted provided that the following conditions are met:
26  -
27  - -Redistributions of source code must retain the above copyright notice, this
28  - list of conditions and the following disclaimer.
29  -
30  - -Redistributions in binary form must reproduce the above copyright notice,
31  - this list of conditions and the following disclaimer in the documentation
32  - and/or other materials provided with the distribution.
33  -
34  - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35  - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36  - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37  - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
38  - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39  - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40  - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41  - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42  - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
43  - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44  - POSSIBILITY OF SUCH DAMAGE.
45  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46  -
47  - Author: Francisco Perez Sorrosal (frperezs)
48  -
49  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
50 */

51
52 package org.objectweb.jass.examples.travelagency.ws;
53
54 public class TravelAgencyServiceLocator extends org.apache.axis.client.Service implements org.objectweb.jass.examples.travelagency.ws.TravelAgencyService {
55
56     // Use to get a proxy class for TravelAgency
57
private final java.lang.String JavaDoc TravelAgency_address = "http://localhost:8080/axis/services/TravelAgency";
58
59     public java.lang.String JavaDoc getTravelAgencyAddress() {
60         return TravelAgency_address;
61     }
62
63     // The WSDD service name defaults to the port name.
64
private java.lang.String JavaDoc TravelAgencyWSDDServiceName = "TravelAgency";
65
66     public java.lang.String JavaDoc getTravelAgencyWSDDServiceName() {
67         return TravelAgencyWSDDServiceName;
68     }
69
70     public void setTravelAgencyWSDDServiceName(java.lang.String JavaDoc name) {
71         TravelAgencyWSDDServiceName = name;
72     }
73
74     public org.objectweb.jass.examples.travelagency.ws.TravelAgency getTravelAgency() throws javax.xml.rpc.ServiceException JavaDoc {
75        java.net.URL JavaDoc endpoint;
76         try {
77             endpoint = new java.net.URL JavaDoc(TravelAgency_address);
78         }
79         catch (java.net.MalformedURLException JavaDoc e) {
80             throw new javax.xml.rpc.ServiceException JavaDoc(e);
81         }
82         return getTravelAgency(endpoint);
83     }
84
85     public org.objectweb.jass.examples.travelagency.ws.TravelAgency getTravelAgency(java.net.URL JavaDoc portAddress) throws javax.xml.rpc.ServiceException JavaDoc {
86         try {
87             org.objectweb.jass.examples.travelagency.ws.TravelAgencySoapBindingStub _stub = new org.objectweb.jass.examples.travelagency.ws.TravelAgencySoapBindingStub(portAddress, this);
88             _stub.setPortName(getTravelAgencyWSDDServiceName());
89             return _stub;
90         }
91         catch (org.apache.axis.AxisFault e) {
92             return null;
93         }
94     }
95
96     /**
97      * For the given interface, get the stub implementation.
98      * If this service has no port for the given interface,
99      * then ServiceException is thrown.
100      */

101     public java.rmi.Remote JavaDoc getPort(Class JavaDoc serviceEndpointInterface) throws javax.xml.rpc.ServiceException JavaDoc {
102         try {
103             if (org.objectweb.jass.examples.travelagency.ws.TravelAgency.class.isAssignableFrom(serviceEndpointInterface)) {
104                 org.objectweb.jass.examples.travelagency.ws.TravelAgencySoapBindingStub _stub = new org.objectweb.jass.examples.travelagency.ws.TravelAgencySoapBindingStub(new java.net.URL JavaDoc(TravelAgency_address), this);
105                 _stub.setPortName(getTravelAgencyWSDDServiceName());
106                 return _stub;
107             }
108         }
109         catch (java.lang.Throwable JavaDoc t) {
110             throw new javax.xml.rpc.ServiceException JavaDoc(t);
111         }
112         throw new javax.xml.rpc.ServiceException JavaDoc("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
113     }
114
115     /**
116      * For the given interface, get the stub implementation.
117      * If this service has no port for the given interface,
118      * then ServiceException is thrown.
119      */

120     public java.rmi.Remote JavaDoc getPort(javax.xml.namespace.QName JavaDoc portName, Class JavaDoc serviceEndpointInterface) throws javax.xml.rpc.ServiceException JavaDoc {
121         if (portName == null) {
122             return getPort(serviceEndpointInterface);
123         }
124         String JavaDoc inputPortName = portName.getLocalPart();
125         if ("TravelAgency".equals(inputPortName)) {
126             return getTravelAgency();
127         }
128         else {
129             java.rmi.Remote JavaDoc _stub = getPort(serviceEndpointInterface);
130             ((org.apache.axis.client.Stub) _stub).setPortName(portName);
131             return _stub;
132         }
133     }
134
135     public javax.xml.namespace.QName JavaDoc getServiceName() {
136         return new javax.xml.namespace.QName JavaDoc("http://ws.travelagency.examples.jass.objectweb.org", "TravelAgencyService");
137     }
138
139     private java.util.HashSet JavaDoc ports = null;
140
141     public java.util.Iterator JavaDoc getPorts() {
142         if (ports == null) {
143             ports = new java.util.HashSet JavaDoc();
144             ports.add(new javax.xml.namespace.QName JavaDoc("TravelAgency"));
145         }
146         return ports.iterator();
147     }
148
149 }
150
Popular Tags