From: Sasha Sherstnev Date: Tue, 4 Feb 2014 16:20:29 +0000 (+0000) Subject: Add new method to ProteoCacheWS web service X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3ffab52508e753a5486dc7ec20b3ff5b72b2604e;p=proteocache.git Add new method to ProteoCacheWS web service --- diff --git a/server/compbio/ws/jpred/Jpred.java b/server/compbio/ws/jpred/Jpred.java index 72b1a9e..13b11b3 100644 --- a/server/compbio/ws/jpred/Jpred.java +++ b/server/compbio/ws/jpred/Jpred.java @@ -29,7 +29,7 @@ public interface Jpred { * @return a number of jobs executed for the protein */ @WebMethod - public String findSequence(@WebParam(name = "sequence") String sequence, @WebParam(name = "program") String program, + public int findSequence(@WebParam(name = "sequence") String sequence, @WebParam(name = "program") String program, @WebParam(name = "version") String version); /** @@ -58,4 +58,14 @@ public interface Jpred { */ @WebMethod public String getArchive(@WebParam(name = "job") String jobid); + + /** + * Checks whether a job with a given Job ID is kept in ProteoCache + * + * @param jobid + * the job ID + * @return 1 if the job exists, 0 - otherwise + */ + @WebMethod + public int jobExists(@WebParam(name = "job") String jobid); } diff --git a/server/compbio/ws/jpred/JpredWS.java b/server/compbio/ws/jpred/JpredWS.java index 5249280..3688fb6 100644 --- a/server/compbio/ws/jpred/JpredWS.java +++ b/server/compbio/ws/jpred/JpredWS.java @@ -10,6 +10,7 @@ import org.apache.log4j.Logger; import compbio.beans.ProteinBean; import compbio.cassandra.CassandraNativeConnector; +import compbio.cassandra.readers.JobReader; import compbio.cassandra.readers.SequenceReader; import compbio.engine.archive.ArchivedJob; @@ -48,12 +49,12 @@ public class JpredWS implements Jpred { } @Override - public String findSequence(String sequence, String program, String version) { + public int findSequence(String sequence, String program, String version) { List jobs = findJobs(sequence, program, version); if (null != jobs) { - return jobs.size() + " jobs found"; + return jobs.size(); } - return "no jobs found"; + return 0; } @Override @@ -92,4 +93,15 @@ public class JpredWS implements Jpred { return link; } + @Override + public int jobExists(String jobid) { + CassandraNativeConnector dbconnector = new CassandraNativeConnector(); + JobReader reader = new JobReader(); + reader.setSession(dbconnector.getSession()); + if (null != reader.readJobLog(jobid)) { + return 1; + } + return 0; + } + } diff --git a/server/compbio/ws/jpred/jaxws/FindSequenceResponse.java b/server/compbio/ws/jpred/jaxws/FindSequenceResponse.java index 7889071..a2b881b 100644 --- a/server/compbio/ws/jpred/jaxws/FindSequenceResponse.java +++ b/server/compbio/ws/jpred/jaxws/FindSequenceResponse.java @@ -13,14 +13,14 @@ import javax.xml.bind.annotation.XmlType; public class FindSequenceResponse { @XmlElement(name = "return", namespace = "") - private String _return; + private int _return; /** * * @return - * returns String + * returns int */ - public String getReturn() { + public int getReturn() { return this._return; } @@ -29,7 +29,7 @@ public class FindSequenceResponse { * @param _return * the value for the _return property */ - public void setReturn(String _return) { + public void setReturn(int _return) { this._return = _return; } diff --git a/server/compbio/ws/jpred/jaxws/JobExists.java b/server/compbio/ws/jpred/jaxws/JobExists.java new file mode 100644 index 0000000..00a4a77 --- /dev/null +++ b/server/compbio/ws/jpred/jaxws/JobExists.java @@ -0,0 +1,36 @@ + +package compbio.ws.jpred.jaxws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "jobExists", namespace = "http://server.proteocache.ws") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "jobExists", namespace = "http://server.proteocache.ws") +public class JobExists { + + @XmlElement(name = "job", namespace = "") + private String job; + + /** + * + * @return + * returns String + */ + public String getJob() { + return this.job; + } + + /** + * + * @param job + * the value for the job property + */ + public void setJob(String job) { + this.job = job; + } + +} diff --git a/server/compbio/ws/jpred/jaxws/JobExistsResponse.java b/server/compbio/ws/jpred/jaxws/JobExistsResponse.java new file mode 100644 index 0000000..8ac68b1 --- /dev/null +++ b/server/compbio/ws/jpred/jaxws/JobExistsResponse.java @@ -0,0 +1,36 @@ + +package compbio.ws.jpred.jaxws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "jobExistsResponse", namespace = "http://server.proteocache.ws") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "jobExistsResponse", namespace = "http://server.proteocache.ws") +public class JobExistsResponse { + + @XmlElement(name = "return", namespace = "") + private int _return; + + /** + * + * @return + * returns int + */ + public int getReturn() { + return this._return; + } + + /** + * + * @param _return + * the value for the _return property + */ + public void setReturn(int _return) { + this._return = _return; + } + +} diff --git a/server/compbio/ws/resources/ProteoCacheWS.wsdl b/server/compbio/ws/resources/ProteoCacheWS.wsdl index b96d008..b4fefd8 100644 --- a/server/compbio/ws/resources/ProteoCacheWS.wsdl +++ b/server/compbio/ws/resources/ProteoCacheWS.wsdl @@ -24,6 +24,12 @@ + + + + + + @@ -37,6 +43,10 @@ + + + + @@ -67,6 +77,15 @@ + + + + + + + + + diff --git a/server/compbio/ws/resources/ProteoCacheWS_schema1.xsd b/server/compbio/ws/resources/ProteoCacheWS_schema1.xsd index cf80b4c..514f9bf 100644 --- a/server/compbio/ws/resources/ProteoCacheWS_schema1.xsd +++ b/server/compbio/ws/resources/ProteoCacheWS_schema1.xsd @@ -13,6 +13,10 @@ + + + + @@ -27,6 +31,18 @@ + + + + + + + + + + + + @@ -37,7 +53,7 @@ - +