applied copyright 2008
[jalview.git] / src / ext / vamsas / MuscleWSServiceLocator.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3  * Copyright (C) 2008 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
40     extends org.apache.axis.client.Service implements ext.vamsas.
41     MuscleWSService
42 {
43   // Use to get a proxy class for MuscleWS
44   private java.lang.String MuscleWS_address =
45       "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/MuscleWS";
46
47   // The WSDD service name defaults to the port name.
48   private java.lang.String MuscleWSWSDDServiceName = "MuscleWS";
49   private java.util.HashSet ports = null;
50
51   public MuscleWSServiceLocator()
52   {
53   }
54
55   public MuscleWSServiceLocator(org.apache.axis.EngineConfiguration config)
56   {
57     super(config);
58   }
59
60   public java.lang.String getMuscleWSAddress()
61   {
62     return MuscleWS_address;
63   }
64
65   public java.lang.String getMuscleWSWSDDServiceName()
66   {
67     return MuscleWSWSDDServiceName;
68   }
69
70   public void setMuscleWSWSDDServiceName(java.lang.String name)
71   {
72     MuscleWSWSDDServiceName = name;
73   }
74
75   public ext.vamsas.MuscleWS getMuscleWS()
76       throws javax.xml.rpc.ServiceException
77   {
78     java.net.URL endpoint;
79
80     try
81     {
82       endpoint = new java.net.URL(MuscleWS_address);
83     }
84     catch (java.net.MalformedURLException e)
85     {
86       throw new javax.xml.rpc.ServiceException(e);
87     }
88
89     return getMuscleWS(endpoint);
90   }
91
92   public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress)
93       throws javax.xml.rpc.ServiceException
94   {
95     try
96     {
97       ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.
98           MuscleWSSoapBindingStub(portAddress,
99                                   this);
100       _stub.setPortName(getMuscleWSWSDDServiceName());
101
102       return _stub;
103     }
104     catch (org.apache.axis.AxisFault e)
105     {
106       return null;
107     }
108   }
109
110   public void setMuscleWSEndpointAddress(java.lang.String address)
111   {
112     MuscleWS_address = address;
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 getPort(Class serviceEndpointInterface)
121       throws javax.xml.rpc.ServiceException
122   {
123     try
124     {
125       if (ext.vamsas.MuscleWS.class.isAssignableFrom(
126           serviceEndpointInterface))
127       {
128         ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.
129             MuscleWSSoapBindingStub(new java.net.URL(
130                 MuscleWS_address), this);
131         _stub.setPortName(getMuscleWSWSDDServiceName());
132
133         return _stub;
134       }
135     }
136     catch (java.lang.Throwable t)
137     {
138       throw new javax.xml.rpc.ServiceException(t);
139     }
140
141     throw new javax.xml.rpc.ServiceException(
142         "There is no stub implementation for the interface:  " +
143         ( (serviceEndpointInterface == null) ? "null"
144          : serviceEndpointInterface.getName()));
145   }
146
147   /**
148    * For the given interface, get the stub implementation.
149    * If this service has no port for the given interface,
150    * then ServiceException is thrown.
151    */
152   public java.rmi.Remote getPort(javax.xml.namespace.QName portName,
153                                  Class serviceEndpointInterface)
154       throws javax.xml.rpc.ServiceException
155   {
156     if (portName == null)
157     {
158       return getPort(serviceEndpointInterface);
159     }
160
161     java.lang.String inputPortName = portName.getLocalPart();
162
163     if ("MuscleWS".equals(inputPortName))
164     {
165       return getMuscleWS();
166     }
167     else
168     {
169       java.rmi.Remote _stub = getPort(serviceEndpointInterface);
170       ( (org.apache.axis.client.Stub) _stub).setPortName(portName);
171
172       return _stub;
173     }
174   }
175
176   public javax.xml.namespace.QName getServiceName()
177   {
178     return new javax.xml.namespace.QName("vamsas", "MuscleWSService");
179   }
180
181   public java.util.Iterator getPorts()
182   {
183     if (ports == null)
184     {
185       ports = new java.util.HashSet();
186       ports.add(new javax.xml.namespace.QName("vamsas", "MuscleWS"));
187     }
188
189     return ports.iterator();
190   }
191
192   /**
193    * Set the endpoint address for the specified port name.
194    */
195   public void setEndpointAddress(java.lang.String portName,
196                                  java.lang.String address)
197       throws javax.xml.rpc.ServiceException
198   {
199     if ("MuscleWS".equals(portName))
200     {
201       setMuscleWSEndpointAddress(address);
202     }
203     else
204     { // Unknown Port Name
205       throw new javax.xml.rpc.ServiceException(
206           " Cannot set Endpoint Address for Unknown Port" + portName);
207     }
208   }
209
210   /**
211    * Set the endpoint address for the specified port name.
212    */
213   public void setEndpointAddress(javax.xml.namespace.QName portName,
214                                  java.lang.String address)
215       throws javax.xml.rpc.ServiceException
216   {
217     setEndpointAddress(portName.getLocalPart(), address);
218   }
219 }