From 08bde8d252a69d4d6a3b2497f759bd5d6f154a3f Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 29 Apr 2008 10:51:04 +0000 Subject: [PATCH] added SeqSearch service interface. Documented and refactored web service client (tbc - more refactors to come). --- src/ext/vamsas/SeqSearchI.java | 16 + src/ext/vamsas/SeqSearchServiceLocator.java | 136 ++++ src/ext/vamsas/SeqSearchServiceService.java | 16 + .../vamsas/SeqSearchServiceSoapBindingStub.java | 366 +++++++++++ src/jalview/gui/AlignFrame.java | 145 +---- src/jalview/gui/WebserviceInfo.java | 272 +++++--- src/jalview/ws/Discoverer.java | 37 ++ src/jalview/ws/JPredClient.java | 37 ++ src/jalview/ws/MsaWSClient.java | 60 ++ src/jalview/ws/SeqSearchWSClient.java | 294 +++++++++ src/jalview/ws/SeqSearchWSThread.java | 667 ++++++++++++++++++++ src/jalview/ws/WSClient.java | 30 +- src/jalview/ws/WSClientI.java | 12 +- src/jalview/ws/WSThread.java | 1 + src/vamsas/objects/simple/Alignment.java | 329 ++++------ src/vamsas/objects/simple/Alignment_Helper.java | 155 ++--- src/vamsas/objects/simple/Object.java | 127 ++-- src/vamsas/objects/simple/Object_Helper.java | 120 ++-- src/vamsas/objects/simple/Result.java | 632 +++++++++---------- src/vamsas/objects/simple/Result_Helper.java | 194 +++--- src/vamsas/objects/simple/SeqSearchResult.java | 161 +++++ .../objects/simple/SeqSearchResult_Helper.java | 70 ++ src/vamsas/objects/simple/Sequence.java | 179 +++--- src/vamsas/objects/simple/SequenceSet.java | 211 +++---- src/vamsas/objects/simple/SequenceSet_Helper.java | 133 ++-- src/vamsas/objects/simple/Sequence_Helper.java | 95 ++- src/vamsas/objects/simple/WsJobId.java | 242 +++---- src/vamsas/objects/simple/WsJobId_Helper.java | 144 ++--- 28 files changed, 3196 insertions(+), 1685 deletions(-) create mode 100644 src/ext/vamsas/SeqSearchI.java create mode 100644 src/ext/vamsas/SeqSearchServiceLocator.java create mode 100644 src/ext/vamsas/SeqSearchServiceService.java create mode 100644 src/ext/vamsas/SeqSearchServiceSoapBindingStub.java create mode 100644 src/jalview/ws/SeqSearchWSClient.java create mode 100644 src/jalview/ws/SeqSearchWSThread.java create mode 100644 src/vamsas/objects/simple/SeqSearchResult.java create mode 100644 src/vamsas/objects/simple/SeqSearchResult_Helper.java diff --git a/src/ext/vamsas/SeqSearchI.java b/src/ext/vamsas/SeqSearchI.java new file mode 100644 index 0000000..3c89161 --- /dev/null +++ b/src/ext/vamsas/SeqSearchI.java @@ -0,0 +1,16 @@ +/** + * ScanPSService.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. + */ + +package ext.vamsas; + +public interface SeqSearchI extends java.rmi.Remote { + public java.lang.String getDatabase() throws java.rmi.RemoteException; + public vamsas.objects.simple.SeqSearchResult getResult(java.lang.String job_id) throws java.rmi.RemoteException; + public vamsas.objects.simple.WsJobId psearch(vamsas.objects.simple.Alignment al, java.lang.String database) throws java.rmi.RemoteException; + public vamsas.objects.simple.WsJobId search(vamsas.objects.simple.Sequence s, java.lang.String database) throws java.rmi.RemoteException; + public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) throws java.rmi.RemoteException; +} diff --git a/src/ext/vamsas/SeqSearchServiceLocator.java b/src/ext/vamsas/SeqSearchServiceLocator.java new file mode 100644 index 0000000..46b435b --- /dev/null +++ b/src/ext/vamsas/SeqSearchServiceLocator.java @@ -0,0 +1,136 @@ +/** + * ScanPSServiceServiceLocator.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. + */ + +package ext.vamsas; + +public class SeqSearchServiceLocator extends org.apache.axis.client.Service implements ext.vamsas.SeqSearchServiceService { + + public SeqSearchServiceLocator() { + } + + + public SeqSearchServiceLocator(org.apache.axis.EngineConfiguration config) { + super(config); + } + + // Use to get a proxy class for ScanPSService + private java.lang.String ScanPSService_address = "http://localhost:8080/TestJWS/services/ScanPSService"; + + public java.lang.String getSeqSeachServiceAddress() { + return ScanPSService_address; + } + + // The WSDD service name defaults to the port name. + private java.lang.String ScanPSServiceWSDDServiceName = "ScanPSService"; + + public java.lang.String getScanPSServiceWSDDServiceName() { + return ScanPSServiceWSDDServiceName; + } + + public void setScanPSServiceWSDDServiceName(java.lang.String name) { + ScanPSServiceWSDDServiceName = name; + } + + public ext.vamsas.SeqSearchI getSeqSearchService() throws javax.xml.rpc.ServiceException { + java.net.URL endpoint; + try { + endpoint = new java.net.URL(ScanPSService_address); + } + catch (java.net.MalformedURLException e) { + throw new javax.xml.rpc.ServiceException(e); + } + return getSeqSearchService(endpoint); + } + + public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress) throws javax.xml.rpc.ServiceException { + try { + ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub(portAddress, this); + _stub.setPortName(getScanPSServiceWSDDServiceName()); + return _stub; + } + catch (org.apache.axis.AxisFault e) { + return null; + } + } + + public void setScanPSServiceEndpointAddress(java.lang.String address) { + ScanPSService_address = address; + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { + try { + if (ext.vamsas.SeqSearchI.class.isAssignableFrom(serviceEndpointInterface)) { + ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub(new java.net.URL(ScanPSService_address), this); + _stub.setPortName(getScanPSServiceWSDDServiceName()); + return _stub; + } + } + catch (java.lang.Throwable t) { + throw new javax.xml.rpc.ServiceException(t); + } + throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName())); + } + + /** + * For the given interface, get the stub implementation. + * If this service has no port for the given interface, + * then ServiceException is thrown. + */ + public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { + if (portName == null) { + return getPort(serviceEndpointInterface); + } + java.lang.String inputPortName = portName.getLocalPart(); + if ("ScanPSService".equals(inputPortName)) { + return getSeqSearchService(); + } + else { + java.rmi.Remote _stub = getPort(serviceEndpointInterface); + ((org.apache.axis.client.Stub) _stub).setPortName(portName); + return _stub; + } + } + + public javax.xml.namespace.QName getServiceName() { + return new javax.xml.namespace.QName("vamsas", "ScanPSServiceService"); + } + + private java.util.HashSet ports = null; + + public java.util.Iterator getPorts() { + if (ports == null) { + ports = new java.util.HashSet(); + ports.add(new javax.xml.namespace.QName("vamsas", "ScanPSService")); + } + return ports.iterator(); + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException { + if ("ScanPSService".equals(portName)) { + setScanPSServiceEndpointAddress(address); + } + else { // Unknown Port Name + throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName); + } + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException { + setEndpointAddress(portName.getLocalPart(), address); + } + +} diff --git a/src/ext/vamsas/SeqSearchServiceService.java b/src/ext/vamsas/SeqSearchServiceService.java new file mode 100644 index 0000000..0dd4c14 --- /dev/null +++ b/src/ext/vamsas/SeqSearchServiceService.java @@ -0,0 +1,16 @@ +/** + * ScanPSServiceService.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. + */ + +package ext.vamsas; + +public interface SeqSearchServiceService extends javax.xml.rpc.Service { + public java.lang.String getSeqSeachServiceAddress(); + + public ext.vamsas.SeqSearchI getSeqSearchService() throws javax.xml.rpc.ServiceException; + + public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress) throws javax.xml.rpc.ServiceException; +} diff --git a/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java b/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java new file mode 100644 index 0000000..614a85f --- /dev/null +++ b/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java @@ -0,0 +1,366 @@ +/** + * ScanPSServiceSoapBindingStub.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. + */ + +package ext.vamsas; + +public class SeqSearchServiceSoapBindingStub extends org.apache.axis.client.Stub implements ext.vamsas.SeqSearchI { + private java.util.Vector cachedSerClasses = new java.util.Vector(); + private java.util.Vector cachedSerQNames = new java.util.Vector(); + private java.util.Vector cachedSerFactories = new java.util.Vector(); + private java.util.Vector cachedDeserFactories = new java.util.Vector(); + + static org.apache.axis.description.OperationDesc [] _operations; + + static { + _operations = new org.apache.axis.description.OperationDesc[5]; + _initOperationDesc1(); + } + + private static void _initOperationDesc1(){ + org.apache.axis.description.OperationDesc oper; + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("getDatabase"); + oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); + oper.setReturnClass(java.lang.String.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "getDatabaseReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[0] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("getResult"); + oper.addParameter(new javax.xml.namespace.QName("", "job_id"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName("simple.objects.vamsas", "SeqSearchResult")); + oper.setReturnClass(vamsas.objects.simple.SeqSearchResult.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[1] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("psearch"); + oper.addParameter(new javax.xml.namespace.QName("", "al"), new javax.xml.namespace.QName("simple.objects.vamsas", "Alignment"), vamsas.objects.simple.Alignment.class, org.apache.axis.description.ParameterDesc.IN, false, false); + oper.addParameter(new javax.xml.namespace.QName("", "database"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId")); + oper.setReturnClass(vamsas.objects.simple.WsJobId.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "psearchReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[2] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("search"); + oper.addParameter(new javax.xml.namespace.QName("", "s"), new javax.xml.namespace.QName("simple.objects.vamsas", "Sequence"), vamsas.objects.simple.Sequence.class, org.apache.axis.description.ParameterDesc.IN, false, false); + oper.addParameter(new javax.xml.namespace.QName("", "database"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId")); + oper.setReturnClass(vamsas.objects.simple.WsJobId.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "searchReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[3] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("cancel"); + oper.addParameter(new javax.xml.namespace.QName("", "jobId"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId")); + oper.setReturnClass(vamsas.objects.simple.WsJobId.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[4] = oper; + + } + + public SeqSearchServiceSoapBindingStub() throws org.apache.axis.AxisFault { + this(null); + } + + public SeqSearchServiceSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { + this(service); + super.cachedEndpoint = endpointURL; + } + + public SeqSearchServiceSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { + if (service == null) { + super.service = new org.apache.axis.client.Service(); + } else { + super.service = service; + } + java.lang.Class cls; + javax.xml.namespace.QName qName; + java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class; + java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class; + java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class; + java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class; + java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class; + java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class; + java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class; + java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class; + java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class; + java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class; + qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Result.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.WsJobId.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("http://simple.objects.vamsas", "Object"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Object.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string"); + cachedSerQNames.add(qName); + cls = java.lang.String[].class; + cachedSerClasses.add(cls); + cachedSerFactories.add(arraysf); + cachedDeserFactories.add(arraydf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Alignment"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Alignment.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Sequence"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Sequence.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Sequence[].class; + cachedSerClasses.add(cls); + cachedSerFactories.add(arraysf); + cachedDeserFactories.add(arraydf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", "SeqSearchResult"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.SeqSearchResult.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", "SequenceSet"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.SequenceSet.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + } + + protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException { + try { + org.apache.axis.client.Call _call = + (org.apache.axis.client.Call) super.service.createCall(); + if (super.maintainSessionSet) { + _call.setMaintainSession(super.maintainSession); + } + if (super.cachedUsername != null) { + _call.setUsername(super.cachedUsername); + } + if (super.cachedPassword != null) { + _call.setPassword(super.cachedPassword); + } + if (super.cachedEndpoint != null) { + _call.setTargetEndpointAddress(super.cachedEndpoint); + } + if (super.cachedTimeout != null) { + _call.setTimeout(super.cachedTimeout); + } + if (super.cachedPortName != null) { + _call.setPortName(super.cachedPortName); + } + java.util.Enumeration keys = super.cachedProperties.keys(); + while (keys.hasMoreElements()) { + java.lang.String key = (java.lang.String) keys.nextElement(); + _call.setProperty(key, super.cachedProperties.get(key)); + } + // All the type mapping information is registered + // when the first call is made. + // The type mapping information is actually registered in + // the TypeMappingRegistry of the service, which + // is the reason why registration is only needed for the first call. + synchronized (this) { + if (firstCall()) { + // must set encoding style before registering serializers + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC); + for (int i = 0; i < cachedSerFactories.size(); ++i) { + java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i); + javax.xml.namespace.QName qName = + (javax.xml.namespace.QName) cachedSerQNames.get(i); + java.lang.Class sf = (java.lang.Class) + cachedSerFactories.get(i); + java.lang.Class df = (java.lang.Class) + cachedDeserFactories.get(i); + _call.registerTypeMapping(cls, qName, sf, df, false); + } + } + } + return _call; + } + catch (java.lang.Throwable _t) { + throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t); + } + } + + public java.lang.String getDatabase() throws java.rmi.RemoteException { + if (super.cachedEndpoint == null) { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[0]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", "getDatabase")); + + setRequestHeaders(_call); + setAttachments(_call); + java.lang.Object _resp = _call.invoke(new java.lang.Object[] {}); + + if (_resp instanceof java.rmi.RemoteException) { + throw (java.rmi.RemoteException)_resp; + } + else { + extractAttachments(_call); + try { + return (java.lang.String) _resp; + } catch (java.lang.Exception _exception) { + return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class); + } + } + } + + public vamsas.objects.simple.SeqSearchResult getResult(java.lang.String job_id) throws java.rmi.RemoteException { + if (super.cachedEndpoint == null) { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[1]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", "getResult")); + + setRequestHeaders(_call); + setAttachments(_call); + java.lang.Object _resp = _call.invoke(new java.lang.Object[] {job_id}); + + if (_resp instanceof java.rmi.RemoteException) { + throw (java.rmi.RemoteException)_resp; + } + else { + extractAttachments(_call); + try { + return (vamsas.objects.simple.SeqSearchResult) _resp; + } catch (java.lang.Exception _exception) { + return (vamsas.objects.simple.SeqSearchResult) org.apache.axis.utils.JavaUtils.convert(_resp, vamsas.objects.simple.SeqSearchResult.class); + } + } + } + + public vamsas.objects.simple.WsJobId psearch(vamsas.objects.simple.Alignment al, java.lang.String database) throws java.rmi.RemoteException { + if (super.cachedEndpoint == null) { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[2]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", "psearch")); + + setRequestHeaders(_call); + setAttachments(_call); + java.lang.Object _resp = _call.invoke(new java.lang.Object[] {al, database}); + + if (_resp instanceof java.rmi.RemoteException) { + throw (java.rmi.RemoteException)_resp; + } + else { + extractAttachments(_call); + try { + return (vamsas.objects.simple.WsJobId) _resp; + } catch (java.lang.Exception _exception) { + return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.convert(_resp, vamsas.objects.simple.WsJobId.class); + } + } + } + + public vamsas.objects.simple.WsJobId search(vamsas.objects.simple.Sequence s, java.lang.String database) throws java.rmi.RemoteException { + if (super.cachedEndpoint == null) { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[3]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", "search")); + + setRequestHeaders(_call); + setAttachments(_call); + java.lang.Object _resp = _call.invoke(new java.lang.Object[] {s, database}); + + if (_resp instanceof java.rmi.RemoteException) { + throw (java.rmi.RemoteException)_resp; + } + else { + extractAttachments(_call); + try { + return (vamsas.objects.simple.WsJobId) _resp; + } catch (java.lang.Exception _exception) { + return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.convert(_resp, vamsas.objects.simple.WsJobId.class); + } + } + } + + public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) throws java.rmi.RemoteException { + if (super.cachedEndpoint == null) { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[4]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel")); + + setRequestHeaders(_call); + setAttachments(_call); + java.lang.Object _resp = _call.invoke(new java.lang.Object[] {jobId}); + + if (_resp instanceof java.rmi.RemoteException) { + throw (java.rmi.RemoteException)_resp; + } + else { + extractAttachments(_call); + try { + return (vamsas.objects.simple.WsJobId) _resp; + } catch (java.lang.Exception _exception) { + return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.convert(_resp, vamsas.objects.simple.WsJobId.class); + } + } + } + +} diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index f536382..39a7fac 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -3270,7 +3270,7 @@ public class AlignFrame * or just the selected set will be submitted for multiple alignment. * */ - private jalview.datamodel.AlignmentView gatherSequencesForAlignment() + public jalview.datamodel.AlignmentView gatherSequencesForAlignment() { // Now, check we have enough sequences AlignmentView msa = null; @@ -3308,12 +3308,14 @@ public class AlignFrame } /** - * Decides what is submitted to a secondary structure prediction service, - * the currently selected sequence, or the currently selected alignment + * Decides what is submitted to a secondary structure prediction service: + * the first sequence in the alignment, or in the current selection, + * or, if the alignment is 'aligned' (ie padded with gaps), then the + * currently selected region or the whole alignment. * (where the first sequence in the set is the one that the prediction * will be for). */ - AlignmentView gatherSeqOrMsaForSecStrPrediction() + public AlignmentView gatherSeqOrMsaForSecStrPrediction() { AlignmentView seqs = null; @@ -3475,43 +3477,9 @@ public class AlignFrame { final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) msaws. get(i); - final JMenuItem method = new JMenuItem(sh.getName()); - method.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - AlignmentView msa = gatherSequencesForAlignment(); - new jalview.ws.MsaWSClient(sh, title, msa, - false, true, - viewport.getAlignment().getDataset(), - af); - - } - - }); - msawsmenu.add(method); - // Deal with services that we know accept partial alignments. - // TODO: this should be a service property - ie sh.getProperty("submitGaps")==Boolean.true - if (sh.getName().indexOf("lustal") > -1) - { - // We know that ClustalWS can accept partial alignments for refinement. - final JMenuItem methodR = new JMenuItem(sh.getName()+" Realign"); - methodR.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - AlignmentView msa = gatherSequencesForAlignment(); - new jalview.ws.MsaWSClient(sh, title, msa, - true, true, - viewport.getAlignment().getDataset(), - af); - - } - - }); - msawsmenu.add(methodR); - - } + jalview.ws.WSClient impl = jalview.ws.Discoverer.getServiceClient(sh); + impl.attachWSMenuEntry(msawsmenu, this); + } wsmenu.add(msawsmenu); } @@ -3523,105 +3491,24 @@ public class AlignFrame { final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) secstrpr.get(i); - final JMenuItem method = new JMenuItem(sh.getName()); - method.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - AlignmentView msa = gatherSeqOrMsaForSecStrPrediction(); - if (msa.getSequences().length == 1) - { - // Single Sequence prediction - new jalview.ws.JPredClient(sh, title, false, msa, af, true); - } - else - { - if (msa.getSequences().length > 1) - { - // Sequence profile based prediction - new jalview.ws.JPredClient(sh, - title, true, msa, af, true); - } - } - } - }); - secstrmenu.add(method); + jalview.ws.WSClient impl = jalview.ws.Discoverer.getServiceClient(sh); + impl.attachWSMenuEntry(secstrmenu, this); } wsmenu.add(secstrmenu); -/* } + } if (seqsrch!=null) { - // Add any secondary structure prediction services + // Add any sequence search services final JMenu seqsrchmenu = new JMenu("Sequence Database Search"); - Hashtable dbsrchs = new Hashtable(); - JMenu defmenu; - dbsrchs.put("", defmenu = new JMenu("Default Database")); for (int i = 0, j = seqsrch.size(); i < j; i++) { final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) seqsrch.elementAt(i); - - String dbs[] = null; - try { - dbs = new jalview.ws.SeqSearchWSClient(sh).getSupportedDatabases(); - } catch (Exception e) - { - jalview.bin.Cache.log.warn("Database list request failed, so disabling SeqSearch Service client "+sh.getName()+" at "+sh.getEndpointURL(), e); - continue; - } - JMenuItem method; - // do default entry - defmenu.add(method = new JMenuItem(sh.getName())); - method.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - // use same input gatherer as for secondary structure prediction - // we could actually parameterise the gatherer method here... - AlignmentView msa = gatherSeqOrMsaForSecStrPrediction(); - new jalview.ws.SeqSearchWSClient(sh, title, msa, null, - viewport.getAlignment().getDataset(), - af); - } - } - ); - // add entry for each database the service supports - for (int db=0; dbs!=null && db= jobPanes.size()) { - throw new Error("setStatus called for non-existent job pane." + jobpane); + throw new Error("setStatus called for non-existent job pane." + + jobpane); } switch (status) { - case STATE_QUEUING: - setProgressName(jobpane + " - QUEUED", jobpane); - break; - case STATE_RUNNING: - setProgressName(jobpane + " - RUNNING", jobpane); - break; - case STATE_STOPPED_OK: - setProgressName(jobpane + " - FINISHED", jobpane); - break; - case STATE_CANCELLED_OK: - setProgressName(jobpane + " - CANCELLED", jobpane); - break; - case STATE_STOPPED_ERROR: - setProgressName(jobpane + " - BROKEN", jobpane); - break; - case STATE_STOPPED_SERVERERROR: - setProgressName(jobpane + " - ALERT", jobpane); - break; - default: - setProgressName(jobpane + " - UNKNOWN STATE", jobpane); + case STATE_QUEUING: + setProgressName(jobpane + " - QUEUED", jobpane); + break; + case STATE_RUNNING: + setProgressName(jobpane + " - RUNNING", jobpane); + break; + case STATE_STOPPED_OK: + setProgressName(jobpane + " - FINISHED", jobpane); + break; + case STATE_CANCELLED_OK: + setProgressName(jobpane + " - CANCELLED", jobpane); + break; + case STATE_STOPPED_ERROR: + setProgressName(jobpane + " - BROKEN", jobpane); + break; + case STATE_STOPPED_SERVERERROR: + setProgressName(jobpane + " - ALERT", jobpane); + break; + default: + setProgressName(jobpane + " - UNKNOWN STATE", jobpane); } } /** * DOCUMENT ME! - * + * * @return DOCUMENT ME! */ public String getInfoText() @@ -251,8 +311,9 @@ public class WebserviceInfo /** * DOCUMENT ME! - * - * @param text DOCUMENT ME! + * + * @param text + * DOCUMENT ME! */ public void setInfoText(String text) { @@ -261,8 +322,9 @@ public class WebserviceInfo /** * DOCUMENT ME! - * - * @param text DOCUMENT ME! + * + * @param text + * DOCUMENT ME! */ public void appendInfoText(String text) { @@ -271,7 +333,7 @@ public class WebserviceInfo /** * DOCUMENT ME! - * + * * @return DOCUMENT ME! */ public String getProgressText(int which) @@ -280,14 +342,15 @@ public class WebserviceInfo { addJobPane(); } - return ( (JTextArea) ( (JScrollPane) jobPanes.get(which)).getViewport(). - getComponent(0)).getText(); + return ((JTextArea) ((JScrollPane) jobPanes.get(which)).getViewport() + .getComponent(0)).getText(); } /** * DOCUMENT ME! - * - * @param text DOCUMENT ME! + * + * @param text + * DOCUMENT ME! */ public void setProgressText(int which, String text) { @@ -295,14 +358,15 @@ public class WebserviceInfo { addJobPane(); } - ( (JTextArea) ( (JScrollPane) jobPanes.get(which)).getViewport(). - getComponent(0)).setText(text); + ((JTextArea) ((JScrollPane) jobPanes.get(which)).getViewport() + .getComponent(0)).setText(text); } /** * DOCUMENT ME! - * - * @param text DOCUMENT ME! + * + * @param text + * DOCUMENT ME! */ public void appendProgressText(int which, String text) { @@ -310,8 +374,8 @@ public class WebserviceInfo { addJobPane(); } - ( (JTextArea) ( (JScrollPane) jobPanes.get(which)).getViewport(). - getComponent(0)).append(text); + ((JTextArea) ((JScrollPane) jobPanes.get(which)).getViewport() + .getComponent(0)).append(text); } /** @@ -340,7 +404,9 @@ public class WebserviceInfo /** * get the tab title for a subjob - * @param which int + * + * @param which + * int * @return String */ public String getProgressName(int which) @@ -355,15 +421,18 @@ public class WebserviceInfo } else { - return ( (JScrollPane) jobPanes.get(which)).getViewport().getComponent(0). - getName(); + return ((JScrollPane) jobPanes.get(which)).getViewport() + .getComponent(0).getName(); } } /** * set the tab title for a subjob - * @param name String - * @param which int + * + * @param name + * String + * @param which + * int */ public void setProgressName(String name, int which) { @@ -380,17 +449,21 @@ public class WebserviceInfo /** * Gui action for cancelling the current job, if possible. - * - * @param e DOCUMENT ME! + * + * @param e + * DOCUMENT ME! */ protected void cancel_actionPerformed(ActionEvent e) { if (!serviceIsCancellable) { + // JBPNote : TODO: We should REALLY just tell the WSClientI to cancel + // anyhow - it has to stop threads and clean up + // JBPNote : TODO: Instead of a warning, we should have an optional 'Are + // you sure?' prompt JOptionPane.showInternalMessageDialog(Desktop.desktop, - "This job cannot be cancelled.\nJust close the window.", - "Cancel job", - JOptionPane.WARNING_MESSAGE); + "This job cannot be cancelled.\nJust close the window.", + "Cancel job", JOptionPane.WARNING_MESSAGE); } else { @@ -422,7 +495,8 @@ public class WebserviceInfo } /** - * called when job has finished but no result objects can be passed back to user + * called when job has finished but no result objects can be passed back to + * user */ public void setFinishedNoResults() { @@ -432,10 +506,10 @@ public class WebserviceInfo validate(); } - class AnimatedPanel - extends JPanel implements Runnable + class AnimatedPanel extends JPanel implements Runnable { long startTime = 0; + BufferedImage offscreen; public void run() @@ -448,8 +522,7 @@ public class WebserviceInfo { Thread.sleep(50); - int units = (int) ( (System.currentTimeMillis() - startTime) / - 10f); + int units = (int) ((System.currentTimeMillis() - startTime) / 10f); angle += units; angle %= 360; startTime = System.currentTimeMillis(); @@ -460,8 +533,7 @@ public class WebserviceInfo } repaint(); - } - catch (Exception ex) + } catch (Exception ex) { } } @@ -472,10 +544,10 @@ public class WebserviceInfo void drawPanel() { if (offscreen == null || offscreen.getWidth(this) != getWidth() - || offscreen.getHeight(this) != getHeight()) + || offscreen.getHeight(this) != getHeight()) { offscreen = new BufferedImage(getWidth(), getHeight(), - BufferedImage.TYPE_INT_ARGB); + BufferedImage.TYPE_INT_ARGB); } Graphics2D g = (Graphics2D) offscreen.getGraphics(); @@ -488,44 +560,42 @@ public class WebserviceInfo switch (currentStatus) { - case STATE_QUEUING: - g.drawString(title.concat(" - queuing"), 60, 30); + case STATE_QUEUING: + g.drawString(title.concat(" - queuing"), 60, 30); - break; + break; - case STATE_RUNNING: - g.drawString(title.concat(" - running"), 60, 30); + case STATE_RUNNING: + g.drawString(title.concat(" - running"), 60, 30); - break; + break; - case STATE_STOPPED_OK: - g.drawString(title.concat(" - complete"), 60, 30); + case STATE_STOPPED_OK: + g.drawString(title.concat(" - complete"), 60, 30); - break; + break; - case STATE_CANCELLED_OK: - g.drawString(title.concat(" - job cancelled!"), 60, 30); + case STATE_CANCELLED_OK: + g.drawString(title.concat(" - job cancelled!"), 60, 30); - break; + break; - case STATE_STOPPED_ERROR: - g.drawString(title.concat(" - job error!"), 60, 30); + case STATE_STOPPED_ERROR: + g.drawString(title.concat(" - job error!"), 60, 30); - break; + break; - case STATE_STOPPED_SERVERERROR: - g.drawString(title.concat(" - Server Error! (try later)"), - 60, - 30); + case STATE_STOPPED_SERVERERROR: + g.drawString(title.concat(" - Server Error! (try later)"), 60, 30); - break; + break; } if (image != null) { g.rotate(Math.toRadians(angle), 28, 28); g.drawImage(image, 10, 10, this); - g.rotate( -Math.toRadians(angle), 28, 28); + g.rotate(-Math.toRadians(angle), 28, 28); } } diff --git a/src/jalview/ws/Discoverer.java b/src/jalview/ws/Discoverer.java index 02028b4..8aea33d 100755 --- a/src/jalview/ws/Discoverer.java +++ b/src/jalview/ws/Discoverer.java @@ -380,4 +380,41 @@ public class Discoverer }; discoverThread.start(); } + /** + * binding service abstract name to handler class + */ + private static Hashtable serviceClientBindings; + public static WSClient getServiceClient(ServiceHandle sh) + { + if (serviceClientBindings==null) + { + // get a list from Config or create below + serviceClientBindings = new Hashtable(); + serviceClientBindings.put("MsaWS",new MsaWSClient()); + serviceClientBindings.put("SecStrPred",new JPredClient()); + serviceClientBindings.put("SeqSearch",new SeqSearchWSClient()); + } + WSClient instance = (WSClient) serviceClientBindings.get(sh.getAbstractName()); + if (instance==null) + { + System.err.println("WARNING - POSSIBLE IMPLEMENTATION ERROR - cannot find WSClient implementation for "+sh.getAbstractName()); + } else + { + instance.serviceHandle = sh; + } + return instance; + } + /** + * notes on discovery service + * 1. need to allow multiple discovery source urls. + * 2. user interface to add/control list of urls in preferences + * notes on wsclient discovery + * 1. need a classpath property with list of additional plugin directories + * 2. optional config to cite specific bindings between class name and Abstract service name. + * 3. precedence for automatic discovery by using getAbstractName for WSClient - user added plugins override default plugins ? + * notes on wsclient gui + * code for gui attachment now moved to wsclient implementation. Needs more abstraction but approach seems to work. + * is it possible to 'generalise' the data retrieval calls further ? current methods are very specific (gatherForMSA or gatherForSeqOrMsaSecStrPred), new methods for conservation (group or alignment), treecalc (aligned profile), seqannot (sequences selected from dataset, annotation back to dataset). + * + */ } diff --git a/src/jalview/ws/JPredClient.java b/src/jalview/ws/JPredClient.java index 80ed959..e14816c 100755 --- a/src/jalview/ws/JPredClient.java +++ b/src/jalview/ws/JPredClient.java @@ -18,6 +18,8 @@ */ package jalview.ws; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.*; import javax.swing.*; @@ -217,6 +219,13 @@ public class JPredClient startJPredClient(title, seq, null); } + public JPredClient() + { + + super(); + // add a class reference to the list + } + private void startJPredClient(String title, SequenceI[] msf, AlignFrame parentFrame) { @@ -328,4 +337,32 @@ public class JPredClient return server; } + + public void attachWSMenuEntry(JMenu wsmenu, final ServiceHandle sh, final AlignFrame af) + { + final JMenuItem method = new JMenuItem(sh.getName()); + method.setToolTipText(sh.getEndpointURL()); + method.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + AlignmentView msa = af.gatherSeqOrMsaForSecStrPrediction(); + if (msa.getSequences().length == 1) + { + // Single Sequence prediction + new jalview.ws.JPredClient(sh, af.getTitle(), false, msa, af, true); + } + else + { + if (msa.getSequences().length > 1) + { + // Sequence profile based prediction + new jalview.ws.JPredClient(sh, + af.getTitle(), true, msa, af, true); + } + } + } + }); + wsmenu.add(method); + } } diff --git a/src/jalview/ws/MsaWSClient.java b/src/jalview/ws/MsaWSClient.java index 03a801e..63e60d7 100755 --- a/src/jalview/ws/MsaWSClient.java +++ b/src/jalview/ws/MsaWSClient.java @@ -18,6 +18,9 @@ */ package jalview.ws; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + import javax.swing.*; import ext.vamsas.*; @@ -83,6 +86,12 @@ public class MsaWSClient } + public MsaWSClient() + { + super(); + // add a class reference to the list + } + private void startMsaWSClient(String altitle, AlignmentView msa, boolean submitGaps, boolean preserveOrder, Alignment seqdataset) @@ -167,4 +176,55 @@ public class MsaWSClient { return "Multiple Sequence Alignment"; } + /** + * look at ourselves and work out if we are a service that can take a profile and align to it + * @return true if we can send gapped sequences to the alignment service + */ + private boolean canSubmitGaps() + { + // TODO: query service or extract service handle props to check if we can realign + return (WebServiceName.indexOf("lustal") > -1); // cheat! + } + public void attachWSMenuEntry(JMenu msawsmenu, final ServiceHandle serviceHandle, final AlignFrame alignFrame) + { + setWebService(serviceHandle, true); // headless + JMenuItem method = new JMenuItem(WebServiceName); + method.setToolTipText(WsURL); + method.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + new jalview.ws.MsaWSClient(serviceHandle, alignFrame.getTitle(), msa, + false, true, + alignFrame.getViewport().getAlignment().getDataset(), + alignFrame); + + } + + }); + msawsmenu.add(method); + if (canSubmitGaps()) + { + // We know that ClustalWS can accept partial alignments for refinement. + final JMenuItem methodR = new JMenuItem(serviceHandle.getName()+" Realign"); + methodR.setToolTipText(WsURL); + methodR.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + new jalview.ws.MsaWSClient(serviceHandle, alignFrame.getTitle(), msa, + true, true, + alignFrame.getViewport().getAlignment().getDataset(), + alignFrame); + + } + + }); + msawsmenu.add(methodR); + + } + + } } diff --git a/src/jalview/ws/SeqSearchWSClient.java b/src/jalview/ws/SeqSearchWSClient.java new file mode 100644 index 0000000..e52cefd --- /dev/null +++ b/src/jalview/ws/SeqSearchWSClient.java @@ -0,0 +1,294 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +package jalview.ws; + +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.StringTokenizer; +import java.util.Vector; + +import javax.swing.*; + +import ext.vamsas.*; +import jalview.datamodel.*; +import jalview.gui.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class SeqSearchWSClient + extends WSClient +{ + /** + * server is a WSDL2Java generated stub for an archetypal MsaWSI service. + */ + ext.vamsas.SeqSearchI server; + AlignFrame alignFrame; + + /** + * Creates a new MsaWSClient object that uses a service + * given by an externally retrieved ServiceHandle + * + * @param sh service handle of type AbstractName(MsaWS) + * @param altitle DOCUMENT ME! + * @param msa DOCUMENT ME! + * @param submitGaps DOCUMENT ME! + * @param preserveOrder DOCUMENT ME! + */ + + public SeqSearchWSClient(ext.vamsas.ServiceHandle sh, String altitle, + jalview.datamodel.AlignmentView msa, String db, + Alignment seqdataset, + AlignFrame _alignFrame) + { + super(); + alignFrame = _alignFrame; + // can generalise the two errors below for metadata mapping from interface name to service client name + if (!sh.getAbstractName().equals(this.getServiceActionKey())) + { + JOptionPane.showMessageDialog(Desktop.desktop, + "The Service called \n" + sh.getName() + + "\nis not a \nSequence Search Service !", + "Internal Jalview Error", + JOptionPane.WARNING_MESSAGE); + + return; + } + + if ( (wsInfo = setWebService(sh)) == null) + { + JOptionPane.showMessageDialog(Desktop.desktop, + "The Sequence Search Service named " + + sh.getName() + + " is unknown", "Internal Jalview Error", + JOptionPane.WARNING_MESSAGE); + + return; + } + startSeqSearchClient(altitle, msa, db, seqdataset); + + } + /** + * non-process web service interaction - use this for calling HEADLESS synchronous service methods + * @param sh + */ + public SeqSearchWSClient(ServiceHandle sh) + { + setWebService(sh, true); + } + + public SeqSearchWSClient() + { + + super(); + // add a class reference to the list + } + private void startSeqSearchClient(String altitle, AlignmentView msa, + String db, + Alignment seqdataset) + { + if (!locateWebService()) + { + return; + } + String visdb = (db==null || db == "") ? "default" : db; // need a visible name for a sequence db + boolean profileSearch = msa.getSequences().length>2 ? true : false; + // single sequence or profile from alignment view + wsInfo.setProgressText( "Searching "+visdb+(!profileSearch ? " with sequence "+msa.getSequences()[0].getRefSeq().getName() + : " with profile") + + " from " + altitle + "\nJob details\n"); + + String jobtitle = WebServiceName+((WebServiceName.indexOf("earch")>-1) ? " " : " search ")+" of "+visdb+(!profileSearch ? " with sequence "+msa.getSequences()[0].getRefSeq().getName() + : " with profile") + + " from " + altitle; + SeqSearchWSThread ssthread = new SeqSearchWSThread(server, WsURL, wsInfo, alignFrame, + WebServiceName, + jobtitle, + msa, + db, + seqdataset); + wsInfo.setthisService(ssthread); + ssthread.start(); + } + + /** + * Initializes the server field with a valid service implementation. + * + * @return true if service was located. + */ + private boolean locateWebService() + { + // this can be abstracted using reflection + // TODO: MuscleWS transmuted to generic MsaWS client + SeqSearchServiceLocator loc = new SeqSearchServiceLocator(); // Default + + try + { + this.server = (SeqSearchI) loc.getSeqSearchService(new java.net.URL(WsURL)); + ( (SeqSearchServiceSoapBindingStub)this.server).setTimeout(60000); // One minute timeout + } + catch (Exception ex) + { + wsInfo.setProgressText("Serious! " + WebServiceName + + " Service location failed\nfor URL :" + WsURL + + "\n" + + ex.getMessage()); + wsInfo.setStatus(WebserviceInfo.ERROR); + ex.printStackTrace(); + + return false; + } + + loc.getEngine().setOption("axis", "1"); + + return true; + } + + protected String getServiceActionKey() + { + return "SeqSearch"; + } + + protected String getServiceActionDescription() + { + return "Sequence Database Search"; + } + // simple caching of db parameters for each service endpoint + private static Hashtable dbParamsForEndpoint; + static { + dbParamsForEndpoint = new Hashtable(); + } + public String[] getSupportedDatabases() throws Exception + { + + // check that we haven't already been to this service endpoint + if (dbParamsForEndpoint.containsKey(WsURL)) + { + return (String[]) dbParamsForEndpoint.get(WsURL); + } + if (!locateWebService()) + { + throw new Exception("Cannot contact service endpoint at "+WsURL); + } + String database = server.getDatabase(); + if (database==null) + { + dbParamsForEndpoint.put(WsURL, new String[] {}); + return null; + } + StringTokenizer en = new StringTokenizer(database.trim(), ",| "); + String[] dbs = new String[en.countTokens()]; + for (int i=0; i + * Title: + *

+ * + *

+ * Description: + *

+ * + *

+ * Copyright: Copyright (c) 2004 + *

+ * + *

+ * Company: Dundee University + *

+ * + * @author not attributable + * @version 1.0 + */ +class SeqSearchWSThread + extends WSThread implements WSClientI +{ + String dbs=null; + boolean profile=false; + + class SeqSearchWSJob + extends WSThread.WSJob + { + // hold special input for this + vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple. + SequenceSet(); + + /** + * MsaWSJob + * + * @param jobNum + * int + * @param jobId + * String + */ + public SeqSearchWSJob(int jobNum, SequenceI[] inSeqs) + { + this.jobnum = jobNum; + if (!prepareInput(inSeqs, 2)) + { + submitted = true; + subjobComplete = true; + result = new MsaResult(); + result.setFinished(true); + result.setStatus("Job never ran - input returned to user."); + } + + } + + Hashtable SeqNames = new Hashtable(); + Vector emptySeqs = new Vector(); + /** + * prepare input sequences for service + * @param seqs jalview sequences to be prepared + * @param minlen minimum number of residues required for this MsaWS service + * @return true if seqs contains sequences to be submitted to service. + */ + private boolean prepareInput(SequenceI[] seqs, int minlen) + { + int nseqs = 0; + if (minlen < 0) + { + throw new Error("Implementation error: minlen must be zero or more."); + } + for (int i = 0; i < seqs.length; i++) + { + if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) + { + nseqs++; + } + } + boolean valid = nseqs >= 1; // need at least one sequence for valid input TODO: generalise + vamsas.objects.simple.Sequence[] seqarray = + (valid) + ? new vamsas.objects.simple.Sequence[nseqs] + : null; + boolean submitGaps = (nseqs==1) ? false : true; // profile is submitted with gaps + for (int i = 0, n = 0; i < seqs.length; i++) + { + + String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same + // for + // any + // subjob + SeqNames.put(newname, jalview.analysis.SeqsetUtils + .SeqCharacterHash(seqs[i])); + if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) + { + seqarray[n] = new vamsas.objects.simple.Sequence(); + seqarray[n].setId(newname); + seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequenceAsString() + : AlignSeq.extractGaps( + jalview.util.Comparison.GapChars, seqs[i] + .getSequenceAsString())); + } + else + { + String empty = null; + if (seqs[i].getEnd() >= seqs[i].getStart()) + { + empty = (submitGaps) ? seqs[i].getSequenceAsString() + : AlignSeq.extractGaps( + jalview.util.Comparison.GapChars, seqs[i] + .getSequenceAsString()); + } + emptySeqs.add(new String[] + {newname, empty}); + } + } + if (submitGaps) + { + // almost certainly have to remove gapped columns here + } + this.seqs = new vamsas.objects.simple.SequenceSet(); + this.seqs.setSeqs(seqarray); + return valid; + } + + /** + * + * @return true if getAlignment will return a valid alignment result. + */ + public boolean hasResults() + { + if (subjobComplete && result != null && result.isFinished() + && ( (SeqSearchResult) result).getAlignment() != null && + ( (SeqSearchResult) result).getAlignment().getSeqs() != null) + { + return true; + } + return false; + } + + /** + * return sequence search results for display + * @return null or { Alignment(+features and annotation), NewickFile)} + */ + public Object[] getAlignment(Alignment dataset, Hashtable featureColours) + { + + if (result != null && result.isFinished()) + { + SequenceI[] alseqs = null; + //char alseq_gapchar = '-'; + //int alseq_l = 0; + if ( ( (SeqSearchResult) result).getAlignment() != null) + { + alseqs = getVamsasAlignment( ( (SeqSearchResult) result).getAlignment()); + //alseq_gapchar = ( (SeqSearchResult) result).getAlignment().getGapchar().charAt(0); + //alseq_l = alseqs.length; + } + /** + * what has to be done. 1 - annotate returned alignment with annotation file and sequence features file, and associate any tree-nodes. + * 2. connect alignment back to any associated dataset: 2.a. deuniquify recovers sequence information - but additionally, + * relocations must be made from the returned aligned sequence back to the dataset. + */ + // construct annotated alignment as it would be done by the jalview applet + jalview.datamodel.Alignment al = new Alignment(alseqs); + // al.setDataset(dataset); + // make dataset + String inFile=null; + try { + inFile = ((SeqSearchResult) result).getAnnotation(); + if (inFile!=null && inFile.length()>0) + { + new jalview.io.AnnotationFile().readAnnotationFile(al, inFile, jalview.io.AppletFormatAdapter.PASTE); + } + } + catch (Exception e) + { + System.err.println("Failed to parse the annotation file associated with the alignment."); + System.err.println(">>>EOF"+inFile+"\n<<0) + { + jalview.io.FeaturesFile ff = new jalview.io.FeaturesFile(inFile, jalview.io.AppletFormatAdapter.PASTE); + ff.parse(al, featureColours, false); + } + } + catch (Exception e) + { + System.err.println("Failed to parse the Features file associated with the alignment."); + System.err.println(">>>EOF"+inFile+"\n<<0) + { + nf = new jalview.io.NewickFile(inFile, jalview.io.AppletFormatAdapter.PASTE); + if (!nf.isValid()) { + nf.close(); + nf = null; + } + } + } + catch (Exception e) + { + System.err.println("Failed to parse the treeFile associated with the alignment."); + System.err.println(">>>EOF"+inFile+"\n<< 0) + { + wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum); + } + wsinfo.setProgressText(jobs[j].jobnum, OutputHeader); + } + } + } + + public boolean isCancellable() + { + return true; + } + + public void cancelJob() + { + if (!jobComplete && jobs != null) + { + boolean cancelled = true; + for (int job = 0; job < jobs.length; job++) + { + if (jobs[job].submitted && !jobs[job].subjobComplete) + { + String cancelledMessage = ""; + try + { + vamsas.objects.simple.WsJobId cancelledJob = server + .cancel(jobs[job].jobId); + if (cancelledJob.getStatus() == 2) + { + // CANCELLED_JOB + cancelledMessage = "Job cancelled."; + ( (SeqSearchWSJob) jobs[job]).cancel(); + wsInfo.setStatus(jobs[job].jobnum, + WebserviceInfo.STATE_CANCELLED_OK); + } + else if (cancelledJob.getStatus() == 3) + { + // VALID UNSTOPPABLE JOB + cancelledMessage += + "Server cannot cancel this job. just close the window.\n"; + cancelled = false; + // wsInfo.setStatus(jobs[job].jobnum, + // WebserviceInfo.STATE_RUNNING); + } + + if (cancelledJob.getJobId() != null) + { + cancelledMessage += ("[" + cancelledJob.getJobId() + "]"); + } + + cancelledMessage += "\n"; + } + catch (Exception exc) + { + cancelledMessage += + ("\nProblems cancelling the job : Exception received...\n" + + exc + "\n"); + Cache.log.warn("Exception whilst cancelling " + jobs[job].jobId, + exc); + } + wsInfo.setProgressText(jobs[job].jobnum, OutputHeader + + cancelledMessage + "\n"); + } + } + if (cancelled) + { + wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK); + jobComplete = true; + } + this.interrupt(); // kick thread to update job states. + } + else + { + if (!jobComplete) + { + wsInfo + .setProgressText(OutputHeader + + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n"); + } + } + } + + void pollJob(WSJob job) + throws Exception + { + ( (SeqSearchWSJob) job).result = server.getResult( ( (SeqSearchWSJob) job).jobId); + } + + void StartJob(WSJob job) + { + if (! (job instanceof SeqSearchWSJob)) + { + throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " + + job.getClass()); + } + SeqSearchWSJob j = (SeqSearchWSJob) job; + if (j.submitted) + { + if (Cache.log.isDebugEnabled()) + { + Cache.log.debug("Tried to submit an already submitted job " + j.jobId); + } + return; + } + if (j.seqs.getSeqs() == null) + { + // special case - selection consisted entirely of empty sequences... + j.submitted = true; + j.result = new MsaResult(); + j.result.setFinished(true); + j.result.setStatus("Empty Alignment Job"); + ( (MsaResult) j.result).setMsa(null); + } + try + { + vamsas.objects.simple.WsJobId jobsubmit = server.search(j.seqs.getSeqs()[0], dbArg); + + if ( (jobsubmit != null) && (jobsubmit.getStatus() == 1)) + { + j.jobId = jobsubmit.getJobId(); + j.submitted = true; + j.subjobComplete = false; + // System.out.println(WsURL + " Job Id '" + jobId + "'"); + } + else + { + if (jobsubmit == null) + { + throw new Exception( + "Server at " + + WsUrl + + + " returned null object, it probably cannot be contacted. Try again later ?"); + } + + throw new Exception(jobsubmit.getJobId()); + } + } + catch (Exception e) + { + // TODO: JBPNote catch timeout or other fault types explicitly + // For unexpected errors + System.err + .println(WebServiceName + + "Client: Failed to submit the sequences for alignment (probably a server side problem)\n" + + "When contacting Server:" + WsUrl + "\n" + + e.toString() + "\n"); + j.allowedServerExceptions = 0; + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); + wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_SERVERERROR); + wsInfo + .appendProgressText( + j.jobnum, + "Failed to submit sequences for alignment.\n" + + "It is most likely that there is a problem with the server.\n" + + "Just close the window\n"); + + // e.printStackTrace(); // TODO: JBPNote DEBUG + } + } + + private jalview.datamodel.Sequence[] getVamsasAlignment( + vamsas.objects.simple.Alignment valign) + { + vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs(); + jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs. + length]; + + for (int i = 0, j = seqs.length; i < j; i++) + { + msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i] + .getSeq()); + } + + return msa; + } + + void parseResult() + { + int results = 0; // number of result sets received + JobStateSummary finalState = new JobStateSummary(); + try + { + for (int j = 0; j < jobs.length; j++) + { + finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); + if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults()) + { + results++; + vamsas.objects.simple.Alignment valign = ( (SeqSearchResult) jobs[j].result). + getAlignment(); + if (valign != null) + { + wsInfo.appendProgressText(jobs[j].jobnum, + "\nAlignment Object Method Notes\n"); + String[] lines = valign.getMethod(); + for (int line = 0; line < lines.length; line++) + { + wsInfo.appendProgressText(jobs[j].jobnum, lines[line] + "\n"); + } + // JBPNote The returned files from a webservice could be + // hidden behind icons in the monitor window that, + // when clicked, pop up their corresponding data + } + } + } + } + catch (Exception ex) + { + + Cache.log.error("Unexpected exception when processing results for " + + alTitle, ex); + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + } + if (results > 0) + { + wsInfo.showResultsNewFrame + .addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed( + java.awt.event.ActionEvent evt) + { + displayResults(true); + } + }); + wsInfo.mergeResults + .addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed( + java.awt.event.ActionEvent evt) + { + displayResults(false); + } + }); + wsInfo.setResultsReady(); + } + else + { + wsInfo.setFinishedNoResults(); + } + } + + void displayResults(boolean newFrame) + { + if (!newFrame) + { + System.err.println("MERGE WITH OLD FRAME NOT IMPLEMENTED"); + return; + } + // each subjob is an independent alignment for the moment + //Alignment al[] = new Alignment[jobs.length]; + //NewickFile nf[] = new NewickFile[jobs.length]; + for (int j = 0; j < jobs.length; j++) + { + Hashtable featureColours = new Hashtable(); + Alignment al=null; + NewickFile nf = null; + if (jobs[j].hasResults()) + { + Object[] res = ( (SeqSearchWSJob) jobs[j]).getAlignment(dataset, featureColours); + if (res==null) { continue; }; + al = (Alignment) res[0]; + nf = (NewickFile) res[1]; + } + else + { + al = null; + nf = null; + continue; + } + /* + * We can't map new alignment back with insertions from input's hidden regions until dataset mapping is sorted out... + * but basically it goes like this: + 1. Merge each domain hit back onto the visible segments in the same way as a Jnet prediction is mapped back + + Object[] newview = input.getUpdatedView(results, orders, getGapChar()); + // trash references to original result data + for (int j = 0; j < jobs.length; j++) + { + results[j] = null; + orders[j] = null; + } + SequenceI[] alignment = (SequenceI[]) newview[0]; + ColumnSelection columnselection = (ColumnSelection) newview[1]; + Alignment al = new Alignment(alignment); + + if (dataset != null) + { + al.setDataset(dataset); + } + + propagateDatasetMappings(al); + } + */ + + AlignFrame af = new AlignFrame(al,// columnselection, + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + if (nf!=null) + { + af.ShowNewickTree(nf, "Tree from "+this.alTitle); + } + // initialise with same renderer settings as in parent alignframe. + af.getFeatureRenderer().transferSettings( + this.featureSettings); + Desktop.addInternalFrame(af, alTitle, + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + } + } + + public boolean canMergeResults() + { + return false; + } +} diff --git a/src/jalview/ws/WSClient.java b/src/jalview/ws/WSClient.java index 29a8b92..91fd4b0 100755 --- a/src/jalview/ws/WSClient.java +++ b/src/jalview/ws/WSClient.java @@ -18,10 +18,12 @@ */ package jalview.ws; +import javax.swing.JMenu; + import ext.vamsas.*; import jalview.gui.*; -public class WSClient +public abstract class WSClient { /** * WSClient holds the basic attributes that are displayed to the user @@ -73,6 +75,10 @@ public class WSClient { return setWebService(sh, false); } + /** + * original service handle that this client was derived from + */ + ServiceHandle serviceHandle=null; /** * initialise WSClient service information attributes from the service handle * @param sh @@ -102,4 +108,26 @@ public class WSClient } return wsInfo; } + /** + * convenience method to pass the serviceHandle reference that instantiated this + * service on to the menu entry constructor + * @param wsmenu the menu to which any menu entries/sub menus are to be attached + * @param alignFrame the alignFrame instance that provides input data for the service + */ + public void attachWSMenuEntry(JMenu wsmenu, final AlignFrame alignFrame) + { + if (serviceHandle==null) + { + throw new Error("IMPLEMENTATION ERROR: cannot attach WS Menu Entry without service handle reference!"); + } + attachWSMenuEntry(wsmenu, serviceHandle, alignFrame); + } + /** + * method implemented by each WSClient implementation that creates menu entries that enact their service + * using data from alignFrame. + * @param wsmenu where new menu entries (and submenus) are to be attached + * @param serviceHandle the serviceHandle document for the service that entries are created for + * @param alignFrame + */ + public abstract void attachWSMenuEntry(JMenu wsmenu, final ServiceHandle serviceHandle, final AlignFrame alignFrame); } diff --git a/src/jalview/ws/WSClientI.java b/src/jalview/ws/WSClientI.java index 7a2b212..92b7bb3 100755 --- a/src/jalview/ws/WSClientI.java +++ b/src/jalview/ws/WSClientI.java @@ -21,20 +21,24 @@ package jalview.ws; public interface WSClientI { /** - * basic interface supported by web service clients + * basic interface supported by web service clients used by + * jalview.gui.WebserviceInfo to discover GUI properties and + * pass events back to the client. + * */ /** - * - * @return boolean true if job is cancellable + * TODO: change this to be a WS Job Panel GUI 'attribute' + * @return boolean true if a job cancel button should be shown */ boolean isCancellable(); /** + * TODO: change this to be a WS Job Panel GUI 'attribute' * @return boolean true if results can be merged into the source of input data */ boolean canMergeResults(); /** - * instruct client to cancel the job + * instruct client to cancel the job. This is also used by the GUI to */ void cancelJob(); } diff --git a/src/jalview/ws/WSThread.java b/src/jalview/ws/WSThread.java index b81a38f..a9e9b0b 100644 --- a/src/jalview/ws/WSThread.java +++ b/src/jalview/ws/WSThread.java @@ -352,6 +352,7 @@ public abstract class WSThread else { Cache.log.debug("WebServiceJob poll loop finished with no jobs created."); + wsInfo.setFinishedNoResults(); } } diff --git a/src/vamsas/objects/simple/Alignment.java b/src/vamsas/objects/simple/Alignment.java index bd9adfa..18fa20c 100755 --- a/src/vamsas/objects/simple/Alignment.java +++ b/src/vamsas/objects/simple/Alignment.java @@ -1,189 +1,140 @@ -/** - * Alignment.java - * - * This file was auto-generated from WSDL - * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. - */ - -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -package vamsas.objects.simple; - -public class Alignment - extends vamsas.objects.simple.Object implements java.io.Serializable -{ - private java.lang.String gapchar; - private java.lang.String[] method; - private vamsas.objects.simple.SequenceSet seqs; - private java.lang.Object __equalsCalc = null; - private boolean __hashCodeCalc = false; - - public Alignment() - { - } - - public Alignment(java.lang.String gapchar, java.lang.String[] method, - vamsas.objects.simple.SequenceSet seqs) - { - this.gapchar = gapchar; - this.method = method; - this.seqs = seqs; - } - - /** - * Gets the gapchar value for this Alignment. - * - * @return gapchar - */ - public java.lang.String getGapchar() - { - return gapchar; - } - - /** - * Sets the gapchar value for this Alignment. - * - * @param gapchar - */ - public void setGapchar(java.lang.String gapchar) - { - this.gapchar = gapchar; - } - - /** - * Gets the method value for this Alignment. - * - * @return method - */ - public java.lang.String[] getMethod() - { - return method; - } - - /** - * Sets the method value for this Alignment. - * - * @param method - */ - public void setMethod(java.lang.String[] method) - { - this.method = method; - } - - /** - * Gets the seqs value for this Alignment. - * - * @return seqs - */ - public vamsas.objects.simple.SequenceSet getSeqs() - { - return seqs; - } - - /** - * Sets the seqs value for this Alignment. - * - * @param seqs - */ - public void setSeqs(vamsas.objects.simple.SequenceSet seqs) - { - this.seqs = seqs; - } - - public synchronized boolean equals(java.lang.Object obj) - { - if (! (obj instanceof Alignment)) - { - return false; - } - - Alignment other = (Alignment) obj; - - if (obj == null) - { - return false; - } - - if (this == obj) - { - return true; - } - - if (__equalsCalc != null) - { - return (__equalsCalc == obj); - } - - __equalsCalc = obj; - - boolean _equals; - _equals = super.equals(obj) && - ( ( (this.gapchar == null) && (other.getGapchar() == null)) || - ( (this.gapchar != null) && this.gapchar.equals(other.getGapchar()))) && - ( ( (this.method == null) && (other.getMethod() == null)) || - ( (this.method != null) && - java.util.Arrays.equals(this.method, other.getMethod()))) && - ( ( (this.seqs == null) && (other.getSeqs() == null)) || - ( (this.seqs != null) && this.seqs.equals(other.getSeqs()))); - __equalsCalc = null; - - return _equals; - } - - public synchronized int hashCode() - { - if (__hashCodeCalc) - { - return 0; - } - - __hashCodeCalc = true; - - int _hashCode = super.hashCode(); - - if (getGapchar() != null) - { - _hashCode += getGapchar().hashCode(); - } - - if (getMethod() != null) - { - for (int i = 0; i < java.lang.reflect.Array.getLength(getMethod()); - i++) - { - java.lang.Object obj = java.lang.reflect.Array.get(getMethod(), - i); - - if ( (obj != null) && !obj.getClass().isArray()) - { - _hashCode += obj.hashCode(); - } - } - } - - if (getSeqs() != null) - { - _hashCode += getSeqs().hashCode(); - } - - __hashCodeCalc = false; - - return _hashCode; - } -} +/** + * Alignment.java + * + * This file was auto-generated from WSDL + * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter. + */ + +package vamsas.objects.simple; + +public class Alignment extends vamsas.objects.simple.Object implements java.io.Serializable { + private java.lang.String gapchar; + private java.lang.String[] method; + private vamsas.objects.simple.SequenceSet seqs; + + public Alignment() { + } + + public Alignment( + java.lang.String gapchar, + java.lang.String[] method, + vamsas.objects.simple.SequenceSet seqs) { + this.gapchar = gapchar; + this.method = method; + this.seqs = seqs; + } + + + /** + * Gets the gapchar value for this Alignment. + * + * @return gapchar + */ + public java.lang.String getGapchar() { + return gapchar; + } + + + /** + * Sets the gapchar value for this Alignment. + * + * @param gapchar + */ + public void setGapchar(java.lang.String gapchar) { + this.gapchar = gapchar; + } + + + /** + * Gets the method value for this Alignment. + * + * @return method + */ + public java.lang.String[] getMethod() { + return method; + } + + + /** + * Sets the method value for this Alignment. + * + * @param method + */ + public void setMethod(java.lang.String[] method) { + this.method = method; + } + + + /** + * Gets the seqs value for this Alignment. + * + * @return seqs + */ + public vamsas.objects.simple.SequenceSet getSeqs() { + return seqs; + } + + + /** + * Sets the seqs value for this Alignment. + * + * @param seqs + */ + public void setSeqs(vamsas.objects.simple.SequenceSet seqs) { + this.seqs = seqs; + } + + private java.lang.Object __equalsCalc = null; + public synchronized boolean equals(java.lang.Object obj) { + if (!(obj instanceof Alignment)) return false; + Alignment other = (Alignment) obj; + if (obj == null) return false; + if (this == obj) return true; + if (__equalsCalc != null) { + return (__equalsCalc == obj); + } + __equalsCalc = obj; + boolean _equals; + _equals = super.equals(obj) && + ((this.gapchar==null && other.getGapchar()==null) || + (this.gapchar!=null && + this.gapchar.equals(other.getGapchar()))) && + ((this.method==null && other.getMethod()==null) || + (this.method!=null && + java.util.Arrays.equals(this.method, other.getMethod()))) && + ((this.seqs==null && other.getSeqs()==null) || + (this.seqs!=null && + this.seqs.equals(other.getSeqs()))); + __equalsCalc = null; + return _equals; + } + + private boolean __hashCodeCalc = false; + public synchronized int hashCode() { + if (__hashCodeCalc) { + return 0; + } + __hashCodeCalc = true; + int _hashCode = super.hashCode(); + if (getGapchar() != null) { + _hashCode += getGapchar().hashCode(); + } + if (getMethod() != null) { + for (int i=0; + i