correct comment
[jabaws.git] / webservices / compbio / data / msa / MsaWS.java
index 4a22009..f207a30 100644 (file)
@@ -1,6 +1,6 @@
-/* Copyright (c) 2009 Peter Troshin\r
+/* Copyright (c) 2011 Peter Troshin\r
  *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0   \r
+ *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0     \r
  * \r
  *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
  *  Apache License version 2 as published by the Apache Software Foundation\r
@@ -26,17 +26,11 @@ import javax.jws.WebService;
 \r
 import compbio.data.sequence.Alignment;\r
 import compbio.data.sequence.FastaSequence;\r
-import compbio.metadata.ChunkHolder;\r
-import compbio.metadata.JobStatus;\r
 import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.Limit;\r
 import compbio.metadata.LimitExceededException;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.Option;\r
 import compbio.metadata.Preset;\r
-import compbio.metadata.PresetManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
-import compbio.metadata.RunnerConfig;\r
 import compbio.metadata.UnsupportedRuntimeException;\r
 import compbio.metadata.WrongParameterException;\r
 \r
@@ -45,248 +39,160 @@ import compbio.metadata.WrongParameterException;
  * \r
  * @author pvtroshin\r
  * \r
- *         Date September 2009\r
+ *         Date November 2010\r
  * \r
  * @param <T>\r
  *            executable type / web service type\r
  */\r
 @WebService(targetNamespace = "http://msa.data.compbio/01/01/2010/")\r
