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