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