applied copyright 2008
[jalview.git] / src / ext / vamsas / RegistryServiceSoapBindingStub.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3  * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package ext.vamsas;
20
21 public class RegistryServiceSoapBindingStub
22     extends org.apache.axis.client.Stub implements ext.vamsas.IRegistry
23 {
24   private java.util.Vector cachedSerClasses = new java.util.Vector();
25   private java.util.Vector cachedSerQNames = new java.util.Vector();
26   private java.util.Vector cachedSerFactories = new java.util.Vector();
27   private java.util.Vector cachedDeserFactories = new java.util.Vector();
28
29   static org.apache.axis.description.OperationDesc[] _operations;
30
31   static
32   {
33     _operations = new org.apache.axis.description.OperationDesc[1];
34     _initOperationDesc1();
35   }
36
37   private static void _initOperationDesc1()
38   {
39     org.apache.axis.description.OperationDesc oper;
40     oper = new org.apache.axis.description.OperationDesc();
41     oper.setName("getServices");
42     oper.setReturnType(new javax.xml.namespace.QName("registry.objects.vamsas",
43         "ServiceHandles"));
44     oper.setReturnClass(ext.vamsas.ServiceHandles.class);
45     oper.setReturnQName(new javax.xml.namespace.QName("", "getServicesReturn"));
46     oper.setStyle(org.apache.axis.constants.Style.RPC);
47     oper.setUse(org.apache.axis.constants.Use.ENCODED);
48     _operations[0] = oper;
49
50   }
51
52   public RegistryServiceSoapBindingStub()
53       throws org.apache.axis.AxisFault
54   {
55     this(null);
56   }
57
58   public RegistryServiceSoapBindingStub(java.net.URL endpointURL,
59                                         javax.xml.rpc.Service service)
60       throws org.apache.axis.AxisFault
61   {
62     this(service);
63     super.cachedEndpoint = endpointURL;
64   }
65
66   public RegistryServiceSoapBindingStub(javax.xml.rpc.Service service)
67       throws org.apache.axis.AxisFault
68   {
69     if (service == null)
70     {
71       super.service = new org.apache.axis.client.Service();
72     }
73     else
74     {
75       super.service = service;
76     }
77     java.lang.Class cls;
78     javax.xml.namespace.QName qName;
79     java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
80     java.lang.Class beandf = org.apache.axis.encoding.ser.
81         BeanDeserializerFactory.class;
82     //java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
83     //java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
84     java.lang.Class arraysf = org.apache.axis.encoding.ser.
85         ArraySerializerFactory.class;
86     java.lang.Class arraydf = org.apache.axis.encoding.ser.
87         ArrayDeserializerFactory.class;
88     //java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
89     //java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
90     //java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
91     //java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
92     qName = new javax.xml.namespace.QName("vamsas",
93                                           "ArrayOf_tns1_ServiceHandle");
94     cachedSerQNames.add(qName);
95     cls = ext.vamsas.ServiceHandle[].class;
96     cachedSerClasses.add(cls);
97     cachedSerFactories.add(arraysf);
98     cachedDeserFactories.add(arraydf);
99
100     qName = new javax.xml.namespace.QName("registry.objects.vamsas",
101                                           "ServiceHandles");
102     cachedSerQNames.add(qName);
103     cls = ext.vamsas.ServiceHandles.class;
104     cachedSerClasses.add(cls);
105     cachedSerFactories.add(beansf);
106     cachedDeserFactories.add(beandf);
107
108     qName = new javax.xml.namespace.QName("registry.objects.vamsas",
109                                           "ServiceHandle");
110     cachedSerQNames.add(qName);
111     cls = ext.vamsas.ServiceHandle.class;
112     cachedSerClasses.add(cls);
113     cachedSerFactories.add(beansf);
114     cachedDeserFactories.add(beandf);
115
116   }
117
118   protected org.apache.axis.client.Call createCall()
119       throws java.rmi.RemoteException
120   {
121     try
122     {
123       org.apache.axis.client.Call _call =
124           (org.apache.axis.client.Call)super.service.createCall();
125       if (super.maintainSessionSet)
126       {
127         _call.setMaintainSession(super.maintainSession);
128       }
129       if (super.cachedUsername != null)
130       {
131         _call.setUsername(super.cachedUsername);
132       }
133       if (super.cachedPassword != null)
134       {
135         _call.setPassword(super.cachedPassword);
136       }
137       if (super.cachedEndpoint != null)
138       {
139         _call.setTargetEndpointAddress(super.cachedEndpoint);
140       }
141       if (super.cachedTimeout != null)
142       {
143         _call.setTimeout(super.cachedTimeout);
144       }
145       if (super.cachedPortName != null)
146       {
147         _call.setPortName(super.cachedPortName);
148       }
149       java.util.Enumeration keys = super.cachedProperties.keys();
150       while (keys.hasMoreElements())
151       {
152         java.lang.String key = (java.lang.String) keys.nextElement();
153         _call.setProperty(key, super.cachedProperties.get(key));
154       }
155       // All the type mapping information is registered
156       // when the first call is made.
157       // The type mapping information is actually registered in
158       // the TypeMappingRegistry of the service, which
159       // is the reason why registration is only needed for the first call.
160       synchronized (this)
161       {
162         if (firstCall())
163         {
164           // must set encoding style before registering serializers
165           _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.
166                                SOAP11_CONSTANTS);
167           _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
168           for (int i = 0; i < cachedSerFactories.size(); ++i)
169           {
170             java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
171             javax.xml.namespace.QName qName =
172                 (javax.xml.namespace.QName) cachedSerQNames.get(i);
173             java.lang.Class sf = (java.lang.Class)
174                 cachedSerFactories.get(i);
175             java.lang.Class df = (java.lang.Class)
176                 cachedDeserFactories.get(i);
177             _call.registerTypeMapping(cls, qName, sf, df, false);
178           }
179         }
180       }
181       return _call;
182     }
183     catch (java.lang.Throwable _t)
184     {
185       throw new org.apache.axis.AxisFault(
186           "Failure trying to get the Call object", _t);
187     }
188   }
189
190   public ext.vamsas.ServiceHandles getServices()
191       throws java.rmi.RemoteException
192   {
193     if (super.cachedEndpoint == null)
194     {
195       throw new org.apache.axis.NoEndPointException();
196     }
197     org.apache.axis.client.Call _call = createCall();
198     _call.setOperation(_operations[0]);
199     _call.setUseSOAPAction(true);
200     _call.setSOAPActionURI("");
201     _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
202     _call.setOperationName(new javax.xml.namespace.QName("vamsas",
203         "getServices"));
204
205     setRequestHeaders(_call);
206     setAttachments(_call);
207     java.lang.Object _resp = _call.invoke(new java.lang.Object[]
208                                           {});
209
210     if (_resp instanceof java.rmi.RemoteException)
211     {
212       throw (java.rmi.RemoteException) _resp;
213     }
214     else
215     {
216       extractAttachments(_call);
217       try
218       {
219         return (ext.vamsas.ServiceHandles) _resp;
220       }
221       catch (java.lang.Exception _exception)
222       {
223         return (ext.vamsas.ServiceHandles) org.apache.axis.utils.JavaUtils.
224             convert(_resp, ext.vamsas.ServiceHandles.class);
225       }
226     }
227   }
228
229 }