8713ef1136824566728c549c408890824f97202e
[jalview.git] / src / ext / vamsas / MuscleWSServiceLocator.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3  * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10  * 
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 /*
19  * Jalview - A Sequence Alignment Editor and Viewer
20  * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
21  *
22  * This program is free software; you can redistribute it and/or
23  * modify it under the terms of the GNU General Public License
24  * as published by the Free Software Foundation; either version 2
25  * of the License, or (at your option) any later version.
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30  * GNU General Public License for more details.
31  *
32  * You should have received a copy of the GNU General Public License
33  * along with this program; if not, write to the Free Software
34  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
35  */
36 package ext.vamsas;
37
38 public class MuscleWSServiceLocator extends org.apache.axis.client.Service
39         implements ext.vamsas.MuscleWSService
40 {
41   // Use to get a proxy class for MuscleWS
42   private java.lang.String MuscleWS_address = "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/MuscleWS";
43
44   // The WSDD service name defaults to the port name.
45   private java.lang.String MuscleWSWSDDServiceName = "MuscleWS";
46
47   private java.util.HashSet ports = null;
48
49   public MuscleWSServiceLocator()
50   {
51   }
52
53   public MuscleWSServiceLocator(org.apache.axis.EngineConfiguration config)
54   {
55     super(config);
56   }
57
58   public java.lang.String getMuscleWSAddress()
59   {
60     return MuscleWS_address;
61   }
62
63   public java.lang.String getMuscleWSWSDDServiceName()
64   {
65     return MuscleWSWSDDServiceName;
66   }
67
68   public void setMuscleWSWSDDServiceName(java.lang.String name)
69   {
70     MuscleWSWSDDServiceName = name;
71   }
72
73   public ext.vamsas.MuscleWS getMuscleWS()
74           throws javax.xml.rpc.ServiceException
75   {
76     java.net.URL endpoint;
77
78     try
79     {
80       endpoint = new java.net.URL(MuscleWS_address);
81     } catch (java.net.MalformedURLException e)
82     {
83       throw new javax.xml.rpc.ServiceException(e);
84     }
85
86     return getMuscleWS(endpoint);
87   }
88
89   public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress)
90           throws javax.xml.rpc.ServiceException
91   {
92     try
93     {
94       ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.MuscleWSSoapBindingStub(
95               portAddress, this);
96       _stub.setPortName(getMuscleWSWSDDServiceName());
97
98       return _stub;
99     } catch (org.apache.axis.AxisFault e)
100     {
101       return null;
102     }
103   }
104
105   public void setMuscleWSEndpointAddress(java.lang.String address)
106   {
107     MuscleWS_address = address;
108   }
109
110   /**
111    * For the given interface, get the stub implementation. If this service has
112    * no port for the given interface, then ServiceException is thrown.
113    */
114   public java.rmi.Remote getPort(Class serviceEndpointInterface)
115           throws javax.xml.rpc.ServiceException
116   {
117     try
118     {
119       if (ext.vamsas.MuscleWS.class
120               .isAssignableFrom(serviceEndpointInterface))
121       {
122         ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.MuscleWSSoapBindingStub(
123                 new java.net.URL(MuscleWS_address), this);
124         _stub.setPortName(getMuscleWSWSDDServiceName());
125
126         return _stub;
127       }
128     } catch (java.lang.Throwable t)
129     {
130       throw new javax.xml.rpc.ServiceException(t);
131     }
132
133     throw new javax.xml.rpc.ServiceException(
134             "There is no stub implementation for the interface:  "
135                     + ((serviceEndpointInterface == null) ? "null"
136                             : serviceEndpointInterface.getName()));
137   }
138
139   /**
140    * For the given interface, get the stub implementation. If this service has
141    * no port for the given interface, then ServiceException is thrown.
142    */
143   public java.rmi.Remote getPort(javax.xml.namespace.QName portName,
144           Class serviceEndpointInterface)
145           throws javax.xml.rpc.ServiceException
146   {
147     if (portName == null)
148     {
149       return getPort(serviceEndpointInterface);
150     }
151
152     java.lang.String inputPortName = portName.getLocalPart();
153
154     if ("MuscleWS".equals(inputPortName))
155     {
156       return getMuscleWS();
157     }
158     else
159     {
160       java.rmi.Remote _stub = getPort(serviceEndpointInterface);
161       ((org.apache.axis.client.Stub) _stub).setPortName(portName);
162
163       return _stub;
164     }
165   }
166
167   public javax.xml.namespace.QName getServiceName()
168   {
169     return new javax.xml.namespace.QName("vamsas", "MuscleWSService");
170   }
171
172   public java.util.Iterator getPorts()
173   {
174     if (ports == null)
175     {
176       ports = new java.util.HashSet();
177       ports.add(new javax.xml.namespace.QName("vamsas", "MuscleWS"));
178     }
179
180     return ports.iterator();
181   }
182
183   /**
184    * Set the endpoint address for the specified port name.
185    */
186   public void setEndpointAddress(java.lang.String portName,
187           java.lang.String address) throws javax.xml.rpc.ServiceException
188   {
189     if ("MuscleWS".equals(portName))
190     {
191       setMuscleWSEndpointAddress(address);
192     }
193     else
194     { // Unknown Port Name
195       throw new javax.xml.rpc.ServiceException(
196               " Cannot set Endpoint Address for Unknown Port" + portName);
197     }
198   }
199
200   /**
201    * Set the endpoint address for the specified port name.
202    */
203   public void setEndpointAddress(javax.xml.namespace.QName portName,
204           java.lang.String address) throws javax.xml.rpc.ServiceException
205   {
206     setEndpointAddress(portName.getLocalPart(), address);
207   }
208 }