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