-public interface MsaWS<T> {\r
-\r
-    /**\r
-     * Align a list of sequences with default settings.\r
-     * \r
-     * Any dataset containing a greater number of sequences or the average\r
-     * length of the sequences are greater then defined in the default Limit\r
-     * will not be accepted for an alignment operation and\r
-     * JobSubmissionException will be thrown.\r
-     * \r
-     * @param sequences\r
-     *            List of FastaSequence objects. The programme does not perform\r
-     *            any sequence validity checks. Nor does it checks whether the\r
-     *            sequences names are unique. It is responsibility of the caller\r
-     *            to validate this information\r
-     * @return jobId - unique identifier for the job\r
-     * @throws JobSubmissionException. This\r
-     *             exception is thrown when the job could not be submitted due\r
-     *             to the following reasons: 1) The number of sequences in the\r
-     *             submission or their average length is greater then defined by\r
-     *             the default Limit. 2) Any problems on the server side e.g. it\r
-     *             is misconfigured or malfunction, is reported via this\r
-     *             exception. In the first case the information on the limit\r
-     *             could be obtained from an exception.\r
-     * @throws InvalidParameterException\r
-     *             thrown if input list of fasta sequence is null or empty\r
-     * @throws UnsupportedRuntimeException\r
-     *             thrown if server OS does not support native executables for a\r
-     *             given web service, e.g. JWS2 is deployed on Windows and Mafft\r
-     *             service is called\r
-     * @throws LimitExceededException\r
-     *             is throw if the input sequences number or average length\r
-     *             exceeds what is defined by the limit\r
-     */\r
-    String align(\r
-           @WebParam(name = "fastaSequences") List<FastaSequence> sequences)\r
-           throws UnsupportedRuntimeException, LimitExceededException,\r
-           JobSubmissionException;\r
-\r
-    /**\r
-     * Align a list of sequences with options.\r
-     * \r
-     * @see Option\r
-     * \r
-     *      Default Limit is used to decide whether the calculation will be\r
-     *      permitted or denied\r
-     * \r
-     * @param sequences\r
-     *            List of FastaSequence objects. The programme does not perform\r
-     *            any sequence validity checks. Nor does it checks whether the\r
-     *            sequences names are unique. It is responsibility of the caller\r
-     *            to validate this information\r
-     * @param options\r
-     *            A list of Options\r
-     * @return jobId - unique identifier for the job\r
-     * @throws JobSubmissionException. This\r
-     *             exception is thrown when the job could not be submitted due\r
-     *             to the following reasons: 1) The number of sequences in the\r
-     *             submission or their average length is greater then defined by\r
-     *             the default Limit. 2) Any problems on the server side e.g. it\r
-     *             is misconfigured or malfunction, is reported via this\r
-     *             exception. In the first case the information on the limit\r
-     *             could be obtained from an exception.\r
-     * @throws WrongParameterException\r
-     *             is throws when 1) One of the Options provided is not\r
-     *             supported, 2) The value of the option is defined outside the\r
-     *             boundaries. In both cases exception object contain the\r
-     *             information on the violating Option.\r
-     * @throws InvalidParameterException\r
-     *             thrown if input list of fasta sequence is null or empty\r
-     * @throws UnsupportedRuntimeException\r
-     *             thrown if server OS does not support native executables for a\r
-     *             given web service, e.g. JWS2 is deployed on Windows and Mafft\r
-     *             service is called\r
-     * @throws LimitExceededException\r
-     *             is throw if the input sequences number or average length\r
-     *             exceeds what is defined by the limit\r
-     */\r
-    String customAlign(\r
-           @WebParam(name = "fastaSequences") List<FastaSequence> sequences,\r
-           @WebParam(name = "options") List<Option<T>> options)\r
-           throws UnsupportedRuntimeException, LimitExceededException,\r
-           JobSubmissionException, WrongParameterException;\r
-\r
-    /**\r
-     * Align a list of sequences with preset. @see Preset\r
-     * \r
-     * Limit for a presetName is used whether the calculation will be permitted\r
-     * or denied. If no Limit was defined for a presetName, than default limit\r
-     * is used.\r
-     * \r
-     * @param sequences\r
-     *            List of FastaSequence objects. The programme does not perform\r
-     *            any sequence validity checks. Nor does it checks whether the\r
-     *            sequences names are unique. It is responsibility of the caller\r
-     *            to validate this information\r
-     * @param preset\r
-     *            A list of Options\r
-     * @return String - jobId - unique identifier for the job\r
-     * @throws JobSubmissionException. This\r
-     *             exception is thrown when the job could not be submitted due\r
-     *             to the following reasons: 1) The number of sequences in the\r
-     *             submission or their average length is greater then defined by\r
-     *             the default Limit. 2) Any problems on the server side e.g. it\r
-     *             is misconfigured or malfunction, is reported via this\r
-     *             exception. In the first case the information on the limit\r
-     *             could be obtained from an exception.\r
-     * @throws WrongParameterException\r
-     *             is throws when 1) One of the Options provided is not\r
-     *             supported, 2) The value of the option is defined outside the\r
-     *             boundaries. In both cases exception object contain the\r
-     *             information on the violating Option.\r
-     * @throws InvalidParameterException\r
-     *             thrown if input list of fasta sequence is null or empty\r
-     * @throws UnsupportedRuntimeException\r
-     *             thrown if server OS does not support native executables for a\r
-     *             given web service, e.g. JWS2 is deployed on Windows and Mafft\r
-     *             service is called\r
-     * @throws LimitExceededException\r
-     *             is throw if the input sequences number or average length\r
-     *             exceeds what is defined by the limit\r
-     */\r
-    String presetAlign(\r
-           @WebParam(name = "fastaSequences") List<FastaSequence> sequences,\r
-           @WebParam(name = "preset") Preset<T> preset)\r
-           throws UnsupportedRuntimeException, LimitExceededException,\r
-           JobSubmissionException, WrongParameterException;\r
-\r
-    /**\r
-     * Return the result of the job.\r
-     * \r
-     * @param jobId\r
-     *            a unique job identifier\r
-     * @return Alignment\r
-     * @throws ResultNotAvailableException\r
-     *             this exception is throw if the job execution was not\r
-     *             successful or the result of the execution could not be found.\r
-     *             (e.g. removed). Exception could also be thrown is dues to the\r
-     *             lower level problems on the server i.e. IOException,\r
-     *             FileNotFoundException problems as well as\r
-     *             UnknownFileFormatException.\r
-     * @throws InvalidParameterException\r
-     *             thrown if jobId is empty or cannot be recognised e.g. in\r
-     *             invalid format\r
-     */\r
-    Alignment getResult(@WebParam(name = "jobId") String jobId)\r
-           throws ResultNotAvailableException;\r
-\r
-    /**\r
-     * Stop running job but leave its output untouched\r
-     * \r
-     * @return true if job was cancelled successfully, false otherwise\r
-     * @throws InvalidParameterException\r
-     *             thrown if jobId is empty or cannot be recognised e.g. in\r
-     *             invalid format\r
-     */\r
-    boolean cancelJob(@WebParam(name = "jobId") String jobId);\r
-\r
-    /**\r
-     * Return the status of the job. @see JobStatus\r
-     * \r
-     * @param jobId\r
-     *            - unique job identifier\r
-     * @return JobStatus - status of the job\r
-     * @throws InvalidParameterException\r
-     *             thrown if jobId is empty or cannot be recognised e.g. in\r
-     *             invalid format\r
-     */\r
-    JobStatus getJobStatus(@WebParam(name = "jobId") String jobId);\r
-\r
-    /**\r
-     * Reads 1kb chunk from the statistics file which is specific to a given web\r
-     * service from the position. If in time of a request less then 1kb data is\r
-     * available from the position to the end of the file, then it returns all\r
-     * the data available from the position to the end of the file.\r
-     * \r
-     * @param jobId\r
-     *            - unique job identifier\r
-     * @param position\r
-     *            - next position within the file to read\r
-     * @return ChunkHolder - @see ChunkHolder which contains a chuink of data\r
-     *         and a next position within the file from which no data has been\r
-     *         read\r
-     * @throws InvalidParameterException\r
-     *             thrown if jobId is empty or cannot be recognised e.g. in\r
-     *             invalid format and also if the position value is negative\r
-     */\r
-    ChunkHolder pullExecStatistics(@WebParam(name = "jobId") String jobId,\r
-           @WebParam(name = "position") long position);\r
-\r
-    /*\r
-     * TODO\r
-     * \r
-     * @param jobId\r
-     * \r
-     * @return\r
-     * \r
-     * byte getProgress(@WebParam(name = "jobId") String jobId);\r
-     */\r
-\r
-    /**\r
-     * Get options supported by a web service\r
-     * \r
-     * @return RunnerConfig the list of options and parameters supported by a\r
-     *         web service.\r
-     */\r
-    RunnerConfig<T> getRunnerOptions();\r
-\r
-    /**\r
-     * Get presets supported by a web service\r
-     * \r
-     * @return PresetManager the object contains information about presets\r
-     *         supported by a web service\r
-     */\r
-    PresetManager<T> getPresets();\r
-\r
-    /**\r
-     * Get a Limit for a preset.\r
-     * \r
-     * @param presetName\r
-     *            the name of the preset. if no name is provided, then the\r
-     *            default preset is returned. If no limit for a particular\r
-     *            preset is defined then the default preset is returned\r
-     * @return Limit\r
-     */\r
-    Limit<T> getLimit(@WebParam(name = "presetName") String presetName);\r
-\r
-    /**\r
-     * List Limits supported by a web service.\r
-     * \r
-     * @param presetName\r
-     *            the name of the preset. if no name is provided, then the\r
-     *            default preset is returned. If no limit for a particular\r
-     *            preset is defined then the default preset is returned\r
-     * @return LimitManager\r
-     */\r
-    LimitsManager<T> getLimits();\r
+public interface MsaWS<T> extends JABAService, JManagement, Metadata<T> {\r
+\r
+       /**\r
+        * Align a list of sequences with default settings.\r
+        * \r
+        * Any dataset containing a greater number of sequences or when the average\r
+        * length of the sequences are greater then defined in the default Limit,\r
+        * will not be accepted for an alignment operation and\r
+        * JobSubmissionException will be thrown.\r
+        * \r
+        * @param sequences\r
+        *            List of FastaSequence objects. The program does not perform\r
+        *            any sequence validity checks. Nor does it checks whether the\r
+        *            sequences names are unique. It is responsibility of the caller\r
+        *            to make sure of this\r
+        * @return jobId - unique identifier for the job\r
+        * @throws JobSubmissionException\r
+        *             is thrown when the job could not be submitted due to the\r
+        *             following reasons: 1) The number of sequences in the\r
+        *             submission or their average length is greater then defined by\r
+        *             the default Limit. 2) Any problems on the server side e.g. it\r
+        *             is misconfigured or malfunction, is reported via this\r
+        *             exception. In the first case the information on the limit\r
+        *             could be obtained from an exception.\r
+        * @throws InvalidParameterException\r
+        *             thrown if input list of FASTA sequences is null or empty\r
+        * @throws UnsupportedRuntimeException\r
+        *             thrown if server OS does not support native executables for a\r
+        *             given web service, e.g. JABAWS is deployed on Windows and\r
+        *             Mafft service is called\r
+        * @throws LimitExceededException\r
+        *             is throw if the input sequences number or their average\r
+        *             length exceeds what is defined by the limit\r
+        */\r
+       String align(\r
+                       @WebParam(name = "fastaSequences") List<FastaSequence> sequences)\r
+                       throws UnsupportedRuntimeException, LimitExceededException,\r
+                       JobSubmissionException;\r
+\r
+       /**\r
+        * Align a list of sequences with options.\r
+        * \r
+        * @see Option\r
+        * \r
+        *      Default Limit is used to decide whether the calculation will be\r
+        *      permitted or denied\r
+        * \r
+        * @param sequences\r
+        *            List of FastaSequence objects. The programme does not perform\r
+        *            any sequence validity checks. Nor does it checks whether the\r
+        *            sequences names are unique. It is responsibility of the caller\r
+        *            to validate this information\r
+        * @param options\r
+        *            A list of Options\r
+        * @return jobId - unique identifier for the job\r
+        * @throws JobSubmissionException\r
+        *             is thrown when the job could not be submitted due to the\r
+        *             following reasons: 1) The number of sequences in the\r
+        *             submission or their average length is greater then defined by\r
+        *             the default Limit. 2) Any problems on the server side e.g. it\r
+        *             is misconfigured or malfunction, is reported via this\r
+        *             exception. In the first case the information on the limit\r
+        *             could be obtained from an exception.\r
+        * @throws WrongParameterException\r
+        *             is throws when 1) One of the Options provided is not\r
+        *             supported, 2) The value of the option is defined outside the\r
+        *             boundaries. In both cases exception object contain the\r
+        *             information on the violating Option.\r
+        * @throws InvalidParameterException\r
+        *             thrown if input list of FASTA sequence is null or empty\r
+        * @throws UnsupportedRuntimeException\r
+        *             thrown if server OS does not support native executables for a\r
+        *             given web service, e.g. JABAWS is deployed on Windows and\r
+        *             Mafft service is called\r
+        * @throws LimitExceededException\r
+        *             is throw if the input sequences number or their average\r
+        *             length exceeds what is defined by the limit\r
+        */\r
+       String customAlign(\r
+                       @WebParam(name = "fastaSequences") List<FastaSequence> sequences,\r
+                       @WebParam(name = "options") List<Option<T>> options)\r
+                       throws UnsupportedRuntimeException, LimitExceededException,\r
+                       JobSubmissionException, WrongParameterException;\r
+\r
+       /**\r
+        * Align a list of sequences with preset.\r
+        * \r
+        * Limit for a presetName is used whether the calculation will be permitted\r
+        * or denied. If no Limit was defined for a presetName, than default limit\r
+        * is used.\r
+        * \r
+        * @param sequences\r
+        *            List of FastaSequence objects. The programme does not perform\r
+        *            any sequence validity checks. Nor does it checks whether the\r
+        *            sequences names are unique. It is responsibility of the caller\r
+        *            to validate this information\r
+        * @param preset\r
+        *            A list of Options\r
+        * @return String - jobId - unique identifier for the job\r
+        * @throws JobSubmissionException\r
+        *             is thrown when the job could not be submitted due to the\r
+        *             following reasons: 1) The number of sequences in the\r
+        *             submission or their average length is greater then defined by\r
+        *             the default Limit. 2) Any problems on the server side e.g. it\r
+        *             is misconfigured or malfunction, is reported via this\r
+        *             exception. In the first case the information on the limit\r
+        *             could be obtained from an exception.\r
+        * @throws WrongParameterException\r
+        *             is throws when 1) One of the Options provided is not\r
+        *             supported, 2) The value of the option is defined outside the\r
+        *             boundaries. In both cases exception object contain the\r
+        *             information on the violating Option.\r
+        * @throws InvalidParameterException\r
+        *             thrown if input list of FASTA sequence is null or empty\r
+        * @throws UnsupportedRuntimeException\r
+        *             thrown if server OS does not support native executables for a\r
+        *             given web service, e.g. JABAWS is deployed on Windows and\r
+        *             Mafft service is called\r
+        * @throws LimitExceededException\r
+        *             is throw if the input sequences number or average length\r
+        *             exceeds what is defined by the limit\r
+        * @see Preset\r
+        */\r
+       String presetAlign(\r
+                       @WebParam(name = "fastaSequences") List<FastaSequence> sequences,\r
+                       @WebParam(name = "preset") Preset<T> preset)\r
+                       throws UnsupportedRuntimeException, LimitExceededException,\r
+                       JobSubmissionException, WrongParameterException;\r
+\r
+       /**\r
+        * Return the result of the job. This method waits for the job\r
+        * <code>jobId</code> to complete before return.\r
+        * \r
+        * @param jobId\r
+        *            a unique job identifier\r
+        * @return Alignment\r
+        * @throws ResultNotAvailableException\r
+        *             this exception is throw if the job execution was not\r
+        *             successful or the result of the execution could not be found.\r
+        *             (e.g. removed). Exception could also be thrown due to the\r
+        *             lower level problems on the server i.e. IOException,\r
+        *             FileNotFoundException problems as well as\r
+        *             UnknownFileFormatException.\r
+        * @throws InvalidParameterException\r
+        *             thrown if jobId is empty or is not recognised e.g. in invalid\r
+        *             format\r
+        */\r
+       Alignment getResult(@WebParam(name = "jobId") String jobId)\r
+                       throws ResultNotAvailableException;\r
 \r
 }\r