9a580f82e404013e8c0942d49a52744b1738352d
[jalview.git] / src / ext / vamsas / MuscleWSServiceLocator.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package ext.vamsas;
22
23 import jalview.util.MessageManager;
24
25 public class MuscleWSServiceLocator extends org.apache.axis.client.Service
26         implements ext.vamsas.MuscleWSService
27 {
28   // Use to get a proxy class for MuscleWS
29   private java.lang.String MuscleWS_address = "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/MuscleWS";
30
31   // The WSDD service name defaults to the port name.
32   private java.lang.String MuscleWSWSDDServiceName = "MuscleWS";
33
34   private java.util.HashSet ports = null;
35
36   public MuscleWSServiceLocator()
37   {
38   }
39
40   public MuscleWSServiceLocator(org.apache.axis.EngineConfiguration config)
41   {
42     super(config);
43   }
44
45   public java.lang.String getMuscleWSAddress()
46   {
47     return MuscleWS_address;
48   }
49
50   public java.lang.String getMuscleWSWSDDServiceName()
51   {
52     return MuscleWSWSDDServiceName;
53   }
54
55   public void setMuscleWSWSDDServiceName(java.lang.String name)
56   {
57     MuscleWSWSDDServiceName = name;
58   }
59
60   public ext.vamsas.MuscleWS getMuscleWS()
61           throws javax.xml.rpc.ServiceException
62   {
63     java.net.URL endpoint;
64
65     try
66     {
67       endpoint = new java.net.URL(MuscleWS_address);
68     } catch (java.net.MalformedURLException e)
69     {
70       throw new javax.xml.rpc.ServiceException(e);
71     }
72
73     return getMuscleWS(endpoint);
74   }
75
76   public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress)
77           throws javax.xml.rpc.ServiceException
78   {
79     try
80     {
81       ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.MuscleWSSoapBindingStub(
82               portAddress, this);
83       _stub.setPortName(getMuscleWSWSDDServiceName());
84
85       return _stub;
86     } catch (org.apache.axis.AxisFault e)
87     {
88       return null;
89     }
90   }
91
92   public void setMuscleWSEndpointAddress(java.lang.String address)
93   {
94     MuscleWS_address = address;
95   }
96
97   /**
98    * For the given interface, get the stub implementation. If this service has
99    * no port for the given interface, then ServiceException is thrown.
100    */
101   public java.rmi.Remote getPort(Class serviceEndpointInterface)
102           throws javax.xml.rpc.ServiceException
103   {
104     try
105     {
106       if (ext.vamsas.MuscleWS.class
107               .isAssignableFrom(serviceEndpointInterface))
108       {
109         ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.MuscleWSSoapBindingStub(
110                 new java.net.URL(MuscleWS_address), this);
111         _stub.setPortName(getMuscleWSWSDDServiceName());
112
113         return _stub;
114       }
115     } catch (java.lang.Throwable t)
116     {
117       throw new javax.xml.rpc.ServiceException(t);
118     }
119
120     throw new javax.xml.rpc.ServiceException(MessageManager.formatMessage("exception.no_stub_implementation_for_interface", new String[]{(serviceEndpointInterface == null ? "null": serviceEndpointInterface.getName())}));
121   }
122
123   /**
124    * For the given interface, get the stub implementation. If this service has
125    * no port for the given interface, then ServiceException is thrown.
126    */
127   public java.rmi.Remote getPort(javax.xml.namespace.QName portName,
128           Class serviceEndpointInterface)
129           throws javax.xml.rpc.ServiceException
130   {
131     if (portName == null)
132     {
133       return getPort(serviceEndpointInterface);
134     }
135
136     java.lang.String inputPortName = portName.getLocalPart();
137
138     if ("MuscleWS".equals(inputPortName))
139     {
140       return getMuscleWS();
141     }
142     else
143     {
144       java.rmi.Remote _stub = getPort(serviceEndpointInterface);
145       ((org.apache.axis.client.Stub) _stub).setPortName(portName);
146
147       return _stub;
148     }
149   }
150
151   public javax.xml.namespace.QName getServiceName()
152   {
153     return new javax.xml.namespace.QName("vamsas", "MuscleWSService");
154   }
155
156   public java.util.Iterator getPorts()
157   {
158     if (ports == null)
159     {
160       ports = new java.util.HashSet();
161       ports.add(new javax.xml.namespace.QName("vamsas", "MuscleWS"));
162     }
163
164     return ports.iterator();
165   }
166
167   /**
168    * Set the endpoint address for the specified port name.
169    */
170   public void setEndpointAddress(java.lang.String portName,
171           java.lang.String address) throws javax.xml.rpc.ServiceException
172   {
173     if ("MuscleWS".equals(portName))
174     {
175       setMuscleWSEndpointAddress(address);
176     }
177     else
178     { // Unknown Port Name
179       throw new javax.xml.rpc.ServiceException(MessageManager.formatMessage("exception.cannot_set_endpoint_address_unknown_port", new String[]{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 }