@WebService(targetNamespace = "http://server.proteocache.ws")
public interface Jpred {
+
@WebMethod
public String findSequence(@WebParam(name = "sequence") String sequence, @WebParam(name = "program") String program,
@WebParam(name = "version") String version);
+
+ @WebMethod
+ public String findJobForSequence(@WebParam(name = "sequence") String sequence, @WebParam(name = "program") String program,
+ @WebParam(name = "version") String version);
+
+ @WebMethod
+ public String getArchive(@WebParam(name = "job") String jobid);
}
package compbio.ws.jpred;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.jws.WebService;
import org.apache.log4j.Logger;
+import compbio.beans.ProteinBean;
import compbio.cassandra.CassandraNativeConnector;
import compbio.cassandra.readers.SequenceReader;
+import compbio.engine.archive.ArchivedJob;
@WebService(endpointInterface = "compbio.ws.jpred.Jpred", targetNamespace = "http://server.proteocache.ws", serviceName = "ProteoCacheWS", portName = "ProteoCacheWSPort")
public class JpredWS implements Jpred {
private static Logger log = Logger.getLogger(CassandraNativeConnector.class);
+ String jobid;
- @Override
- public String findSequence(String sequence, String program, String version) {
+ private List<String> findJobs(String sequence, String program, String version) {
CassandraNativeConnector dbconnector = new CassandraNativeConnector();
SequenceReader reader = new SequenceReader();
reader.setSession(dbconnector.getSession());
- log.debug("ProteoCacheWS is connected:\n search for sequence: " + sequence + "\ncalculated wih " + program + " (version; "
+ log.debug("ProteoCacheWS is connected:\n search for sequence: " + sequence + "\ncalculated with " + program + " (version: "
+ version + ")");
- if (null != reader.readProteins(sequence, "whole")) {
- return "The sequence " + sequence + " found. Calculated with " + program + "(" + version + ")";
+ List<String> jobs = new ArrayList<String>();
+ List<ProteinBean> result = reader.readProteins(sequence, "whole");
+ if (null != result) {
+ for (ProteinBean protein : result) {
+ List<String> thejobs = protein.getJobid();
+ jobid = thejobs.get(0);
+ for (String job : thejobs) {
+ jobs.add(job);
+ }
+ }
+ }
+ return jobs;
+ }
+
+ @Override
+ public String findSequence(String sequence, String program, String version) {
+ List<String> jobs = findJobs(sequence, program, version);
+ if (null != jobs) {
+ return jobs.size() + " jobs found";
+ }
+ return "no jobs found";
+ }
+
+ @Override
+ public String findJobForSequence(String sequence, String program, String version) {
+ List<String> jobs = findJobs(sequence, program, version);
+ if (null != jobs) {
+ for (String job : jobs) {
+ String link = null;
+ ArchivedJob aj = new ArchivedJob(job);
+ try {
+ link = aj.prepareJobArchiveToWeb();
+ } catch (IOException e) {
+ log.error("JpredWS.findSequence: IO exception with job archive file");
+ log.error(e.getLocalizedMessage(), e.getCause());
+ }
+ if (null != link) {
+ return job;
+ }
+ }
+ return "";
+ }
+ return "";
+ }
+
+ @Override
+ public String getArchive(String jobid) {
+ String link = "undefined";
+ ArchivedJob aj = new ArchivedJob(jobid);
+ try {
+ link = aj.prepareJobArchiveToWeb();
+ } catch (IOException e) {
+ log.error("JpredWS.findSequence: IO exception with job archive file");
+ log.error(e.getLocalizedMessage(), e.getCause());
}
- return "The sequence " + sequence + " not found";
+ return link;
}
}
+
package compbio.ws.jpred.jaxws;
import javax.xml.bind.annotation.XmlAccessType;
@XmlRootElement(name = "findSequence", namespace = "http://server.proteocache.ws")
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "findSequence", namespace = "http://server.proteocache.ws", propOrder = { "sequence", "program", "version" })
+@XmlType(name = "findSequence", namespace = "http://server.proteocache.ws", propOrder = {
+ "sequence",
+ "program",
+ "version"
+})
public class FindSequence {
- @XmlElement(name = "sequence", namespace = "")
- private String sequence;
- @XmlElement(name = "program", namespace = "")
- private String program;
- @XmlElement(name = "version", namespace = "")
- private String version;
+ @XmlElement(name = "sequence", namespace = "")
+ private String sequence;
+ @XmlElement(name = "program", namespace = "")
+ private String program;
+ @XmlElement(name = "version", namespace = "")
+ private String version;
- /**
- *
- * @return returns String
- */
- public String getSequence() {
- System.out.println("FindSequence.setSequence: output sequence " + this.sequence);
- return this.sequence;
- }
+ /**
+ *
+ * @return
+ * returns String
+ */
+ public String getSequence() {
+ return this.sequence;
+ }
- /**
- *
- * @param sequence
- * the value for the sequence property
- */
- public void setSequence(String sequence) {
- System.out.println("FindSequence.setSequence: input sequence " + sequence);
- this.sequence = sequence;
- }
+ /**
+ *
+ * @param sequence
+ * the value for the sequence property
+ */
+ public void setSequence(String sequence) {
+ this.sequence = sequence;
+ }
- /**
- *
- * @return returns String
- */
- public String getProgram() {
- System.out.println("FindSequence.setProgram: output program " + this.program);
- return this.program;
- }
+ /**
+ *
+ * @return
+ * returns String
+ */
+ public String getProgram() {
+ return this.program;
+ }
- /**
- *
- * @param program
- * the value for the program property
- */
- public void setProgram(String program) {
- System.out.println("FindSequence.setProgram: input program " + program);
- this.program = program;
- }
+ /**
+ *
+ * @param program
+ * the value for the program property
+ */
+ public void setProgram(String program) {
+ this.program = program;
+ }
- /**
- *
- * @return returns String
- */
- public String getVersion() {
- System.out.println("FindSequence.setVersion: output version " + this.version);
- return this.version;
- }
+ /**
+ *
+ * @return
+ * returns String
+ */
+ public String getVersion() {
+ return this.version;
+ }
- /**
- *
- * @param version
- * the value for the version property
- */
- public void setVersion(String version) {
- System.out.println("FindSequence.setVersion: input version " + version);
- this.version = version;
- }
+ /**
+ *
+ * @param version
+ * the value for the version property
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
}
<xsd:import namespace="http://server.proteocache.ws" schemaLocation="ProteoCacheWS_schema1.xsd"/>
</xsd:schema>
</types>
+ <message name="findJobForSequence">
+ <part name="parameters" element="tns:findJobForSequence"/>
+ </message>
+ <message name="findJobForSequenceResponse">
+ <part name="parameters" element="tns:findJobForSequenceResponse"/>
+ </message>
+ <message name="getArchive">
+ <part name="parameters" element="tns:getArchive"/>
+ </message>
+ <message name="getArchiveResponse">
+ <part name="parameters" element="tns:getArchiveResponse"/>
+ </message>
<message name="findSequence">
<part name="parameters" element="tns:findSequence"/>
</message>
<part name="parameters" element="tns:findSequenceResponse"/>
</message>
<portType name="Jpred">
+ <operation name="findJobForSequence">
+ <input wsam:Action="http://server.proteocache.ws/Jpred/findJobForSequenceRequest" message="tns:findJobForSequence"/>
+ <output wsam:Action="http://server.proteocache.ws/Jpred/findJobForSequenceResponse" message="tns:findJobForSequenceResponse"/>
+ </operation>
+ <operation name="getArchive">
+ <input wsam:Action="http://server.proteocache.ws/Jpred/getArchiveRequest" message="tns:getArchive"/>
+ <output wsam:Action="http://server.proteocache.ws/Jpred/getArchiveResponse" message="tns:getArchiveResponse"/>
+ </operation>
<operation name="findSequence">
<input wsam:Action="http://server.proteocache.ws/Jpred/findSequenceRequest" message="tns:findSequence"/>
<output wsam:Action="http://server.proteocache.ws/Jpred/findSequenceResponse" message="tns:findSequenceResponse"/>
</portType>
<binding name="ProteoCacheWSPortBinding" type="tns:Jpred">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <operation name="findJobForSequence">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ <operation name="getArchive">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
<operation name="findSequence">
<soap:operation soapAction=""/>
<input>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://server.proteocache.ws" xmlns:tns="http://server.proteocache.ws" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="findJobForSequence" type="tns:findJobForSequence"/>
+
+ <xs:element name="findJobForSequenceResponse" type="tns:findJobForSequenceResponse"/>
+
<xs:element name="findSequence" type="tns:findSequence"/>
<xs:element name="findSequenceResponse" type="tns:findSequenceResponse"/>
+ <xs:element name="getArchive" type="tns:getArchive"/>
+
+ <xs:element name="getArchiveResponse" type="tns:getArchiveResponse"/>
+
+ <xs:complexType name="findJobForSequence">
+ <xs:sequence>
+ <xs:element name="sequence" type="xs:string" minOccurs="0"/>
+ <xs:element name="program" type="xs:string" minOccurs="0"/>
+ <xs:element name="version" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="findJobForSequenceResponse">
+ <xs:sequence>
+ <xs:element name="return" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
<xs:complexType name="findSequence">
<xs:sequence>
<xs:element name="sequence" type="xs:string" minOccurs="0"/>
<xs:element name="return" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
+
+ <xs:complexType name="getArchive">
+ <xs:sequence>
+ <xs:element name="job" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="getArchiveResponse">
+ <xs:sequence>
+ <xs:element name="return" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
</xs:schema>