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