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