Change the way to deal with Limits to simplify wrapper writing and enable couping...
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Mon, 14 Feb 2011 17:44:51 +0000 (17:44 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Mon, 14 Feb 2011 17:44:51 +0000 (17:44 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@3750 e3abac25-378b-4346-85de-24260fe3988d

26 files changed:
IDEAS.txt
TODO.txt
engine/compbio/engine/client/SkeletalExecutable.java
runner/compbio/runner/Util.java
runner/compbio/runner/conservation/AACon.java
runner/compbio/runner/disorder/Disembl.java
runner/compbio/runner/disorder/GlobPlot.java
runner/compbio/runner/disorder/Jronn.java
runner/compbio/runner/msa/ClustalW.java
runner/compbio/runner/msa/Mafft.java
runner/compbio/runner/msa/Muscle.java
runner/compbio/runner/msa/Probcons.java
runner/compbio/runner/msa/Tcoffee.java
runner/compbio/runner/psiblast/PsiBlast.java
testsrc/compbio/metadata/AllTestSuit.java
webservices/compbio/ws/client/MetadataHelper.java
webservices/compbio/ws/server/AAConWS.java
webservices/compbio/ws/server/ClustalWS.java
webservices/compbio/ws/server/DisemblWS.java
webservices/compbio/ws/server/GlobPlotWS.java
webservices/compbio/ws/server/JronnWS.java
webservices/compbio/ws/server/MafftWS.java
webservices/compbio/ws/server/MuscleWS.java
webservices/compbio/ws/server/ProbconsWS.java
webservices/compbio/ws/server/TcoffeeWS.java
webservices/compbio/ws/server/WSUtil.java

index f9f65fd..bab0292 100644 (file)
--- a/IDEAS.txt
+++ b/IDEAS.txt
@@ -1,5 +1,5 @@
 FUTURE TODO\r
-Registry for jalview WS - gives list of web services providers\r
+\r
 Registry for jalview WS - gives list of web services providers\r
  - checks the status of the web services\r
  - web service providers gives list of available WS\r
@@ -26,7 +26,17 @@ FUTURE TASKS
 Prepare HMM profile for the user alignment and call jnet - instead of jpred. \r
 JPRED REWRITING Wrap Jpred\r
 Wrap scanPS    \r
-Look at SIFTS at EBI \r
+\r
+CBS soft: \r
+Transmembrane regions\r
+Phosphorilation sites\r
+Glycozilation sites\r
+Signal P\r
+\r
+They all have SOAP WS...\r
\r
+CDD domains\r
+PFAM domains\r
  \r
 JPRED IMPROVEMENTS\r
 1) Make sure PSIBLAST does not generate large output (e.g. one approach is to stop on the first iteration\r
index 0acbf85..d7ae747 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -9,9 +9,9 @@ Exception in thread "main" java.lang.NullPointerException
        at compbio.ws.client.Jws2Client.<init>(Jws2Client.java:179)\r
        at compbio.ws.client.Jws2Client.main(Jws2Client.java:483)\r
        \r
-       \r
-Need to pass predicted ranges to the client too - some are not straightforward to devise. \r
-This may require changes to SequenceAnnotation\r
+ScoreManager should output scores properly \r
+\r
+Check the WS input and reject it on submission rather then of access with error message\r
 \r
 Globprot need a proper reference to bio python and sav_gol binaries -> they should be \r
 somehow taken from disembl. \r
index dbdb4f5..b289f6c 100644 (file)
@@ -27,246 +27,251 @@ import org.apache.log4j.Logger;
 \r
 import compbio.engine.client.CommandBuilder.Parameter;\r
 import compbio.engine.conf.PropertyHelperManager;\r
+import compbio.metadata.Limit;\r
+import compbio.metadata.LimitsManager;\r
 import compbio.util.PropertyHelper;\r
 import compbio.util.Util;\r
 \r
 public abstract class SkeletalExecutable<T> implements Executable<T> {\r
 \r
-    protected static final PropertyHelper ph = PropertyHelperManager\r
-           .getPropertyHelper();\r
+       protected static final PropertyHelper ph = PropertyHelperManager\r
+                       .getPropertyHelper();\r
 \r
-    private static Logger log = Logger.getLogger(SkeletalExecutable.class);\r
+       private static Logger log = Logger.getLogger(SkeletalExecutable.class);\r
 \r
-    protected String inputFile = "input.txt";\r
-    protected String outputFile = "output.txt";\r
-    protected String errorFile = "error.txt";\r
+       // Cache for Limits information\r
+       private LimitsManager<T> limits;\r
 \r
-    private boolean isInputSet = false;\r
-    private boolean isOutputSet = false;\r
-    private boolean isErrorSet = false;\r
+       protected String inputFile = "input.txt";\r
+       protected String outputFile = "output.txt";\r
+       protected String errorFile = "error.txt";\r
 \r
-    /**\r
-     * This has to allow duplicate parameters as different options may have the\r
-     * same value e.g. Muscle -weight1 clustalw -weight2 clustalw\r
-     */\r
-    protected CommandBuilder<T> cbuilder;\r
+       private boolean isInputSet = false;\r
+       private boolean isOutputSet = false;\r
+       private boolean isErrorSet = false;\r
 \r
-    public SkeletalExecutable() {\r
-       cbuilder = new CommandBuilder<T>(" ");\r
-    }\r
+       /**\r
+        * This has to allow duplicate parameters as different options may have the\r
+        * same value e.g. Muscle -weight1 clustalw -weight2 clustalw\r
+        */\r
+       protected CommandBuilder<T> cbuilder;\r
+\r
+       public SkeletalExecutable() {\r
+               cbuilder = new CommandBuilder<T>(" ");\r
+       }\r
 \r
-    public SkeletalExecutable(String parameterKeyValueDelimiter) {\r
-       assert parameterKeyValueDelimiter != null;\r
-       cbuilder = new CommandBuilder<T>(parameterKeyValueDelimiter);\r
-    }\r
+       public SkeletalExecutable(String parameterKeyValueDelimiter) {\r
+               assert parameterKeyValueDelimiter != null;\r
+               cbuilder = new CommandBuilder<T>(parameterKeyValueDelimiter);\r
+       }\r
 \r
-    public SkeletalExecutable<T> setInput(String inFile) {\r
-       if (compbio.util.Util.isEmpty(inFile)) {\r
-           throw new IllegalArgumentException("Input file must not be NULL");\r
+       public SkeletalExecutable<T> setInput(String inFile) {\r
+               if (compbio.util.Util.isEmpty(inFile)) {\r
+                       throw new IllegalArgumentException("Input file must not be NULL");\r
+               }\r
+               this.inputFile = inFile;\r
+               this.isInputSet = true;\r
+               return this;\r
        }\r
-       this.inputFile = inFile;\r
-       this.isInputSet = true;\r
-       return this;\r
-    }\r
-\r
-    public SkeletalExecutable<T> setOutput(String outFile) {\r
-       if (compbio.util.Util.isEmpty(outFile)\r
-               || PathValidator.isAbsolutePath(outFile)) {\r
-           throw new IllegalArgumentException(\r
-                   "Output file must not be NULL and Absolute path could not be used! Please provide the filename only. Value provided: "\r
-                           + outFile);\r
+\r
+       public SkeletalExecutable<T> setOutput(String outFile) {\r
+               if (compbio.util.Util.isEmpty(outFile)\r
+                               || PathValidator.isAbsolutePath(outFile)) {\r
+                       throw new IllegalArgumentException(\r
+                                       "Output file must not be NULL and Absolute path could not be used! Please provide the filename only. Value provided: "\r
+                                                       + outFile);\r
+               }\r
+               this.outputFile = outFile;\r
+               this.isOutputSet = true;\r
+               return this;\r
        }\r
-       this.outputFile = outFile;\r
-       this.isOutputSet = true;\r
-       return this;\r
-    }\r
-\r
-    public SkeletalExecutable<T> setError(String errFile) {\r
-       if (compbio.util.Util.isEmpty(errFile)\r
-               || PathValidator.isAbsolutePath(errFile)) {\r
-           throw new IllegalArgumentException(\r
-                   "Error file must not be NULL and Absolute path could not be used! Please provide the filename only. Value provided: "\r
-                           + errFile);\r
+\r
+       public SkeletalExecutable<T> setError(String errFile) {\r
+               if (compbio.util.Util.isEmpty(errFile)\r
+                               || PathValidator.isAbsolutePath(errFile)) {\r
+                       throw new IllegalArgumentException(\r
+                                       "Error file must not be NULL and Absolute path could not be used! Please provide the filename only. Value provided: "\r
+                                                       + errFile);\r
+               }\r
+               this.errorFile = errFile;\r
+               this.isErrorSet = true;\r
+               return this;\r
+       }\r
+\r
+       @Override\r
+       public CommandBuilder<T> getParameters(ExecProvider provider) {\r
+               /*\r
+                * Prevent modification of the parameters unintentionally. This is\r
+                * important to preserve executable parameters intact as engine could\r
+                * add things into the array as it see fit. For instance\r
+                * ExecutableWrapper (part of local engines) add command line as the\r
+                * first element of an array.\r
+                */\r
+               paramValueUpdater();\r
+               return cbuilder;\r
+       }\r
+\r
+       @Override\r
+       public Executable<T> addParameters(List<String> parameters) {\r
+               cbuilder.addParams(parameters);\r
+               return this;\r
+       }\r
+\r
+       public Executable<T> setParameter(String parameter) {\r
+               cbuilder.setParam(parameter);\r
+               return this;\r
        }\r
-       this.errorFile = errFile;\r
-       this.isErrorSet = true;\r
-       return this;\r
-    }\r
-\r
-    @Override\r
-    public CommandBuilder<T> getParameters(ExecProvider provider) {\r
-       /*\r
-        * Prevent modification of the parameters unintentionally. This is\r
-        * important to preserve executable parameters intact as engine could\r
-        * add things into the array as it see fit. For instance\r
-        * ExecutableWrapper (part of local engines) add command line as the\r
-        * first element of an array.\r
+\r
+       /**\r
+        * This is a generic method of changing values of the parameters with\r
+        * properties\r
+        * \r
+        * This method iterates via commands for an executable finding matches from\r
+        * the Executable.properties file and replacing values in CommandBuilder\r
+        * with a combination of value from CommandBuilder to merge path from\r
+        * properties\r
         */\r
-       paramValueUpdater();\r
-       return cbuilder;\r
-    }\r
-\r
-    @Override\r
-    public Executable<T> addParameters(List<String> parameters) {\r
-       cbuilder.addParams(parameters);\r
-       return this;\r
-    }\r
-\r
-    public Executable<T> setParameter(String parameter) {\r
-       cbuilder.setParam(parameter);\r
-       return this;\r
-    }\r
-\r
-    /**\r
-     * This is a generic method of changing values of the parameters with\r
-     * properties\r
-     * \r
-     * This method iterates via commands for an executable finding matches from\r
-     * the Executable.properties file and replacing values in CommandBuilder\r
-     * with a combination of value from CommandBuilder to merge path from\r
-     * properties\r
-     */\r
-    void paramValueUpdater() {\r
-       for (Parameter command : cbuilder.getCommandList()) {\r
-           if (command.value == null) {\r
-               continue;\r
-           }\r
-           String propertyPath = compbio.engine.client.Util.getExecProperty(\r
-                   command.name + ".path", getType());\r
-           if (Util.isEmpty(propertyPath)) {\r
-               continue;\r
-           }\r
-           if (new File(command.value).isAbsolute()) {\r
-               // Matrix can be found so no actions necessary\r
-               // This method has been called already and the matrix name\r
-               // is modified to contain full path // no further actions is\r
-               // necessary\r
-               continue;\r
-           }\r
-           String absMatrixPath = compbio.engine.client.Util\r
-                   .convertToAbsolute(propertyPath);\r
-           command.value = absMatrixPath + File.separator + command.value;\r
-           cbuilder.setParam(command);\r
+       void paramValueUpdater() {\r
+               for (Parameter command : cbuilder.getCommandList()) {\r
+                       if (command.value == null) {\r
+                               continue;\r
+                       }\r
+                       String propertyPath = compbio.engine.client.Util.getExecProperty(\r
+                                       command.name + ".path", getType());\r
+                       if (Util.isEmpty(propertyPath)) {\r
+                               continue;\r
+                       }\r
+                       if (new File(command.value).isAbsolute()) {\r
+                               // Matrix can be found so no actions necessary\r
+                               // This method has been called already and the matrix name\r
+                               // is modified to contain full path // no further actions is\r
+                               // necessary\r
+                               continue;\r
+                       }\r
+                       String absMatrixPath = compbio.engine.client.Util\r
+                                       .convertToAbsolute(propertyPath);\r
+                       command.value = absMatrixPath + File.separator + command.value;\r
+                       cbuilder.setParam(command);\r
+               }\r
        }\r
-    }\r
-\r
-    /**\r
-     * This method cannot really tell whether the files has actually been\r
-     * created or not. It must be overridden as required.\r
-     * \r
-     * @see compbio.engine.client.Executable#getCreatedFiles()\r
-     */\r
-    @Override\r
-    public List<String> getCreatedFiles() {\r
-       return Arrays.asList(getOutput(), getError());\r
-    }\r
-\r
-    @Override\r
-    public String getInput() {\r
-       return inputFile;\r
-    }\r
-\r
-    protected boolean isInputSet() {\r
-       return isInputSet;\r
-    }\r
-\r
-    protected boolean isOutputSet() {\r
-       return isOutputSet;\r
-    }\r
-\r
-    protected boolean isErrorSet() {\r
-       return isErrorSet;\r
-    }\r
-\r
-    @Override\r
-    public String getOutput() {\r
-       return outputFile;\r
-    }\r
-\r
-    @Override\r
-    public String getError() {\r
-       return errorFile;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-       String value = "Input: " + this.getInput() + "\n";\r
-       value += "Output: " + this.getOutput() + "\n";\r
-       value += "Error: " + this.getError() + "\n";\r
-       value += "Class: " + this.getClass() + "\n";\r
-       value += "Params: " + cbuilder + "\n";\r
-       return value;\r
-    }\r
-\r
-    @Override\r
-    public Executable<?> loadRunConfiguration(RunConfiguration rconfig) {\r
-       if (!compbio.util.Util.isEmpty(rconfig.getOutput())) {\r
-           setOutput(rconfig.getOutput());\r
+\r
+       /**\r
+        * This method cannot really tell whether the files has actually been\r
+        * created or not. It must be overridden as required.\r
+        * \r
+        * @see compbio.engine.client.Executable#getCreatedFiles()\r
+        */\r
+       @Override\r
+       public List<String> getCreatedFiles() {\r
+               return Arrays.asList(getOutput(), getError());\r
        }\r
-       if (!compbio.util.Util.isEmpty(rconfig.getError())) {\r
-           setError(rconfig.getError());\r
+\r
+       @Override\r
+       public String getInput() {\r
+               return inputFile;\r
        }\r
-       if (!compbio.util.Util.isEmpty(rconfig.getInput())) {\r
-           setInput(rconfig.getInput());\r
+\r
+       protected boolean isInputSet() {\r
+               return isInputSet;\r
        }\r
-       this.cbuilder = (CommandBuilder<T>) rconfig.getParameters();\r
-       return this;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-       if (obj == null) {\r
-           return false;\r
+\r
+       protected boolean isOutputSet() {\r
+               return isOutputSet;\r
        }\r
-       if (!(obj instanceof SkeletalExecutable<?>)) {\r
-           return false;\r
+\r
+       protected boolean isErrorSet() {\r
+               return isErrorSet;\r
        }\r
-       SkeletalExecutable<?> exec = (SkeletalExecutable<?>) obj;\r
-       if (!Util.isEmpty(this.inputFile) && !Util.isEmpty(exec.inputFile)) {\r
-           if (!this.inputFile.equals(exec.inputFile)) {\r
-               return false;\r
-           }\r
+\r
+       @Override\r
+       public String getOutput() {\r
+               return outputFile;\r
        }\r
-       if (!Util.isEmpty(this.outputFile) && !Util.isEmpty(exec.outputFile)) {\r
-           if (!this.outputFile.equals(exec.outputFile)) {\r
-               return false;\r
-           }\r
+\r
+       @Override\r
+       public String getError() {\r
+               return errorFile;\r
        }\r
-       if (!Util.isEmpty(this.errorFile) && !Util.isEmpty(exec.errorFile)) {\r
-           if (!this.errorFile.equals(exec.errorFile)) {\r
-               return false;\r
-           }\r
+\r
+       @Override\r
+       public String toString() {\r
+               String value = "Input: " + this.getInput() + "\n";\r
+               value += "Output: " + this.getOutput() + "\n";\r
+               value += "Error: " + this.getError() + "\n";\r
+               value += "Class: " + this.getClass() + "\n";\r
+               value += "Params: " + cbuilder + "\n";\r
+               return value;\r
        }\r
-       if (!this.cbuilder.equals(exec.cbuilder)) {\r
-           return false;\r
+\r
+       @Override\r
+       public Executable<?> loadRunConfiguration(RunConfiguration rconfig) {\r
+               if (!compbio.util.Util.isEmpty(rconfig.getOutput())) {\r
+                       setOutput(rconfig.getOutput());\r
+               }\r
+               if (!compbio.util.Util.isEmpty(rconfig.getError())) {\r
+                       setError(rconfig.getError());\r
+               }\r
+               if (!compbio.util.Util.isEmpty(rconfig.getInput())) {\r
+                       setInput(rconfig.getInput());\r
+               }\r
+               this.cbuilder = (CommandBuilder<T>) rconfig.getParameters();\r
+               return this;\r
+       }\r
+\r
+       @Override\r
+       public boolean equals(Object obj) {\r
+               if (obj == null) {\r
+                       return false;\r
+               }\r
+               if (!(obj instanceof SkeletalExecutable<?>)) {\r
+                       return false;\r
+               }\r
+               SkeletalExecutable<?> exec = (SkeletalExecutable<?>) obj;\r
+               if (!Util.isEmpty(this.inputFile) && !Util.isEmpty(exec.inputFile)) {\r
+                       if (!this.inputFile.equals(exec.inputFile)) {\r
+                               return false;\r
+                       }\r
+               }\r
+               if (!Util.isEmpty(this.outputFile) && !Util.isEmpty(exec.outputFile)) {\r
+                       if (!this.outputFile.equals(exec.outputFile)) {\r
+                               return false;\r
+                       }\r
+               }\r
+               if (!Util.isEmpty(this.errorFile) && !Util.isEmpty(exec.errorFile)) {\r
+                       if (!this.errorFile.equals(exec.errorFile)) {\r
+                               return false;\r
+                       }\r
+               }\r
+               if (!this.cbuilder.equals(exec.cbuilder)) {\r
+                       return false;\r
+               }\r
+               return true;\r
+       }\r
+\r
+       @Override\r
+       public int hashCode() {\r
+               int code = inputFile.hashCode();\r
+               code += outputFile.hashCode();\r
+               code += errorFile.hashCode();\r
+               code *= this.cbuilder.hashCode();\r
+               return code;\r
+       }\r
+\r
+       public String getClusterSettings() {\r
+               String settings = ph.getProperty(getType().getSimpleName()\r
+                               .toLowerCase() + ".cluster.settings");\r
+               return settings == null ? "" : settings;\r
        }\r
-       return true;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-       int code = inputFile.hashCode();\r
-       code += outputFile.hashCode();\r
-       code += errorFile.hashCode();\r
-       code *= this.cbuilder.hashCode();\r
-       return code;\r
-    }\r
-\r
-    public String getClusterSettings() {\r
-       String settings = ph.getProperty(getType().getSimpleName()\r
-               .toLowerCase()\r
-               + ".cluster.settings");\r
-       return settings == null ? "" : settings;\r
-    }\r
-\r
-    /**\r
+\r
+       /**\r
         * \r
         * @return number of cpus to use on the cluster or 0 if the value is\r
         *         undefined\r
         */\r
        public static int getClusterCpuNum(Class<? extends Executable<?>> type) {\r
                int cpus = 0;\r
-               String cpuNum = ph.getProperty(type.getSimpleName().toLowerCase()+ ".cluster.cpunum");\r
+               String cpuNum = ph.getProperty(type.getSimpleName().toLowerCase()\r
+                               + ".cluster.cpunum");\r
                if (compbio.util.Util.isEmpty(cpuNum)) {\r
                        return 0;\r
                }\r
@@ -274,20 +279,55 @@ public abstract class SkeletalExecutable<T> implements Executable<T> {
                        cpus = Integer.parseInt(cpuNum);\r
                } catch (NumberFormatException e) {\r
                        // safe to ignore\r
-                       log\r
-                       .debug("Number of cpus to use for cluster execution is defined but could not be parsed as integer! Given value is: "\r
+                       log.debug("Number of cpus to use for cluster execution is defined but could not be parsed as integer! Given value is: "\r
                                        + cpuNum);\r
                        return 0;\r
                }\r
                if (cpus < 1 || cpus > 100) {\r
                        throw new InvalidParameterException(\r
                                        "Number of cpu for cluster execution must be within 1 and 100! "\r
-                                       + "Look at the value of 'tcoffee.cluster.cpunum' property. Given value is "\r
-                                       + cpus);\r
+                                                       + "Look at the value of 'tcoffee.cluster.cpunum' property. Given value is "\r
+                                                       + cpus);\r
                }\r
                return cpus;\r
        }\r
 \r
-    public abstract Class<? extends Executable<?>> getType();\r
+       @Override\r
+       public Limit<T> getLimit(String presetName) {\r
+\r
+               if (limits == null) {\r
+                       limits = getLimits();\r
+               }\r
+\r
+               Limit<T> limit = null;\r
+               if (limits != null) {\r
+                       // this returns default limit if preset is undefined!\r
+                       limit = limits.getLimitByName(presetName);\r
+               }\r
+               // If limit is not defined for a particular preset, then return default\r
+               // limit\r
+               if (limit == null) {\r
+                       log.debug("Limit for the preset " + presetName\r
+                                       + " is not found. Using default");\r
+                       limit = limits.getDefaultLimit();\r
+               }\r
+               return limit;\r
+       }\r
+\r
+       @Override\r
+       public LimitsManager<T> getLimits() {\r
+               synchronized (SkeletalExecutable.class) {\r
+                       if (limits == null) {\r
+                               limits = compbio.runner.Util.getLimits(this.getType());\r
+                       }\r
+               }\r
+               return limits;\r
+       }\r
+\r
+       /**\r
+        * \r
+        * @return subclasses must return their type\r
+        */\r
+       public abstract Class<Executable<T>> getType();\r
 \r
 }\r
index 2f040aa..189ded7 100644 (file)
@@ -67,19 +67,15 @@ public final class Util {
         *         separate options options.add(option); } return options; }\r
         */\r
 \r
-       public static <T> LimitsManager<T> getLimits(\r
-                       Class<? extends Executable<T>> clazz) {\r
-               LimitsManager<T> limits = null;\r
+       public static <T> LimitsManager<T> getLimits(Class<Executable<T>> clazz) {\r
+               LimitsManager<T> limits = new LimitsManager<T>();\r
                try {\r
                        limits = ConfExecutable.getRunnerLimits(clazz);\r
-                       if (limits == null) {\r
-                               return null;\r
-                       }\r
                } catch (FileNotFoundException e) {\r
                        log.warn(\r
                                        "No limits are found for " + clazz + " executable! "\r
                                                        + e.getLocalizedMessage(), e.getCause());\r
-                       return null;\r
+                       // its ok, limit may not be initialized\r
                } catch (IOException e) {\r
                        log.warn("IO exception while attempting to read limits for "\r
                                        + clazz + " executable! " + e.getLocalizedMessage(),\r
index fd76e55..366b95f 100644 (file)
@@ -30,10 +30,7 @@ import compbio.data.sequence.SequenceUtil;
 import compbio.engine.client.CommandBuilder;\r
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
-import compbio.runner.Util;\r
 \r
 /**\r
  * Command line\r
@@ -55,9 +52,6 @@ public class AACon extends SkeletalExecutable<AACon> {
 \r
        private final String ncorePrm = "-t=";\r
 \r
-       // Cache for Limits information\r
-       private static LimitsManager<AACon> limits;\r
-\r
        public static final String KEY_VALUE_SEPARATOR = "=";\r
        public static final String STAT_FILE = "stat.txt";\r
 \r
@@ -128,40 +122,10 @@ public class AACon extends SkeletalExecutable<AACon> {
                return this;\r
        }\r
 \r
+       @SuppressWarnings("unchecked")\r
        @Override\r
-       public Limit<AACon> getLimit(String presetName) {\r
-               if (limits == null) {\r
-                       limits = getLimits();\r
-               }\r
-               Limit<AACon> limit = null;\r
-               if (limits != null) {\r
-                       // this returns default limit if preset is undefined!\r
-                       limit = limits.getLimitByName(presetName);\r
-               }\r
-               // If limit is not defined for a particular preset, then return default\r
-               // limit\r
-               if (limit == null) {\r
-                       log.debug("Limit for the preset " + presetName\r
-                                       + " is not found. Using default");\r
-                       limit = limits.getDefaultLimit();\r
-               }\r
-               return limit;\r
-       }\r
-\r
-       @Override\r
-       public LimitsManager<AACon> getLimits() {\r
-               // synchronise on static field\r
-               synchronized (log) {\r
-                       if (limits == null) {\r
-                               limits = Util.getLimits(this.getClass());\r
-                       }\r
-               }\r
-               return limits;\r
-       }\r
-\r
-       @Override\r
-       public Class<? extends Executable<?>> getType() {\r
-               return this.getClass();\r
+       public Class<Executable<AACon>> getType() {\r
+               return (Class<Executable<AACon>>) this.getClass();\r
        }\r
 \r
        public static String getStatFile() {\r
index 6b014ba..37cb2c1 100644 (file)
@@ -28,8 +28,6 @@ import compbio.data.sequence.UnknownFileFormatException;
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.PipedExecutable;\r
 import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
 import compbio.runner.Util;\r
 \r
@@ -62,9 +60,6 @@ public class Disembl extends SkeletalExecutable<Disembl>
 \r
        private static Logger log = Logger.getLogger(Disembl.class);\r
 \r
-       // Cache for Limits information\r
-       private static LimitsManager<Disembl> limits;\r
-\r
        public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
 \r
        /**\r
@@ -117,41 +112,10 @@ public class Disembl extends SkeletalExecutable<Disembl>
                return this;\r
        }\r
 \r
+       @SuppressWarnings("unchecked")\r
        @Override\r
-       public Limit<Disembl> getLimit(String presetName) {\r
-               if (limits == null) {\r
-                       limits = getLimits();\r
-               }\r
-\r
-               Limit<Disembl> limit = null;\r
-               if (limits != null) {\r
-                       // this returns default limit if preset is undefined!\r
-                       limit = limits.getLimitByName(presetName);\r
-               }\r
-               // If limit is not defined for a particular preset, then return default\r
-               // limit\r
-               if (limit == null) {\r
-                       log.debug("Limit for the preset " + presetName\r
-                                       + " is not found. Using default");\r
-                       limit = limits.getDefaultLimit();\r
-               }\r
-               return limit;\r
-       }\r
-\r
-       @Override\r
-       public LimitsManager<Disembl> getLimits() {\r
-               // synchronise on static field\r
-               synchronized (log) {\r
-                       if (limits == null) {\r
-                               limits = Util.getLimits(this.getClass());\r
-                       }\r
-               }\r
-               return limits;\r
-       }\r
-\r
-       @Override\r
-       public Class<? extends Executable<?>> getType() {\r
-               return this.getClass();\r
+       public Class<Executable<Disembl>> getType() {\r
+               return (Class<Executable<Disembl>>) this.getClass();\r
        }\r
 \r
 }\r
index ce08077..a5b887a 100644 (file)
@@ -28,8 +28,6 @@ import compbio.data.sequence.UnknownFileFormatException;
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.PipedExecutable;\r
 import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
 import compbio.runner.Util;\r
 \r
@@ -55,9 +53,6 @@ public class GlobPlot extends SkeletalExecutable<GlobPlot>
 \r
        private static Logger log = Logger.getLogger(GlobPlot.class);\r
 \r
-       // Cache for Limits information\r
-       private static LimitsManager<GlobPlot> limits;\r
-\r
        public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
 \r
        /* The parameter list there must not contain same values! */\r
@@ -103,41 +98,10 @@ public class GlobPlot extends SkeletalExecutable<GlobPlot>
                return this;\r
        }\r
 \r
+       @SuppressWarnings("unchecked")\r
        @Override\r
-       public Limit<GlobPlot> getLimit(String presetName) {\r
-               if (limits == null) {\r
-                       limits = getLimits();\r
-               }\r
-\r
-               Limit<GlobPlot> limit = null;\r
-               if (limits != null) {\r
-                       // this returns default limit if preset is undefined!\r
-                       limit = limits.getLimitByName(presetName);\r
-               }\r
-               // If limit is not defined for a particular preset, then return default\r
-               // limit\r
-               if (limit == null) {\r
-                       log.debug("Limit for the preset " + presetName\r
-                                       + " is not found. Using default");\r
-                       limit = limits.getDefaultLimit();\r
-               }\r
-               return limit;\r
-       }\r
-\r
-       @Override\r
-       public LimitsManager<GlobPlot> getLimits() {\r
-               // synchronise on static field\r
-               synchronized (log) {\r
-                       if (limits == null) {\r
-                               limits = Util.getLimits(this.getClass());\r
-                       }\r
-               }\r
-               return limits;\r
-       }\r
-\r
-       @Override\r
-       public Class<? extends Executable<?>> getType() {\r
-               return this.getClass();\r
+       public Class<Executable<GlobPlot>> getType() {\r
+               return (Class<Executable<GlobPlot>>) this.getClass();\r
        }\r
 \r
 }\r
index 617d3bb..3f668e3 100644 (file)
@@ -34,8 +34,6 @@ import compbio.data.sequence.UnknownFileFormatException;
 import compbio.engine.client.CommandBuilder;\r
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
 import compbio.runner.Util;\r
 \r
@@ -59,9 +57,6 @@ public class Jronn extends SkeletalExecutable<Jronn> {
 \r
        private final String ncorePrm = "-n=";\r
 \r
-       // Cache for Limits information\r
-       private static LimitsManager<Jronn> limits;\r
-\r
        public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
        public static final String STAT_FILE = "stat.txt";\r
 \r
@@ -132,40 +127,10 @@ public class Jronn extends SkeletalExecutable<Jronn> {
                return this;\r
        }\r
 \r
+       @SuppressWarnings("unchecked")\r
        @Override\r
-       public Limit<Jronn> getLimit(String presetName) {\r
-               if (limits == null) {\r
-                       limits = getLimits();\r
-               }\r
-               Limit<Jronn> limit = null;\r
-               if (limits != null) {\r
-                       // this returns default limit if preset is undefined!\r
-                       limit = limits.getLimitByName(presetName);\r
-               }\r
-               // If limit is not defined for a particular preset, then return default\r
-               // limit\r
-               if (limit == null) {\r
-                       log.debug("Limit for the preset " + presetName\r
-                                       + " is not found. Using default");\r
-                       limit = limits.getDefaultLimit();\r
-               }\r
-               return limit;\r
-       }\r
-\r
-       @Override\r
-       public LimitsManager<Jronn> getLimits() {\r
-               // synchronise on static field\r
-               synchronized (log) {\r
-                       if (limits == null) {\r
-                               limits = Util.getLimits(this.getClass());\r
-                       }\r
-               }\r
-               return limits;\r
-       }\r
-\r
-       @Override\r
-       public Class<? extends Executable<?>> getType() {\r
-               return this.getClass();\r
+       public Class<Executable<Jronn>> getType() {\r
+               return (Class<Executable<Jronn>>) this.getClass();\r
        }\r
 \r
        public static String getStatFile() {\r
index 7aff01c..88f6358 100644 (file)
@@ -29,130 +29,93 @@ import compbio.data.sequence.Alignment;
 import compbio.data.sequence.UnknownFileFormatException;\r
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
 import compbio.runner.Util;\r
 \r
 public class ClustalW extends SkeletalExecutable<ClustalW> {\r
 \r
-    private static Logger log = Logger.getLogger(ClustalW.class);\r
-    private static final String EXEC_STAT_FILE = "stat.log";\r
-    private static final String TREE_FILE_EXT = ".dnd";\r
-\r
-    public static final String KEY_VALUE_SEPARATOR = "=";\r
-\r
-    // Cache for Limits information\r
-    private static LimitsManager<ClustalW> limits;\r
-\r
-    public ClustalW() {\r
-       super(KEY_VALUE_SEPARATOR);\r
-       addParameters(Arrays.asList("-OUTORDER=ALIGNED", "-QUIET", "-STATS="\r
-               + EXEC_STAT_FILE));\r
-       // set default in, outs and err files\r
-       this.setInput(super.inputFile);\r
-       this.setOutput(super.outputFile);\r
-       this.setError(super.errorFile);\r
-    }\r
-\r
-    @Override\r
-    public ClustalW setOutput(String outFile) {\r
-       super.setOutput(outFile);\r
-       cbuilder.setParam("-OUTFILE=" + outFile);\r
-       return this;\r
-    }\r
-\r
-    @Override\r
-    public ClustalW setInput(String inFile) {\r
-       super.setInput(inFile);\r
-       cbuilder.setParam("-INFILE=" + inFile);\r
-       return this;\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    public Alignment getResults(String workDirectory)\r
-           throws ResultNotAvailableException {\r
-       try {\r
-           return Util.readClustalFile(workDirectory, getOutput());\r
-       } catch (FileNotFoundException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (IOException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (UnknownFileFormatException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (NullPointerException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       }\r
-    }\r
-\r
-    @Override\r
-    public List<String> getCreatedFiles() {\r
-       return Arrays.asList(getOutput(), EXEC_STAT_FILE,\r
-               convertInputNameToTreeName());\r
-    }\r
-\r
-    /*\r
-     * Clustal output tree with same name as input file but .dnd extension e.g.\r
-     * this methods do similar conversion TO122.fasta -> TO122.dnd or\r
-     * TO122.fasta.in -> TO122.fasta.dnd It does not seems that there is any\r
-     * limits on the name length\r
-     * \r
-     * @return\r
-     */\r
-    private String convertInputNameToTreeName() {\r
-       assert super.getInput() != null;\r
-       int dotIdx = getInput().lastIndexOf(".");\r
-       String treeFileName = "";\r
-       if (dotIdx > 0) {\r
-           treeFileName = getInput().substring(0, dotIdx);\r
+       private static Logger log = Logger.getLogger(ClustalW.class);\r
+       private static final String EXEC_STAT_FILE = "stat.log";\r
+       private static final String TREE_FILE_EXT = ".dnd";\r
+\r
+       public static final String KEY_VALUE_SEPARATOR = "=";\r
+\r
+       public ClustalW() {\r
+               super(KEY_VALUE_SEPARATOR);\r
+               addParameters(Arrays.asList("-OUTORDER=ALIGNED", "-QUIET", "-STATS="\r
+                               + EXEC_STAT_FILE));\r
+               // set default in, outs and err files\r
+               this.setInput(super.inputFile);\r
+               this.setOutput(super.outputFile);\r
+               this.setError(super.errorFile);\r
        }\r
-       return treeFileName + TREE_FILE_EXT;\r
-    }\r
 \r
-    public static String getStatFile() {\r
-       return EXEC_STAT_FILE;\r
-    }\r
+       @Override\r
+       public ClustalW setOutput(String outFile) {\r
+               super.setOutput(outFile);\r
+               cbuilder.setParam("-OUTFILE=" + outFile);\r
+               return this;\r
+       }\r
 \r
-    @Override\r
-    public Limit<ClustalW> getLimit(String presetName) {\r
+       @Override\r
+       public ClustalW setInput(String inFile) {\r
+               super.setInput(inFile);\r
+               cbuilder.setParam("-INFILE=" + inFile);\r
+               return this;\r
+       }\r
 \r
-       if (limits == null) {\r
-           limits = getLimits();\r
+       @SuppressWarnings("unchecked")\r
+       public Alignment getResults(String workDirectory)\r
+                       throws ResultNotAvailableException {\r
+               try {\r
+                       return Util.readClustalFile(workDirectory, getOutput());\r
+               } catch (FileNotFoundException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (IOException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (UnknownFileFormatException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (NullPointerException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               }\r
        }\r
 \r
-       Limit<ClustalW> limit = null;\r
-       if (limits != null) {\r
-           // this returns default limit if preset is undefined!\r
-           limit = limits.getLimitByName(presetName);\r
+       @Override\r
+       public List<String> getCreatedFiles() {\r
+               return Arrays.asList(getOutput(), EXEC_STAT_FILE,\r
+                               convertInputNameToTreeName());\r
        }\r
-       // If limit is not defined for a particular preset, then return default\r
-       // limit\r
-       if (limit == null) {\r
-           log.debug("Limit for the preset " + presetName\r
-                   + " is not found. Using default");\r
-           limit = limits.getDefaultLimit();\r
+\r
+       /*\r
+        * Clustal output tree with same name as input file but .dnd extension e.g.\r
+        * this methods do similar conversion TO122.fasta -> TO122.dnd or\r
+        * TO122.fasta.in -> TO122.fasta.dnd It does not seems that there is any\r
+        * limits on the name length\r
+        * \r
+        * @return\r
+        */\r
+       private String convertInputNameToTreeName() {\r
+               assert super.getInput() != null;\r
+               int dotIdx = getInput().lastIndexOf(".");\r
+               String treeFileName = "";\r
+               if (dotIdx > 0) {\r
+                       treeFileName = getInput().substring(0, dotIdx);\r
+               }\r
+               return treeFileName + TREE_FILE_EXT;\r
        }\r
-       return limit;\r
-    }\r
-\r
-    @Override\r
-    public LimitsManager<ClustalW> getLimits() {\r
-       // synchronise on static field\r
-       synchronized (log) {\r
-           if (limits == null) {\r
-               limits = Util.getLimits(this.getClass());\r
-           }\r
+\r
+       public static String getStatFile() {\r
+               return EXEC_STAT_FILE;\r
        }\r
-       return limits;\r
-    }\r
 \r
-    @Override\r
-    public Class<? extends Executable<?>> getType() {\r
-       return this.getClass();\r
-    }\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Class<Executable<ClustalW>> getType() {\r
+               return (Class<Executable<ClustalW>>) this.getClass();\r
+       }\r
 \r
 }\r
index 2e8a9fc..ee0e5cb 100644 (file)
@@ -30,125 +30,90 @@ import compbio.data.sequence.UnknownFileFormatException;
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.PipedExecutable;\r
 import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
 import compbio.runner.Util;\r
 \r
-public class Mafft extends SkeletalExecutable<Mafft> implements\r
-       PipedExecutable<Mafft> {\r
+public class Mafft extends SkeletalExecutable<Mafft>\r
+               implements\r
+                       PipedExecutable<Mafft> {\r
 \r
-    private static Logger log = Logger.getLogger(Mafft.class);\r
+       private static Logger log = Logger.getLogger(Mafft.class);\r
 \r
-    // Cache for Limits information\r
-    private static LimitsManager<Mafft> limits;\r
+       private static String autoOption = "--auto";\r
 \r
-    private static String autoOption = "--auto";\r
+       private final String MATRIX_PAR_NAME = "--aamatrix";\r
 \r
-    private final String MATRIX_PAR_NAME = "--aamatrix";\r
+       public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
 \r
-    public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
-\r
-    public Mafft() {\r
-       // remove default input to prevent it to appear in the parameters list\r
-       // that could happen if the parameters are set first\r
-       // super.setInput("");\r
-       addParameters(Arrays.asList("--clustalout", autoOption));\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    public Alignment getResults(String workDirectory)\r
-           throws ResultNotAvailableException {\r
-       try {\r
-           return Util.readClustalFile(workDirectory, getOutput());\r
-       } catch (FileNotFoundException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (IOException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (UnknownFileFormatException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (NullPointerException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
+       public Mafft() {\r
+               // remove default input to prevent it to appear in the parameters list\r
+               // that could happen if the parameters are set first\r
+               // super.setInput("");\r
+               addParameters(Arrays.asList("--clustalout", autoOption));\r
        }\r
-    }\r
-\r
-    @Override\r
-    public Mafft setInput(String inFile) {\r
-       super.setInput(inFile);\r
-       cbuilder.setLast(inFile);\r
-       return this;\r
-    }\r
 \r
-    /**\r
-     * Mafft input must always be the last parameter!\r
-     */\r
-    @Override\r
-    public Mafft addParameters(List<String> parameters) {\r
-       cbuilder.addParams(parameters);\r
-       cbuilder.removeParam(autoOption);\r
-       return this;\r
-    }\r
-\r
-    @Override\r
-    public Limit<Mafft> getLimit(String presetName) {\r
-       if (limits == null) {\r
-           limits = getLimits();\r
+       @SuppressWarnings("unchecked")\r
+       public Alignment getResults(String workDirectory)\r
+                       throws ResultNotAvailableException {\r
+               try {\r
+                       return Util.readClustalFile(workDirectory, getOutput());\r
+               } catch (FileNotFoundException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (IOException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (UnknownFileFormatException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (NullPointerException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               }\r
        }\r
 \r
-       Limit<Mafft> limit = null;\r
-       if (limits != null) {\r
-           // this returns default limit if preset is undefined!\r
-           limit = limits.getLimitByName(presetName);\r
-       }\r
-       // If limit is not defined for a particular preset, then return default\r
-       // limit\r
-       if (limit == null) {\r
-           log.debug("Limit for the preset " + presetName\r
-                   + " is not found. Using default");\r
-           limit = limits.getDefaultLimit();\r
+       @Override\r
+       public Mafft setInput(String inFile) {\r
+               super.setInput(inFile);\r
+               cbuilder.setLast(inFile);\r
+               return this;\r
        }\r
-       return limit;\r
-    }\r
 \r
-    @Override\r
-    public LimitsManager<Mafft> getLimits() {\r
-       // synchronise on static field\r
-       synchronized (log) {\r
-           if (limits == null) {\r
-               limits = Util.getLimits(this.getClass());\r
-           }\r
+       /**\r
+        * Mafft input must always be the last parameter!\r
+        */\r
+       @Override\r
+       public Mafft addParameters(List<String> parameters) {\r
+               cbuilder.addParams(parameters);\r
+               cbuilder.removeParam(autoOption);\r
+               return this;\r
        }\r
-       return limits;\r
-    }\r
 \r
-    @Override\r
-    public Class<? extends Executable<?>> getType() {\r
-       return this.getClass();\r
-    }\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Class<Executable<Mafft>> getType() {\r
+               return (Class<Executable<Mafft>>) this.getClass();\r
+       }\r
 \r
-    /*\r
-     * @Override public List<String> getParameters(\r
-     * compbio.runner.Executable.ExecProvider provider) { for (int i = 0; i <\r
-     * param.size(); i++) { String par = param.get(i); if\r
-     * (isMatrixParameter(par)) { String matrixName = getValue(i); if (new\r
-     * File(matrixName).isAbsolute()) { // Matrix can be found so no actions\r
-     * necessary // This method has been called already and the matrix name //\r
-     * is modified to contain full path // no further actions is necessary\r
-     * break; } String matrixPath = Util.getExecProperty("matrix.path", this);\r
-     * String absMatrixPath = Util.convertToAbsolute(matrixPath); param.remove(i\r
-     * + 1); param.remove(i); super.addParameter(MATRIX_PAR_NAME);\r
-     * super.addParameter(absMatrixPath + File.separator + matrixName); break; }\r
-     * } return super.getParameters(provider); }\r
-     * \r
-     * boolean isMatrixParameter(String parameter) { assert\r
-     * !compbio.util.Util.isEmpty(parameter); if\r
-     * (parameter.toUpperCase().startsWith(MATRIX_PAR_NAME)) { return true; }\r
-     * return false; }\r
-     * \r
-     * String getValue(int i) { return param.get(i + 1); }\r
-     */\r
+       /*\r
+        * @Override public List<String> getParameters(\r
+        * compbio.runner.Executable.ExecProvider provider) { for (int i = 0; i <\r
+        * param.size(); i++) { String par = param.get(i); if\r
+        * (isMatrixParameter(par)) { String matrixName = getValue(i); if (new\r
+        * File(matrixName).isAbsolute()) { // Matrix can be found so no actions\r
+        * necessary // This method has been called already and the matrix name //\r
+        * is modified to contain full path // no further actions is necessary\r
+        * break; } String matrixPath = Util.getExecProperty("matrix.path", this);\r
+        * String absMatrixPath = Util.convertToAbsolute(matrixPath); param.remove(i\r
+        * + 1); param.remove(i); super.addParameter(MATRIX_PAR_NAME);\r
+        * super.addParameter(absMatrixPath + File.separator + matrixName); break; }\r
+        * } return super.getParameters(provider); }\r
+        * \r
+        * boolean isMatrixParameter(String parameter) { assert\r
+        * !compbio.util.Util.isEmpty(parameter); if\r
+        * (parameter.toUpperCase().startsWith(MATRIX_PAR_NAME)) { return true; }\r
+        * return false; }\r
+        * \r
+        * String getValue(int i) { return param.get(i + 1); }\r
+        */\r
 }\r
index d220d16..c37b73a 100644 (file)
@@ -31,125 +31,88 @@ import compbio.data.sequence.Alignment;
 import compbio.data.sequence.UnknownFileFormatException;\r
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
 import compbio.runner.Util;\r
 \r
 public class Muscle extends SkeletalExecutable<Muscle> {\r
 \r
-    /*\r
-     * Tell JAXB to ignore this while marshalling\r
-     */\r
-    @XmlTransient\r
-    private static Logger log = Logger.getLogger(Muscle.class);\r
-\r
-    // Cache for Limits information\r
-    private static LimitsManager<Muscle> limits;\r
+       /*\r
+        * Tell JAXB to ignore this while marshalling\r
+        */\r
+       @XmlTransient\r
+       private static Logger log = Logger.getLogger(Muscle.class);\r
 \r
-    private static final String EXEC_STAT_FILE = "stat.log";\r
+       private static final String EXEC_STAT_FILE = "stat.log";\r
 \r
-    public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
+       public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
 \r
-    /**\r
-     * Default options are\r
-     * \r
-     * -clwstrict - write output in clustal format\r
-     * \r
-     * @param workDirectory\r
-     */\r
-    public Muscle() {\r
-       /*\r
-        * The â€“quiet command-line option disables writing progress messages to\r
-        * standard error. If the â€“verbose command-line option is specified, a\r
-        * progress message will be written to the log file when each iteration\r
-        * completes. So â€“quiet and â€“verbose are not contradictory."-quiet",\r
-        * "-verbose"\r
+       /**\r
+        * Default options are\r
+        * \r
+        * -clwstrict - write output in clustal format\r
+        * \r
+        * @param workDirectory\r
         */\r
-       addParameters(Arrays.asList("-clwstrict", "-quiet", "-verbose"));\r
-       cbuilder.setParam("-log", EXEC_STAT_FILE);\r
-    }\r
-\r
-    @Override\r
-    public Muscle setOutput(String outFile) {\r
-       super.setOutput(outFile);\r
-       cbuilder.setParam("-out", outFile);\r
-       return this;\r
-    }\r
-\r
-    @Override\r
-    public Muscle setInput(String inFile) {\r
-       super.setInput(inFile);\r
-       cbuilder.setParam("-in", inFile);\r
-       return this;\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Override\r
-    public Alignment getResults(String workDirectory)\r
-           throws ResultNotAvailableException {\r
-       try {\r
-           return Util.readClustalFile(workDirectory, getOutput());\r
-       } catch (FileNotFoundException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (IOException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (UnknownFileFormatException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (NullPointerException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
+       public Muscle() {\r
+               /*\r
+                * The â€“quiet command-line option disables writing progress messages to\r
+                * standard error. If the â€“verbose command-line option is specified, a\r
+                * progress message will be written to the log file when each iteration\r
+                * completes. So â€“quiet and â€“verbose are not contradictory."-quiet",\r
+                * "-verbose"\r
+                */\r
+               addParameters(Arrays.asList("-clwstrict", "-quiet", "-verbose"));\r
+               cbuilder.setParam("-log", EXEC_STAT_FILE);\r
        }\r
-    }\r
-\r
-    @Override\r
-    public List<String> getCreatedFiles() {\r
-       return Arrays.asList(getOutput(), EXEC_STAT_FILE);\r
-    }\r
 \r
-    public static String getStatFile() {\r
-       return EXEC_STAT_FILE;\r
-    }\r
-\r
-    @Override\r
-    public Limit<Muscle> getLimit(String presetName) {\r
+       @Override\r
+       public Muscle setOutput(String outFile) {\r
+               super.setOutput(outFile);\r
+               cbuilder.setParam("-out", outFile);\r
+               return this;\r
+       }\r
 \r
-       if (limits == null) {\r
-           limits = getLimits();\r
+       @Override\r
+       public Muscle setInput(String inFile) {\r
+               super.setInput(inFile);\r
+               cbuilder.setParam("-in", inFile);\r
+               return this;\r
        }\r
 \r
-       Limit<Muscle> limit = null;\r
-       if (limits != null) {\r
-           // this returns default limit if preset is undefined!\r
-           limit = limits.getLimitByName(presetName);\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Alignment getResults(String workDirectory)\r
+                       throws ResultNotAvailableException {\r
+               try {\r
+                       return Util.readClustalFile(workDirectory, getOutput());\r
+               } catch (FileNotFoundException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (IOException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (UnknownFileFormatException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (NullPointerException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               }\r
        }\r
-       // If limit is not defined for a particular preset, then return default\r
-       // limit\r
-       if (limit == null) {\r
-           log.debug("Limit for the preset " + presetName\r
-                   + " is not found. Using default");\r
-           limit = limits.getDefaultLimit();\r
+\r
+       @Override\r
+       public List<String> getCreatedFiles() {\r
+               return Arrays.asList(getOutput(), EXEC_STAT_FILE);\r
        }\r
-       return limit;\r
-    }\r
-\r
-    @Override\r
-    public LimitsManager<Muscle> getLimits() {\r
-       // synchronise on static field\r
-       synchronized (log) {\r
-           if (limits == null) {\r
-               limits = Util.getLimits(this.getClass());\r
-           }\r
+\r
+       public static String getStatFile() {\r
+               return EXEC_STAT_FILE;\r
        }\r
-       return limits;\r
-    }\r
 \r
-    @Override\r
-    public Class<? extends Executable<?>> getType() {\r
-       return this.getClass();\r
-    }\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Class<Executable<Muscle>> getType() {\r
+               return (Class<Executable<Muscle>>) this.getClass();\r
+       }\r
 \r
 }\r
index ea9fa1d..2df7f92 100644 (file)
@@ -30,102 +30,69 @@ import compbio.data.sequence.UnknownFileFormatException;
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.PipedExecutable;\r
 import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
 import compbio.runner.Util;\r
 \r
-public class Probcons extends SkeletalExecutable<Probcons> implements\r
-       PipedExecutable<Probcons> {\r
+public class Probcons extends SkeletalExecutable<Probcons>\r
+               implements\r
+                       PipedExecutable<Probcons> {\r
 \r
-    private static Logger log = Logger.getLogger(Probcons.class);\r
+       private static Logger log = Logger.getLogger(Probcons.class);\r
 \r
-    // Cache for Limits information\r
-    private static LimitsManager<Probcons> limits;\r
-    private final static String ANNOTATION = "annotation.txt";\r
+       private final static String ANNOTATION = "annotation.txt";\r
 \r
-    public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
+       public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
 \r
-    /**\r
-     * \r
-     * @param workDirectory\r
-     */\r
-    public Probcons() {\r
-       addParameters(Arrays.asList("-v", "-clustalw", "-annot", ANNOTATION));\r
-       /*\r
-        * Could either have probabilities or the alignment, but not both "-t",\r
-        * "probabilities"\r
+       /**\r
+        * \r
+        * @param workDirectory\r
         */\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Override\r
-    public Alignment getResults(String workDirectory)\r
-           throws ResultNotAvailableException {\r
-       try {\r
-           return Util.readClustalFile(workDirectory, getOutput());\r
-       } catch (FileNotFoundException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (IOException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (UnknownFileFormatException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (NullPointerException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
+       public Probcons() {\r
+               addParameters(Arrays.asList("-v", "-clustalw", "-annot", ANNOTATION));\r
+               /*\r
+                * Could either have probabilities or the alignment, but not both "-t",\r
+                * "probabilities"\r
+                */\r
        }\r
-    }\r
-\r
-    @Override\r
-    public List<String> getCreatedFiles() {\r
-       return Arrays.asList(getOutput(), ANNOTATION, getError());\r
-    }\r
-\r
-    @Override\r
-    public Probcons setInput(String inFile) {\r
-       String input = getInput();\r
-       super.setInput(inFile);\r
-       // TODO replace with setLast\r
-       cbuilder.setParam(inFile);\r
-       return this;\r
-    }\r
 \r
-    @Override\r
-    public Limit<Probcons> getLimit(String presetName) {\r
-       if (limits == null) {\r
-           limits = getLimits();\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Alignment getResults(String workDirectory)\r
+                       throws ResultNotAvailableException {\r
+               try {\r
+                       return Util.readClustalFile(workDirectory, getOutput());\r
+               } catch (FileNotFoundException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (IOException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (UnknownFileFormatException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (NullPointerException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               }\r
        }\r
-       Limit<Probcons> limit = null;\r
-       if (limits != null) {\r
-           // this returns default limit if preset is undefined!\r
-           limit = limits.getLimitByName(presetName);\r
-       }\r
-       // If limit is not defined for a particular preset, then return default\r
-       // limit\r
-       if (limit == null) {\r
-           log.debug("Limit for the preset " + presetName\r
-                   + " is not found. Using default");\r
-           limit = limits.getDefaultLimit();\r
+\r
+       @Override\r
+       public List<String> getCreatedFiles() {\r
+               return Arrays.asList(getOutput(), ANNOTATION, getError());\r
        }\r
-       return limit;\r
-    }\r
 \r
-    @Override\r
-    public LimitsManager<Probcons> getLimits() {\r
-       // synchronise on static field\r
-       synchronized (log) {\r
-           if (limits == null) {\r
-               limits = Util.getLimits(this.getClass());\r
-           }\r
+       @Override\r
+       public Probcons setInput(String inFile) {\r
+               String input = getInput();\r
+               super.setInput(inFile);\r
+               // TODO replace with setLast\r
+               cbuilder.setParam(inFile);\r
+               return this;\r
        }\r
-       return limits;\r
-    }\r
 \r
-    @Override\r
-    public Class<? extends Executable<?>> getType() {\r
-       return this.getClass();\r
-    }\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Class<Executable<Probcons>> getType() {\r
+               return (Class<Executable<Probcons>>) this.getClass();\r
+       }\r
 }\r
index 949c4f1..3b35875 100644 (file)
@@ -20,7 +20,6 @@ package compbio.runner.msa;
 \r
 import java.io.FileNotFoundException;\r
 import java.io.IOException;\r
-import java.security.InvalidParameterException;\r
 import java.util.Arrays;\r
 import java.util.List;\r
 \r
@@ -34,22 +33,19 @@ import compbio.engine.client.Executable;
 import compbio.engine.client.PipedExecutable;\r
 import compbio.engine.client.SkeletalExecutable;\r
 import compbio.engine.conf.PropertyHelperManager;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
 import compbio.runner.Util;\r
 import compbio.util.PropertyHelper;\r
 \r
-public class Tcoffee extends SkeletalExecutable<Tcoffee> implements\r
-PipedExecutable<Tcoffee>, ClusterNativeSpecExecutable<Tcoffee> {\r
+public class Tcoffee extends SkeletalExecutable<Tcoffee>\r
+               implements\r
+                       PipedExecutable<Tcoffee>,\r
+                       ClusterNativeSpecExecutable<Tcoffee> {\r
 \r
        private static Logger log = Logger.getLogger(Tcoffee.class);\r
 \r
        private static PropertyHelper ph = PropertyHelperManager\r
-       .getPropertyHelper();\r
-\r
-       // Cache for Limits information\r
-       private static LimitsManager<Tcoffee> limits;\r
+                       .getPropertyHelper();\r
 \r
        public static final String KEY_VALUE_SEPARATOR = "=";\r
 \r
@@ -88,7 +84,7 @@ PipedExecutable<Tcoffee>, ClusterNativeSpecExecutable<Tcoffee> {
        @SuppressWarnings("unchecked")\r
        @Override\r
        public Alignment getResults(String workDirectory)\r
-       throws ResultNotAvailableException {\r
+                       throws ResultNotAvailableException {\r
                try {\r
                        return Util.readClustalFile(workDirectory, getOutput());\r
                } catch (FileNotFoundException e) {\r
@@ -141,45 +137,13 @@ PipedExecutable<Tcoffee>, ClusterNativeSpecExecutable<Tcoffee> {
        }\r
 \r
        @Override\r
-       public Limit<Tcoffee> getLimit(String presetName) {\r
-               if (limits == null) {\r
-                       limits = getLimits();\r
-               }\r
-\r
-               Limit<Tcoffee> limit = null;\r
-               if (limits != null) {\r
-                       // this returns default limit if preset is undefined!\r
-                       limit = limits.getLimitByName(presetName);\r
-               }\r
-               // If limit is not defined for a particular preset, then return default\r
-               // limit\r
-               if (limit == null) {\r
-                       log.debug("Limit for the preset " + presetName\r
-                                       + " is not found. Using default");\r
-                       limit = limits.getDefaultLimit();\r
-               }\r
-               return limit;\r
-       }\r
-\r
-       @Override\r
-       public LimitsManager<Tcoffee> getLimits() {\r
-               // synchronise on static field\r
-               synchronized (log) {\r
-                       if (limits == null) {\r
-                               limits = Util.getLimits(this.getClass());\r
-                       }\r
-               }\r
-               return limits;\r
-       }\r
-\r
-       @Override\r
        public String getNativeSpecs() {\r
                return getClusterSettings();\r
        }\r
 \r
-\r
+       @SuppressWarnings("unchecked")\r
        @Override\r
-       public Class<? extends Executable<?>> getType() {\r
-               return this.getClass();\r
+       public Class<Executable<Tcoffee>> getType() {\r
+               return (Class<Executable<Tcoffee>>) this.getClass();\r
        }\r
 }\r
index 8299d6d..c51df24 100644 (file)
@@ -20,42 +20,29 @@ package compbio.runner.psiblast;
 \r
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
 \r
 public class PsiBlast extends SkeletalExecutable<PsiBlast> {\r
 \r
-    public PsiBlast() {\r
+       public PsiBlast() {\r
 \r
-    }\r
+       }\r
 \r
-    void getSupportedDatabases() {\r
+       void getSupportedDatabases() {\r
 \r
-    }\r
+       }\r
 \r
-    @Override\r
-    public <V> V getResults(String directory)\r
-           throws ResultNotAvailableException {\r
-       // TODO Auto-generated method stub\r
-       return null;\r
-    }\r
+       @Override\r
+       public <V> V getResults(String directory)\r
+                       throws ResultNotAvailableException {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
 \r
-    @Override\r
-    public Limit<PsiBlast> getLimit(String presetName) {\r
-       // TODO Auto-generated method stub\r
-       return null;\r
-    }\r
-\r
-    @Override\r
-    public LimitsManager<PsiBlast> getLimits() {\r
-       // TODO Auto-generated method stub\r
-       return null;\r
-    }\r
-\r
-    @Override\r
-    public Class<? extends Executable<?>> getType() {\r
-       return this.getClass();\r
-    }\r
+       @Override\r
+       public Class<Executable<PsiBlast>> getType() {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
 \r
 }\r
index 633e30b..794565a 100644 (file)
@@ -33,21 +33,21 @@ public class AllTestSuit {
        public static final RunnerConfig<ClustalW> CLUSTAL_PARAMETERS = Util\r
                        .getSupportedOptions(ClustalW.class);\r
        public static final LimitsManager<ClustalW> CLUSTAL_LIMITS = Util\r
-                       .getLimits(ClustalW.class);\r
+                       .getLimits(new ClustalW().getType());\r
 \r
        public static final PresetManager<Tcoffee> TCOFFEE_PRESETS = Util\r
                        .getPresets(Tcoffee.class);\r
        public static final RunnerConfig<Tcoffee> TCOFFEE_PARAMETERS = Util\r
                        .getSupportedOptions(Tcoffee.class);\r
        public static final LimitsManager<Tcoffee> TCOFFEE_LIMITS = Util\r
-                       .getLimits(Tcoffee.class);\r
+                       .getLimits(new Tcoffee().getType());\r
 \r
        public static final PresetManager<Muscle> MUSCLE_PRESETS = Util\r
                        .getPresets(Muscle.class);\r
        public static final RunnerConfig<Muscle> MUSCLE_PARAMETERS = Util\r
                        .getSupportedOptions(Muscle.class);\r
        public static final LimitsManager<Muscle> MUSCLE_LIMITS = Util\r
-                       .getLimits(Muscle.class);\r
+                       .getLimits(new Muscle().getType());\r
 \r
        public final static String test_group_cluster = "cluster";\r
        public final static String test_group_runner = "runner";\r
index d69c3c1..f0539dc 100644 (file)
@@ -3,6 +3,7 @@ package compbio.ws.client;
 import static compbio.ws.client.Constraints.pseparator;\r
 \r
 import java.util.ArrayList;\r
+import java.util.Collections;\r
 import java.util.List;\r
 \r
 import compbio.data.msa.Metadata;\r
@@ -27,7 +28,11 @@ public class MetadataHelper {
         */\r
        static <T> List<Option<T>> getParametersList(Metadata<T> msaws) {\r
                assert msaws != null;\r
-               return msaws.getRunnerOptions().getArguments();\r
+               RunnerConfig<T> config = msaws.getRunnerOptions();\r
+               if (config == null) {\r
+                       return Collections.emptyList();\r
+               }\r
+               return config.getArguments();\r
        }\r
 \r
        /**\r
index 095bc4e..ac7435d 100644 (file)
@@ -51,6 +51,9 @@ public class AAConWS implements SequenceAnnotation<AACon> {
        private static final PresetManager<AACon> aaconPresets = Util\r
                        .getPresets(AACon.class);\r
 \r
+       private static final LimitsManager<AACon> limitMan = compbio.runner.Util\r
+                       .getLimits(new AACon().getType());\r
+\r
        ConfiguredExecutable<AACon> init(List<FastaSequence> sequences)\r
                        throws JobSubmissionException {\r
                AACon aacon = new AACon();\r
@@ -81,12 +84,12 @@ public class AAConWS implements SequenceAnnotation<AACon> {
 \r
        @Override\r
        public Limit<AACon> getLimit(String presetName) {\r
-               return new AACon().getLimit(presetName);\r
+               return limitMan.getLimitByName(presetName);\r
        }\r
 \r
        @Override\r
        public LimitsManager<AACon> getLimits() {\r
-               return new AACon().getLimits();\r
+               return limitMan;\r
        }\r
 \r
        @Override\r
index 4b38157..f13136a 100644 (file)
@@ -52,152 +52,152 @@ import compbio.ws.client.Services;
 @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "ClustalWS")\r
 public class ClustalWS implements MsaWS<ClustalW> {\r
 \r
-    // Ask for resource injection\r
-    @Resource\r
-    private WebServiceContext wsContext;\r
+       // Ask for resource injection\r
+       @Resource\r
+       private WebServiceContext wsContext;\r
 \r
-    private static Logger log = Logger.getLogger(ClustalWS.class);\r
+       private static Logger log = Logger.getLogger(ClustalWS.class);\r
 \r
-    private static volatile WSLogger logger;\r
+       private static volatile WSLogger logger;\r
 \r
-    private static final RunnerConfig<ClustalW> clustalOptions = Util\r
-           .getSupportedOptions(ClustalW.class);\r
+       private static final RunnerConfig<ClustalW> clustalOptions = Util\r
+                       .getSupportedOptions(ClustalW.class);\r
 \r
-    private static final PresetManager<ClustalW> clustalPresets = Util\r
-           .getPresets(ClustalW.class);\r
+       private static final PresetManager<ClustalW> clustalPresets = Util\r
+                       .getPresets(ClustalW.class);\r
 \r
-    /*\r
-     * Initialise the logger. This cannot be done in the constructor as the\r
-     * WebServiceContext is not available at the object construction time\r
-     */\r
-    private WSLogger getLogger() {\r
-       if (logger == null) {\r
-           synchronized (ClustalWS.class) {\r
+       private static final LimitsManager<ClustalW> limitMan = compbio.runner.Util\r
+                       .getLimits(new ClustalW().getType());\r
+\r
+       /*\r
+        * Initialise the logger. This cannot be done in the constructor as the\r
+        * WebServiceContext is not available at the object construction time\r
+        */\r
+       private WSLogger getLogger() {\r
                if (logger == null) {\r
-                   logger = WSLogger.getStatLogger(Services.ClustalWS,\r
-                           wsContext);\r
+                       synchronized (ClustalWS.class) {\r
+                               if (logger == null) {\r
+                                       logger = WSLogger.getStatLogger(Services.ClustalWS,\r
+                                                       wsContext);\r
+                               }\r
+                       }\r
                }\r
-           }\r
+               return logger;\r
+       }\r
+\r
+       @Override\r
+       public String align(List<FastaSequence> sequences)\r
+                       throws JobSubmissionException {\r
+\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
+               return WSUtil.align(sequences, confClust, getLogger(), "align",\r
+                               getLimit(""));\r
+       }\r
+\r
+       ConfiguredExecutable<ClustalW> init(List<FastaSequence> dataSet)\r
+                       throws JobSubmissionException {\r
+               ClustalW clustal = new ClustalW();\r
+               ConfiguredExecutable<ClustalW> confClust = Configurator\r
+                               .configureExecutable(clustal, dataSet);\r
+               return confClust;\r
+       }\r
+\r
+       @Override\r
+       public String presetAlign(List<FastaSequence> sequences,\r
+                       Preset<ClustalW> preset) throws JobSubmissionException,\r
+                       WrongParameterException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               if (preset == null) {\r
+                       throw new WrongParameterException("Preset must be provided!");\r
+               }\r
+               Limit<ClustalW> limit = getLimit(preset.getName());\r
+               ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
+               confClust.addParameters(preset.getOptions());\r
+               return WSUtil.align(sequences, confClust, getLogger(), "presetAlign",\r
+                               limit);\r
+       }\r
+\r
+       @Override\r
+       public String customAlign(List<FastaSequence> sequences,\r
+                       List<Option<ClustalW>> options) throws JobSubmissionException,\r
+                       WrongParameterException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
+               List<String> params = WSUtil.getCommands(options,\r
+                               ClustalW.KEY_VALUE_SEPARATOR);\r
+               confClust.addParameters(params);\r
+               log.info("Setting parameters: " + params);\r
+               return WSUtil.align(sequences, confClust, getLogger(), "customAlign",\r
+                               getLimit(""));\r
+       }\r
+\r
+       @Override\r
+       public RunnerConfig<ClustalW> getRunnerOptions() {\r
+               Timer timer = Timer.getMilliSecondsTimer();\r
+               getLogger().logAll(timer, "getRunnerOptions");\r
+               return clustalOptions;\r
        }\r
-       return logger;\r
-    }\r
-\r
-    @Override\r
-    public String align(List<FastaSequence> sequences)\r
-           throws JobSubmissionException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
-       return WSUtil.align(sequences, confClust, getLogger(), "align",\r
-               getLimit(""));\r
-    }\r
-\r
-    ConfiguredExecutable<ClustalW> init(List<FastaSequence> dataSet)\r
-           throws JobSubmissionException {\r
-       ClustalW clustal = new ClustalW();\r
-       ConfiguredExecutable<ClustalW> confClust = Configurator\r
-               .configureExecutable(clustal, dataSet);\r
-       return confClust;\r
-    }\r
-\r
-    @Override\r
-    public String presetAlign(List<FastaSequence> sequences,\r
-           Preset<ClustalW> preset) throws JobSubmissionException,\r
-           WrongParameterException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       if (preset == null) {\r
-           throw new WrongParameterException("Preset must be provided!");\r
+\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+               Timer timer = Timer.getMilliSecondsTimer();\r
+               WSUtil.validateJobId(jobId);\r
+               AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+               ConfiguredExecutable<ClustalW> clustal = (ConfiguredExecutable<ClustalW>) asyncEngine\r
+                               .getResults(jobId);\r
+               Alignment al = clustal.getResults();\r
+               getLogger().log(timer, "getResults", jobId);\r
+               return al;\r
+       }\r
+\r
+       @Override\r
+       public Limit<ClustalW> getLimit(String presetName) {\r
+               Timer timer = Timer.getMilliSecondsTimer();\r
+               Limit<ClustalW> limit = limitMan.getLimitByName(presetName);\r
+               getLogger().logAll(timer, "getLimit");\r
+               return limit;\r
+       }\r
+       @Override\r
+       public LimitsManager<ClustalW> getLimits() {\r
+               return limitMan;\r
+       }\r
+\r
+       @Override\r
+       public boolean cancelJob(String jobId) {\r
+               Timer timer = Timer.getMilliSecondsTimer();\r
+               WSUtil.validateJobId(jobId);\r
+               boolean result = WSUtil.cancelJob(jobId);\r
+               getLogger().logFine(timer, "Cancel");\r
+               return result;\r
+       }\r
+\r
+       @Override\r
+       public JobStatus getJobStatus(String jobId) {\r
+               Timer timer = Timer.getMilliSecondsTimer();\r
+               WSUtil.validateJobId(jobId);\r
+               JobStatus status = WSUtil.getJobStatus(jobId);\r
+               getLogger().logFine(timer, "getJobStatus");\r
+               return status;\r
+       }\r
+\r
+       @Override\r
+       public PresetManager<ClustalW> getPresets() {\r
+               Timer timer = Timer.getMilliSecondsTimer();\r
+               getLogger().logAll(timer, "pullExecStatistics");\r
+               return clustalPresets;\r
+       }\r
+\r
+       @Override\r
+       public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+               Timer timer = Timer.getMilliSecondsTimer();\r
+               WSUtil.validateJobId(jobId);\r
+               String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+                               + ClustalW.getStatFile();\r
+               ChunkHolder cholder = WSUtil.pullFile(file, position);\r
+               getLogger().logFine(timer, "pullExecStatistics");\r
+               return cholder;\r
        }\r
-       Limit<ClustalW> limit = getLimit(preset.getName());\r
-       ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
-       confClust.addParameters(preset.getOptions());\r
-       return WSUtil.align(sequences, confClust, getLogger(), "presetAlign",\r
-               limit);\r
-    }\r
-\r
-    @Override\r
-    public String customAlign(List<FastaSequence> sequences,\r
-           List<Option<ClustalW>> options) throws JobSubmissionException,\r
-           WrongParameterException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
-       List<String> params = WSUtil.getCommands(options,\r
-               ClustalW.KEY_VALUE_SEPARATOR);\r
-       confClust.addParameters(params);\r
-       log.info("Setting parameters: " + params);\r
-       return WSUtil.align(sequences, confClust, getLogger(), "customAlign",\r
-               getLimit(""));\r
-    }\r
-\r
-    @Override\r
-    public RunnerConfig<ClustalW> getRunnerOptions() {\r
-       Timer timer = Timer.getMilliSecondsTimer();\r
-       getLogger().logAll(timer, "getRunnerOptions");\r
-       return clustalOptions;\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Override\r
-    public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
-       Timer timer = Timer.getMilliSecondsTimer();\r
-       WSUtil.validateJobId(jobId);\r
-       AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
-       ConfiguredExecutable<ClustalW> clustal = (ConfiguredExecutable<ClustalW>) asyncEngine\r
-               .getResults(jobId);\r
-       Alignment al = clustal.getResults();\r
-       getLogger().log(timer, "getResults", jobId);\r
-       return al;\r
-    }\r
-\r
-    @Override\r
-    public Limit<ClustalW> getLimit(String presetName) {\r
-       Timer timer = Timer.getMilliSecondsTimer();\r
-       Limit<ClustalW> limit = new ClustalW().getLimit(presetName);\r
-       getLogger().logAll(timer, "getLimit");\r
-       return limit;\r
-    }\r
-\r
-    @Override\r
-    public LimitsManager<ClustalW> getLimits() {\r
-       Timer timer = Timer.getMilliSecondsTimer();\r
-       LimitsManager<ClustalW> limits = new ClustalW().getLimits();\r
-       getLogger().logAll(timer, "getLimits");\r
-       return limits;\r
-    }\r
-\r
-    @Override\r
-    public boolean cancelJob(String jobId) {\r
-       Timer timer = Timer.getMilliSecondsTimer();\r
-       WSUtil.validateJobId(jobId);\r
-       boolean result = WSUtil.cancelJob(jobId);\r
-       getLogger().logFine(timer, "Cancel");\r
-       return result;\r
-    }\r
-\r
-    @Override\r
-    public JobStatus getJobStatus(String jobId) {\r
-       Timer timer = Timer.getMilliSecondsTimer();\r
-       WSUtil.validateJobId(jobId);\r
-       JobStatus status = WSUtil.getJobStatus(jobId);\r
-       getLogger().logFine(timer, "getJobStatus");\r
-       return status;\r
-    }\r
-\r
-    @Override\r
-    public PresetManager<ClustalW> getPresets() {\r
-       Timer timer = Timer.getMilliSecondsTimer();\r
-       getLogger().logAll(timer, "pullExecStatistics");\r
-       return clustalPresets;\r
-    }\r
-\r
-    @Override\r
-    public ChunkHolder pullExecStatistics(String jobId, long position) {\r
-       Timer timer = Timer.getMilliSecondsTimer();\r
-       WSUtil.validateJobId(jobId);\r
-       String file = Configurator.getWorkDirectory(jobId) + File.separator\r
-               + ClustalW.getStatFile();\r
-       ChunkHolder cholder = WSUtil.pullFile(file, position);\r
-       getLogger().logFine(timer, "pullExecStatistics");\r
-       return cholder;\r
-    }\r
 \r
 }\r
index 2eac30d..7970579 100644 (file)
@@ -47,6 +47,9 @@ public class DisemblWS implements SequenceAnnotation<Disembl> {
        private static final PresetManager<Disembl> disemblPresets = Util\r
                        .getPresets(Disembl.class);\r
 \r
+       private static final LimitsManager<Disembl> limitMan = compbio.runner.Util\r
+                       .getLimits(new Disembl().getType());\r
+\r
        ConfiguredExecutable<Disembl> init(List<FastaSequence> sequences)\r
                        throws JobSubmissionException {\r
                Disembl disembl = new Disembl();\r
@@ -68,12 +71,12 @@ public class DisemblWS implements SequenceAnnotation<Disembl> {
 \r
        @Override\r
        public Limit<Disembl> getLimit(String presetName) {\r
-               return new Disembl().getLimit(presetName);\r
+               return limitMan.getLimitByName(presetName);\r
        }\r
 \r
        @Override\r
        public LimitsManager<Disembl> getLimits() {\r
-               return new Disembl().getLimits();\r
+               return limitMan;\r
        }\r
 \r
        @Override\r
index cf266b0..a77dfa2 100644 (file)
@@ -47,6 +47,9 @@ public class GlobPlotWS implements SequenceAnnotation<GlobPlot> {
        private static final PresetManager<GlobPlot> globPlotPresets = Util\r
                        .getPresets(GlobPlot.class);\r
 \r
+       private static final LimitsManager<GlobPlot> limitMan = compbio.runner.Util\r
+                       .getLimits(new GlobPlot().getType());\r
+\r
        ConfiguredExecutable<GlobPlot> init(List<FastaSequence> sequences)\r
                        throws JobSubmissionException {\r
                GlobPlot globPlot = new GlobPlot();\r
@@ -68,12 +71,12 @@ public class GlobPlotWS implements SequenceAnnotation<GlobPlot> {
 \r
        @Override\r
        public Limit<GlobPlot> getLimit(String presetName) {\r
-               return new GlobPlot().getLimit(presetName);\r
+               return limitMan.getLimitByName(presetName);\r
        }\r
 \r
        @Override\r
        public LimitsManager<GlobPlot> getLimits() {\r
-               return new GlobPlot().getLimits();\r
+               return limitMan;\r
        }\r
 \r
        @Override\r
index e9070d5..5a4b136 100644 (file)
@@ -49,6 +49,9 @@ public class JronnWS implements SequenceAnnotation<Jronn> {
        private static final PresetManager<Jronn> jronnPresets = Util\r
                        .getPresets(Jronn.class);\r
 \r
+       private static final LimitsManager<Jronn> limitMan = compbio.runner.Util\r
+                       .getLimits(new Jronn().getType());\r
+\r
        ConfiguredExecutable<Jronn> init(List<FastaSequence> sequences)\r
                        throws JobSubmissionException {\r
                Jronn jronn = new Jronn();\r
@@ -70,12 +73,12 @@ public class JronnWS implements SequenceAnnotation<Jronn> {
 \r
        @Override\r
        public Limit<Jronn> getLimit(String presetName) {\r
-               return new Jronn().getLimit(presetName);\r
+               return limitMan.getLimitByName(presetName);\r
        }\r
 \r
        @Override\r
        public LimitsManager<Jronn> getLimits() {\r
-               return new Jronn().getLimits();\r
+               return limitMan;\r
        }\r
 \r
        @Override\r
index cdb159c..0c8347d 100644 (file)
@@ -50,116 +50,119 @@ import compbio.runner.msa.Mafft;
 @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "MafftWS")\r
 public class MafftWS implements MsaWS<Mafft> {\r
 \r
-    // Ask for resource injection\r
-    @Resource\r
-    WebServiceContext wsContext;\r
-\r
-    private static Logger statLog = Logger.getLogger("MafftWS-stats");\r
-\r
-    private static Logger log = Logger.getLogger(MafftWS.class);\r
-\r
-    private static final RunnerConfig<Mafft> mafftOptions = Util\r
-           .getSupportedOptions(Mafft.class);\r
-\r
-    private static final PresetManager<Mafft> mafftPresets = Util\r
-           .getPresets(Mafft.class);\r
-\r
-    @Override\r
-    public String align(List<FastaSequence> sequences)\r
-           throws JobSubmissionException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
-       return WSUtil.align(sequences, confMafft, null, "align", getLimit(""));\r
-    }\r
-\r
-    ConfiguredExecutable<Mafft> init(List<FastaSequence> dataSet)\r
-           throws JobSubmissionException {\r
-       Mafft mafft = new Mafft();\r
-       mafft.setInput("fasta.in").setOutput("fasta.out");\r
-       return Configurator.configureExecutable(mafft, dataSet);\r
-    }\r
-\r
-    @Override\r
-    public String customAlign(List<FastaSequence> sequences,\r
-           List<Option<Mafft>> options) throws JobSubmissionException,\r
-           WrongParameterException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
-       List<String> params = WSUtil.getCommands(options,\r
-               Mafft.KEY_VALUE_SEPARATOR);\r
-       log.info("Setting parameters: " + params);\r
-       confMafft.addParameters(params);\r
-       return WSUtil.align(sequences, confMafft, null, "customAlign",\r
-               getLimit(""));\r
-    }\r
-\r
-    @Override\r
-    public String presetAlign(List<FastaSequence> sequences,\r
-           Preset<Mafft> preset) throws JobSubmissionException,\r
-           WrongParameterException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       if (preset == null) {\r
-           throw new WrongParameterException("Preset must be provided!");\r
+       // Ask for resource injection\r
+       @Resource\r
+       WebServiceContext wsContext;\r
+\r
+       private static Logger statLog = Logger.getLogger("MafftWS-stats");\r
+\r
+       private static Logger log = Logger.getLogger(MafftWS.class);\r
+\r
+       private static final RunnerConfig<Mafft> mafftOptions = Util\r
+                       .getSupportedOptions(Mafft.class);\r
+\r
+       private static final PresetManager<Mafft> mafftPresets = Util\r
+                       .getPresets(Mafft.class);\r
+\r
+       private static final LimitsManager<Mafft> limitMan = compbio.runner.Util\r
+                       .getLimits(new Mafft().getType());\r
+\r
+       @Override\r
+       public String align(List<FastaSequence> sequences)\r
+                       throws JobSubmissionException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
+               return WSUtil.align(sequences, confMafft, null, "align", getLimit(""));\r
+       }\r
+\r
+       ConfiguredExecutable<Mafft> init(List<FastaSequence> dataSet)\r
+                       throws JobSubmissionException {\r
+               Mafft mafft = new Mafft();\r
+               mafft.setInput("fasta.in").setOutput("fasta.out");\r
+               return Configurator.configureExecutable(mafft, dataSet);\r
+       }\r
+\r
+       @Override\r
+       public String customAlign(List<FastaSequence> sequences,\r
+                       List<Option<Mafft>> options) throws JobSubmissionException,\r
+                       WrongParameterException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
+               List<String> params = WSUtil.getCommands(options,\r
+                               Mafft.KEY_VALUE_SEPARATOR);\r
+               log.info("Setting parameters: " + params);\r
+               confMafft.addParameters(params);\r
+               return WSUtil.align(sequences, confMafft, null, "customAlign",\r
+                               getLimit(""));\r
+       }\r
+\r
+       @Override\r
+       public String presetAlign(List<FastaSequence> sequences,\r
+                       Preset<Mafft> preset) throws JobSubmissionException,\r
+                       WrongParameterException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               if (preset == null) {\r
+                       throw new WrongParameterException("Preset must be provided!");\r
+               }\r
+               ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
+               confMafft.addParameters(preset.getOptions());\r
+               // This will return default limit if a specific the limit for a\r
+               // particular preset is not found\r
+               Limit<Mafft> limit = getLimit(preset.getName());\r
+\r
+               return WSUtil.align(sequences, confMafft, null, "presetAlign", limit);\r
+       }\r
+\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+               WSUtil.validateJobId(jobId);\r
+               AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+               ConfiguredExecutable<Mafft> mafft = (ConfiguredExecutable<Mafft>) asyncEngine\r
+                               .getResults(jobId);\r
+               Alignment al = mafft.getResults();\r
+               // log(jobId, "getResults");\r
+               return al;\r
+       }\r
+\r
+       @Override\r
+       public Limit<Mafft> getLimit(String presetName) {\r
+               return limitMan.getLimitByName(presetName);\r
+       }\r
+\r
+       @Override\r
+       public LimitsManager<Mafft> getLimits() {\r
+               return limitMan;\r
+       }\r
+\r
+       @Override\r
+       public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+               WSUtil.validateJobId(jobId);\r
+               String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+                               + new Mafft().getError();\r
+               return WSUtil.pullFile(file, position);\r
+       }\r
+\r
+       @Override\r
+       public boolean cancelJob(String jobId) {\r
+               WSUtil.validateJobId(jobId);\r
+               return WSUtil.cancelJob(jobId);\r
+       }\r
+\r
+       @Override\r
+       public JobStatus getJobStatus(String jobId) {\r
+               WSUtil.validateJobId(jobId);\r
+               return WSUtil.getJobStatus(jobId);\r
+       }\r
+\r
+       @Override\r
+       public PresetManager<Mafft> getPresets() {\r
+               return mafftPresets;\r
+       }\r
+\r
+       @Override\r
+       public RunnerConfig<Mafft> getRunnerOptions() {\r
+               return mafftOptions;\r
        }\r
-       ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
-       confMafft.addParameters(preset.getOptions());\r
-       // This will return default limit if a specific the limit for a\r
-       // particular preset is not found\r
-       Limit<Mafft> limit = getLimit(preset.getName());\r
-\r
-       return WSUtil.align(sequences, confMafft, null, "presetAlign", limit);\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Override\r
-    public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
-       WSUtil.validateJobId(jobId);\r
-       AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
-       ConfiguredExecutable<Mafft> mafft = (ConfiguredExecutable<Mafft>) asyncEngine\r
-               .getResults(jobId);\r
-       Alignment al = mafft.getResults();\r
-       //log(jobId, "getResults");\r
-       return al;\r
-    }\r
-\r
-    @Override\r
-    public Limit<Mafft> getLimit(String presetName) {\r
-       return new Mafft().getLimit(presetName);\r
-    }\r
-\r
-    @Override\r
-    public LimitsManager<Mafft> getLimits() {\r
-       return new Mafft().getLimits();\r
-    }\r
-\r
-    @Override\r
-    public ChunkHolder pullExecStatistics(String jobId, long position) {\r
-       WSUtil.validateJobId(jobId);\r
-       String file = Configurator.getWorkDirectory(jobId) + File.separator\r
-               + new Mafft().getError();\r
-       return WSUtil.pullFile(file, position);\r
-    }\r
-\r
-    @Override\r
-    public boolean cancelJob(String jobId) {\r
-       WSUtil.validateJobId(jobId);\r
-       return WSUtil.cancelJob(jobId);\r
-    }\r
-\r
-    @Override\r
-    public JobStatus getJobStatus(String jobId) {\r
-       WSUtil.validateJobId(jobId);\r
-       return WSUtil.getJobStatus(jobId);\r
-    }\r
-\r
-    @Override\r
-    public PresetManager<Mafft> getPresets() {\r
-       return mafftPresets;\r
-    }\r
-\r
-    @Override\r
-    public RunnerConfig<Mafft> getRunnerOptions() {\r
-       return mafftOptions;\r
-    }\r
 \r
 }\r
index e626f94..c0de308 100644 (file)
@@ -50,115 +50,118 @@ import compbio.runner.msa.Muscle;
 @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "MuscleWS")\r
 public class MuscleWS implements MsaWS<Muscle> {\r
 \r
-    // Ask for resource injection\r
-    @Resource\r
-    WebServiceContext wsContext;\r
-\r
-    private static Logger statLog = Logger.getLogger("MuscleWS-stats");\r
-\r
-    private static Logger log = Logger.getLogger(MuscleWS.class);\r
-\r
-    private static final RunnerConfig<Muscle> muscleOptions = Util\r
-           .getSupportedOptions(Muscle.class);\r
-\r
-    private static final PresetManager<Muscle> musclePresets = Util\r
-           .getPresets(Muscle.class);\r
-\r
-    @Override\r
-    public String align(List<FastaSequence> sequences)\r
-           throws JobSubmissionException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
-       return WSUtil.align(sequences, confMuscle, null, "align", getLimit(""));\r
-    }\r
-\r
-    ConfiguredExecutable<Muscle> init(List<FastaSequence> sequences)\r
-           throws JobSubmissionException {\r
-       Muscle muscle = new Muscle();\r
-       muscle.setInput("fasta.in").setOutput("fasta.out");\r
-       return Configurator.configureExecutable(muscle, sequences);\r
-    }\r
-\r
-    @Override\r
-    public String customAlign(List<FastaSequence> sequences,\r
-           List<Option<Muscle>> options) throws JobSubmissionException,\r
-           WrongParameterException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
-       // Could not do that! Space separated values\r
-       // will all be treated as keys! thus duplicates removed\r
-       // String params = cbuilder.getCommand();\r
-       List<String> params = WSUtil.getCommands(options,\r
-               Muscle.KEY_VALUE_SEPARATOR);\r
-       confMuscle.addParameters(params);\r
-       return WSUtil.align(sequences, confMuscle, null, "customAlign",\r
-               getLimit(""));\r
-    }\r
-\r
-    @Override\r
-    public String presetAlign(List<FastaSequence> sequences,\r
-           Preset<Muscle> preset) throws JobSubmissionException,\r
-           WrongParameterException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       if (preset == null) {\r
-           throw new WrongParameterException("Preset must be provided!");\r
+       // Ask for resource injection\r
+       @Resource\r
+       WebServiceContext wsContext;\r
+\r
+       private static Logger statLog = Logger.getLogger("MuscleWS-stats");\r
+\r
+       private static Logger log = Logger.getLogger(MuscleWS.class);\r
+\r
+       private static final RunnerConfig<Muscle> muscleOptions = Util\r
+                       .getSupportedOptions(Muscle.class);\r
+\r
+       private static final PresetManager<Muscle> musclePresets = Util\r
+                       .getPresets(Muscle.class);\r
+\r
+       private static final LimitsManager<Muscle> limitMan = compbio.runner.Util\r
+                       .getLimits(new Muscle().getType());\r
+\r
+       @Override\r
+       public String align(List<FastaSequence> sequences)\r
+                       throws JobSubmissionException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
+               return WSUtil.align(sequences, confMuscle, null, "align", getLimit(""));\r
+       }\r
+\r
+       ConfiguredExecutable<Muscle> init(List<FastaSequence> sequences)\r
+                       throws JobSubmissionException {\r
+               Muscle muscle = new Muscle();\r
+               muscle.setInput("fasta.in").setOutput("fasta.out");\r
+               return Configurator.configureExecutable(muscle, sequences);\r
+       }\r
+\r
+       @Override\r
+       public String customAlign(List<FastaSequence> sequences,\r
+                       List<Option<Muscle>> options) throws JobSubmissionException,\r
+                       WrongParameterException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
+               // Could not do that! Space separated values\r
+               // will all be treated as keys! thus duplicates removed\r
+               // String params = cbuilder.getCommand();\r
+               List<String> params = WSUtil.getCommands(options,\r
+                               Muscle.KEY_VALUE_SEPARATOR);\r
+               confMuscle.addParameters(params);\r
+               return WSUtil.align(sequences, confMuscle, null, "customAlign",\r
+                               getLimit(""));\r
+       }\r
+\r
+       @Override\r
+       public String presetAlign(List<FastaSequence> sequences,\r
+                       Preset<Muscle> preset) throws JobSubmissionException,\r
+                       WrongParameterException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               if (preset == null) {\r
+                       throw new WrongParameterException("Preset must be provided!");\r
+               }\r
+               ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
+               confMuscle.addParameters(preset.getOptions());\r
+               Limit<Muscle> limit = getLimit(preset.getName());\r
+               return WSUtil.align(sequences, confMuscle, null, "presetAlign", limit);\r
+       }\r
+\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+               WSUtil.validateJobId(jobId);\r
+               AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+               ConfiguredExecutable<Muscle> muscle = (ConfiguredExecutable<Muscle>) asyncEngine\r
+                               .getResults(jobId);\r
+               Alignment al = muscle.getResults();\r
+               // log(jobId, "getResults");\r
+               return al;\r
+       }\r
+\r
+       @Override\r
+       public Limit<Muscle> getLimit(String presetName) {\r
+               return limitMan.getLimitByName(presetName);\r
+       }\r
+\r
+       @Override\r
+       public LimitsManager<Muscle> getLimits() {\r
+               return limitMan;\r
+       }\r
+\r
+       @Override\r
+       public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+               WSUtil.validateJobId(jobId);\r
+               String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+                               + Muscle.getStatFile();\r
+               return WSUtil.pullFile(file, position);\r
+       }\r
+\r
+       @Override\r
+       public boolean cancelJob(String jobId) {\r
+               WSUtil.validateJobId(jobId);\r
+               return WSUtil.cancelJob(jobId);\r
+       }\r
+\r
+       @Override\r
+       public JobStatus getJobStatus(String jobId) {\r
+               WSUtil.validateJobId(jobId);\r
+               return WSUtil.getJobStatus(jobId);\r
+       }\r
+\r
+       @Override\r
+       public PresetManager<Muscle> getPresets() {\r
+               return musclePresets;\r
+       }\r
+\r
+       @Override\r
+       public RunnerConfig<Muscle> getRunnerOptions() {\r
+               return muscleOptions;\r
        }\r
-       ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
-       confMuscle.addParameters(preset.getOptions());\r
-       Limit<Muscle> limit = getLimit(preset.getName());\r
-       return WSUtil.align(sequences, confMuscle, null, "presetAlign", limit);\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Override\r
-    public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
-       WSUtil.validateJobId(jobId);\r
-       AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
-       ConfiguredExecutable<Muscle> muscle = (ConfiguredExecutable<Muscle>) asyncEngine\r
-               .getResults(jobId);\r
-       Alignment al = muscle.getResults();\r
-       //log(jobId, "getResults");\r
-       return al;\r
-    }\r
-\r
-    @Override\r
-    public Limit<Muscle> getLimit(String presetName) {\r
-       return new Muscle().getLimit(presetName);\r
-    }\r
-\r
-    @Override\r
-    public LimitsManager<Muscle> getLimits() {\r
-       return new Muscle().getLimits();\r
-    }\r
-\r
-    @Override\r
-    public ChunkHolder pullExecStatistics(String jobId, long position) {\r
-       WSUtil.validateJobId(jobId);\r
-       String file = Configurator.getWorkDirectory(jobId) + File.separator\r
-               + Muscle.getStatFile();\r
-       return WSUtil.pullFile(file, position);\r
-    }\r
-\r
-    @Override\r
-    public boolean cancelJob(String jobId) {\r
-       WSUtil.validateJobId(jobId);\r
-       return WSUtil.cancelJob(jobId);\r
-    }\r
-\r
-    @Override\r
-    public JobStatus getJobStatus(String jobId) {\r
-       WSUtil.validateJobId(jobId);\r
-       return WSUtil.getJobStatus(jobId);\r
-    }\r
-\r
-    @Override\r
-    public PresetManager<Muscle> getPresets() {\r
-       return musclePresets;\r
-    }\r
-\r
-    @Override\r
-    public RunnerConfig<Muscle> getRunnerOptions() {\r
-       return muscleOptions;\r
-    }\r
 \r
 }\r
index 8060be6..85e8a70 100644 (file)
@@ -50,113 +50,116 @@ import compbio.runner.msa.Probcons;
 @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "ProbconsWS")\r
 public class ProbconsWS implements MsaWS<Probcons> {\r
 \r
-    // Ask for resource injection\r
-    @Resource\r
-    WebServiceContext wsContext;\r
-\r
-    private static Logger statLog = Logger.getLogger("ProbconsWS-stats");\r
-\r
-    private static Logger log = Logger.getLogger(ProbconsWS.class);\r
-\r
-    private static final RunnerConfig<Probcons> probconsOptions = Util\r
-           .getSupportedOptions(Probcons.class);\r
-\r
-    @Override\r
-    public String align(List<FastaSequence> sequences)\r
-           throws JobSubmissionException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
-       return WSUtil.align(sequences, confProbcons, null, "align",\r
-               getLimit(""));\r
-    }\r
-\r
-    ConfiguredExecutable<Probcons> init(List<FastaSequence> dataSet)\r
-           throws JobSubmissionException {\r
-       Probcons probcons = new Probcons();\r
-       probcons.setInput("fasta.in").setOutput("alignment.out");\r
-       return Configurator.configureExecutable(probcons, dataSet);\r
-    }\r
-\r
-    @Override\r
-    public String customAlign(List<FastaSequence> sequences,\r
-           List<Option<Probcons>> options) throws JobSubmissionException,\r
-           WrongParameterException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
-       List<String> params = WSUtil.getCommands(options,\r
-               Probcons.KEY_VALUE_SEPARATOR);\r
-       log.info("Setting parameters:" + params);\r
-       confProbcons.addParameters(params);\r
-       return WSUtil.align(sequences, confProbcons, null, "customAlign",\r
-               getLimit(""));\r
-    }\r
-\r
-    @Override\r
-    public String presetAlign(List<FastaSequence> sequences,\r
-           Preset<Probcons> preset) throws JobSubmissionException,\r
-           WrongParameterException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       if (preset == null) {\r
-           throw new WrongParameterException("Preset must be provided!");\r
+       // Ask for resource injection\r
+       @Resource\r
+       WebServiceContext wsContext;\r
+\r
+       private static Logger statLog = Logger.getLogger("ProbconsWS-stats");\r
+\r
+       private static Logger log = Logger.getLogger(ProbconsWS.class);\r
+\r
+       private static final RunnerConfig<Probcons> probconsOptions = Util\r
+                       .getSupportedOptions(Probcons.class);\r
+\r
+       private static final LimitsManager<Probcons> limitMan = compbio.runner.Util\r
+                       .getLimits(new Probcons().getType());\r
+\r
+       @Override\r
+       public String align(List<FastaSequence> sequences)\r
+                       throws JobSubmissionException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
+               return WSUtil.align(sequences, confProbcons, null, "align",\r
+                               getLimit(""));\r
+       }\r
+\r
+       ConfiguredExecutable<Probcons> init(List<FastaSequence> dataSet)\r
+                       throws JobSubmissionException {\r
+               Probcons probcons = new Probcons();\r
+               probcons.setInput("fasta.in").setOutput("alignment.out");\r
+               return Configurator.configureExecutable(probcons, dataSet);\r
+       }\r
+\r
+       @Override\r
+       public String customAlign(List<FastaSequence> sequences,\r
+                       List<Option<Probcons>> options) throws JobSubmissionException,\r
+                       WrongParameterException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
+               List<String> params = WSUtil.getCommands(options,\r
+                               Probcons.KEY_VALUE_SEPARATOR);\r
+               log.info("Setting parameters:" + params);\r
+               confProbcons.addParameters(params);\r
+               return WSUtil.align(sequences, confProbcons, null, "customAlign",\r
+                               getLimit(""));\r
+       }\r
+\r
+       @Override\r
+       public String presetAlign(List<FastaSequence> sequences,\r
+                       Preset<Probcons> preset) throws JobSubmissionException,\r
+                       WrongParameterException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               if (preset == null) {\r
+                       throw new WrongParameterException("Preset must be provided!");\r
+               }\r
+               ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
+               confProbcons.addParameters(preset.getOptions());\r
+               Limit<Probcons> limit = getLimit(preset.getName());\r
+               return WSUtil\r
+                               .align(sequences, confProbcons, null, "presetAlign", limit);\r
+       }\r
+\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+               WSUtil.validateJobId(jobId);\r
+               AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+               ConfiguredExecutable<Probcons> probcons = (ConfiguredExecutable<Probcons>) asyncEngine\r
+                               .getResults(jobId);\r
+               Alignment al = probcons.getResults();\r
+               // log(jobId, "getResults");\r
+               return al;\r
+       }\r
+\r
+       @Override\r
+       public Limit<Probcons> getLimit(String presetName) {\r
+               return limitMan.getLimitByName(presetName);\r
+       }\r
+\r
+       @Override\r
+       public LimitsManager<Probcons> getLimits() {\r
+               return limitMan;\r
+       }\r
+\r
+       @Override\r
+       public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+               WSUtil.validateJobId(jobId);\r
+               // TODO check if output is the one to return\r
+               String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+                               + new Probcons().getError();\r
+               return WSUtil.pullFile(file, position);\r
+       }\r
+\r
+       @Override\r
+       public boolean cancelJob(String jobId) {\r
+               WSUtil.validateJobId(jobId);\r
+               return WSUtil.cancelJob(jobId);\r
+       }\r
+\r
+       @Override\r
+       public JobStatus getJobStatus(String jobId) {\r
+               WSUtil.validateJobId(jobId);\r
+               return WSUtil.getJobStatus(jobId);\r
+       }\r
+\r
+       @Override\r
+       public PresetManager<Probcons> getPresets() {\r
+               return null;\r
+       }\r
+\r
+       @Override\r
+       public RunnerConfig<Probcons> getRunnerOptions() {\r
+               return probconsOptions;\r
        }\r
-       ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
-       confProbcons.addParameters(preset.getOptions());\r
-       Limit<Probcons> limit = getLimit(preset.getName());\r
-       return WSUtil\r
-               .align(sequences, confProbcons, null, "presetAlign", limit);\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Override\r
-    public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
-       WSUtil.validateJobId(jobId);\r
-       AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
-       ConfiguredExecutable<Probcons> probcons = (ConfiguredExecutable<Probcons>) asyncEngine\r
-               .getResults(jobId);\r
-       Alignment al = probcons.getResults();\r
-       //log(jobId, "getResults");\r
-       return al;\r
-    }\r
-\r
-    @Override\r
-    public Limit<Probcons> getLimit(String presetName) {\r
-       return new Probcons().getLimit(presetName);\r
-    }\r
-\r
-    @Override\r
-    public LimitsManager<Probcons> getLimits() {\r
-       return new Probcons().getLimits();\r
-    }\r
-\r
-    @Override\r
-    public ChunkHolder pullExecStatistics(String jobId, long position) {\r
-       WSUtil.validateJobId(jobId);\r
-       // TODO check if output is the one to return\r
-       String file = Configurator.getWorkDirectory(jobId) + File.separator\r
-               + new Probcons().getError();\r
-       return WSUtil.pullFile(file, position);\r
-    }\r
-\r
-    @Override\r
-    public boolean cancelJob(String jobId) {\r
-       WSUtil.validateJobId(jobId);\r
-       return WSUtil.cancelJob(jobId);\r
-    }\r
-\r
-    @Override\r
-    public JobStatus getJobStatus(String jobId) {\r
-       WSUtil.validateJobId(jobId);\r
-       return WSUtil.getJobStatus(jobId);\r
-    }\r
-\r
-    @Override\r
-    public PresetManager<Probcons> getPresets() {\r
-       return null;\r
-    }\r
-\r
-    @Override\r
-    public RunnerConfig<Probcons> getRunnerOptions() {\r
-       return probconsOptions;\r
-    }\r
 \r
 }\r
index 07a1f41..d8054b4 100644 (file)
@@ -52,123 +52,127 @@ import compbio.runner.msa.Tcoffee;
 @WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "TcoffeeWS")\r
 public class TcoffeeWS implements MsaWS<Tcoffee> {\r
 \r
-    // Ask for resource injection\r
-    @Resource\r
-    WebServiceContext wsContext;\r
-\r
-    private static Logger statLog = Logger.getLogger("TcoffeeWS-stats");\r
-\r
-    private static Logger log = Logger.getLogger(TcoffeeWS.class);\r
-\r
-    private static final RunnerConfig<Tcoffee> tcoffeeOptions = Util\r
-           .getSupportedOptions(Tcoffee.class);\r
-\r
-    private static final PresetManager<Tcoffee> tcoffeePresets = Util\r
-           .getPresets(Tcoffee.class);\r
-\r
-    @Override\r
-    public String align(List<FastaSequence> sequences)\r
-           throws JobSubmissionException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
-       return WSUtil\r
-               .align(sequences, confTcoffee, null, "align", getLimit(""));\r
-    }\r
-\r
-    ConfiguredExecutable<Tcoffee> init(List<FastaSequence> sequences)\r
-    throws JobSubmissionException {\r
-       Tcoffee tcoffee = new Tcoffee();\r
-       tcoffee.setInput("fasta.in").setOutput("fasta.out");\r
-       ConfiguredExecutable<Tcoffee> confCoffee = Configurator\r
-       .configureExecutable(tcoffee, sequences);\r
-       if (confCoffee.getExecProvider() == Executable.ExecProvider.Cluster) {\r
-               int clusterCpuNum = SkeletalExecutable.getClusterCpuNum(Tcoffee.class);\r
-               if (clusterCpuNum != 0) {\r
-                       tcoffee.setNCore(clusterCpuNum);\r
-               }\r
-       }\r
-       return confCoffee;\r
-    }\r
-\r
-    @Override\r
-    public String customAlign(List<FastaSequence> sequences,\r
-           List<Option<Tcoffee>> options) throws JobSubmissionException,\r
-           WrongParameterException {\r
-\r
-       WSUtil.validateFastaInput(sequences);\r
-       ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
-       List<String> params = WSUtil.getCommands(options,\r
-               Tcoffee.KEY_VALUE_SEPARATOR);\r
-       log.info("Setting parameters:" + params);\r
-       confTcoffee.addParameters(params);\r
-       return WSUtil.align(sequences, confTcoffee, null, "customAlign",\r
-               getLimit(""));\r
-    }\r
-\r
-    @Override\r
-    public String presetAlign(List<FastaSequence> sequences,\r
-           Preset<Tcoffee> preset) throws JobSubmissionException,\r
-           WrongParameterException {\r
-       WSUtil.validateFastaInput(sequences);\r
-       if (preset == null) {\r
-           throw new WrongParameterException("Preset must be provided!");\r
+       // Ask for resource injection\r
+       @Resource\r
+       WebServiceContext wsContext;\r
+\r
+       private static Logger statLog = Logger.getLogger("TcoffeeWS-stats");\r
+\r
+       private static Logger log = Logger.getLogger(TcoffeeWS.class);\r
+\r
+       private static final RunnerConfig<Tcoffee> tcoffeeOptions = Util\r
+                       .getSupportedOptions(Tcoffee.class);\r
+\r
+       private static final PresetManager<Tcoffee> tcoffeePresets = Util\r
+                       .getPresets(Tcoffee.class);\r
+\r
+       private static final LimitsManager<Tcoffee> limitMan = compbio.runner.Util\r
+                       .getLimits(new Tcoffee().getType());\r
+\r
+       @Override\r
+       public String align(List<FastaSequence> sequences)\r
+                       throws JobSubmissionException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
+               return WSUtil\r
+                               .align(sequences, confTcoffee, null, "align", getLimit(""));\r
+       }\r
+\r
+       ConfiguredExecutable<Tcoffee> init(List<FastaSequence> sequences)\r
+                       throws JobSubmissionException {\r
+               Tcoffee tcoffee = new Tcoffee();\r
+               tcoffee.setInput("fasta.in").setOutput("fasta.out");\r
+               ConfiguredExecutable<Tcoffee> confCoffee = Configurator\r
+                               .configureExecutable(tcoffee, sequences);\r
+               if (confCoffee.getExecProvider() == Executable.ExecProvider.Cluster) {\r
+                       int clusterCpuNum = SkeletalExecutable\r
+                                       .getClusterCpuNum(Tcoffee.class);\r
+                       if (clusterCpuNum != 0) {\r
+                               tcoffee.setNCore(clusterCpuNum);\r
+                       }\r
+               }\r
+               return confCoffee;\r
+       }\r
+\r
+       @Override\r
+       public String customAlign(List<FastaSequence> sequences,\r
+                       List<Option<Tcoffee>> options) throws JobSubmissionException,\r
+                       WrongParameterException {\r
+\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
+               List<String> params = WSUtil.getCommands(options,\r
+                               Tcoffee.KEY_VALUE_SEPARATOR);\r
+               log.info("Setting parameters:" + params);\r
+               confTcoffee.addParameters(params);\r
+               return WSUtil.align(sequences, confTcoffee, null, "customAlign",\r
+                               getLimit(""));\r
+       }\r
+\r
+       @Override\r
+       public String presetAlign(List<FastaSequence> sequences,\r
+                       Preset<Tcoffee> preset) throws JobSubmissionException,\r
+                       WrongParameterException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               if (preset == null) {\r
+                       throw new WrongParameterException("Preset must be provided!");\r
+               }\r
+               ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
+               confTcoffee.addParameters(preset.getOptions());\r
+               Limit<Tcoffee> limit = getLimit(preset.getName());\r
+               return WSUtil.align(sequences, confTcoffee, null, "presetAlign", limit);\r
+       }\r
+\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+               WSUtil.validateJobId(jobId);\r
+               AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+               ConfiguredExecutable<Tcoffee> tcoffee = (ConfiguredExecutable<Tcoffee>) asyncEngine\r
+                               .getResults(jobId);\r
+               Alignment al = tcoffee.getResults();\r
+               // log(jobId, "getResults");\r
+               return al;\r
+       }\r
+\r
+       @Override\r
+       public Limit<Tcoffee> getLimit(String presetName) {\r
+               return limitMan.getLimitByName(presetName);\r
+       }\r
+\r
+       @Override\r
+       public LimitsManager<Tcoffee> getLimits() {\r
+               return limitMan;\r
+       }\r
+\r
+       @Override\r
+       public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+               WSUtil.validateJobId(jobId);\r
+               String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+                               + new Tcoffee().getError();\r
+               return WSUtil.pullFile(file, position);\r
+       }\r
+\r
+       @Override\r
+       public boolean cancelJob(String jobId) {\r
+               WSUtil.validateJobId(jobId);\r
+               return WSUtil.cancelJob(jobId);\r
+       }\r
+\r
+       @Override\r
+       public JobStatus getJobStatus(String jobId) {\r
+               WSUtil.validateJobId(jobId);\r
+               return WSUtil.getJobStatus(jobId);\r
+       }\r
+\r
+       @Override\r
+       public PresetManager<Tcoffee> getPresets() {\r
+               return tcoffeePresets;\r
+       }\r
+\r
+       @Override\r
+       public RunnerConfig<Tcoffee> getRunnerOptions() {\r
+               return tcoffeeOptions;\r
        }\r
-       ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
-       confTcoffee.addParameters(preset.getOptions());\r
-       Limit<Tcoffee> limit = getLimit(preset.getName());\r
-       return WSUtil.align(sequences, confTcoffee, null, "presetAlign", limit);\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Override\r
-    public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
-       WSUtil.validateJobId(jobId);\r
-       AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
-       ConfiguredExecutable<Tcoffee> tcoffee = (ConfiguredExecutable<Tcoffee>) asyncEngine\r
-               .getResults(jobId);\r
-       Alignment al = tcoffee.getResults();\r
-       //log(jobId, "getResults");\r
-       return al;\r
-    }\r
-\r
-    @Override\r
-    public Limit<Tcoffee> getLimit(String presetName) {\r
-       return new Tcoffee().getLimit(presetName);\r
-    }\r
-\r
-    @Override\r
-    public LimitsManager<Tcoffee> getLimits() {\r
-       return new Tcoffee().getLimits();\r
-    }\r
-\r
-    @Override\r
-    public ChunkHolder pullExecStatistics(String jobId, long position) {\r
-       WSUtil.validateJobId(jobId);\r
-       String file = Configurator.getWorkDirectory(jobId) + File.separator\r
-               + new Tcoffee().getError();\r
-       return WSUtil.pullFile(file, position);\r
-    }\r
-\r
-    @Override\r
-    public boolean cancelJob(String jobId) {\r
-       WSUtil.validateJobId(jobId);\r
-       return WSUtil.cancelJob(jobId);\r
-    }\r
-\r
-    @Override\r
-    public JobStatus getJobStatus(String jobId) {\r
-       WSUtil.validateJobId(jobId);\r
-       return WSUtil.getJobStatus(jobId);\r
-    }\r
-\r
-    @Override\r
-    public PresetManager<Tcoffee> getPresets() {\r
-       return tcoffeePresets;\r
-    }\r
-\r
-    @Override\r
-    public RunnerConfig<Tcoffee> getRunnerOptions() {\r
-       return tcoffeeOptions;\r
-    }\r
 \r
 }\r
index 7e45991..9895289 100644 (file)
@@ -38,6 +38,8 @@ import compbio.util.Timer;
 \r
 public final class WSUtil {\r
 \r
+       private static final String CACHE_KEY = "LIMITS_CACHE";\r
+\r
        private static Logger log = Logger.getLogger(WSUtil.class);\r
 \r
        public static final void validateJobId(String jobId)\r
@@ -109,4 +111,38 @@ public final class WSUtil {
                return oList;\r
        }\r
 \r
+       /*\r
+        * UNUSED\r
+        * \r
+        * @SuppressWarnings("unchecked") static <T> LimitsManager<T>\r
+        * getLimits(Class<? extends Executable<T>> clazz, WebServiceContext\r
+        * wsContext) {\r
+        * \r
+        * String LIMIT_KEY = CACHE_KEY + clazz.getCanonicalName(); LimitsManager<T>\r
+        * limit = (LimitsManager<T>) getObjectFromApplContext( LIMIT_KEY,\r
+        * wsContext); if (limit == null) { synchronized (WSUtil.class) { limit =\r
+        * (LimitsManager<T>) getObjectFromApplContext(LIMIT_KEY, wsContext); if\r
+        * (limit == null) { limit = compbio.runner.Util\r
+        * .getLimits((Class<Executable<T>>) clazz);\r
+        * addObjectToApplContext(wsContext, LIMIT_KEY, limit); } } } return limit;\r
+        * }\r
+        * \r
+        * static void addObjectToApplContext(WebServiceContext wsContext, String\r
+        * objKey, Object obj) { assert !Util.isEmpty(objKey) :\r
+        * "Key for the object must not be empty! "; assert wsContext != null;\r
+        * \r
+        * ServletContext ctx = ((javax.servlet.ServletContext) wsContext\r
+        * .getMessageContext().get(MessageContext. SERVLET_CONTEXT)); assert ctx !=\r
+        * null; log.debug("Adding object with key '" + objKey + "' and value '" +\r
+        * obj + "' to the application context"); ctx.setAttribute(objKey, obj); }\r
+        * static Object getObjectFromApplContext(String objKey, WebServiceContext\r
+        * wsContext) { assert !Util.isEmpty(objKey) :\r
+        * "Key for the object must not be empty! "; assert wsContext != null;\r
+        * \r
+        * ServletContext ctx = ((javax.servlet.ServletContext) wsContext\r
+        * .getMessageContext().get(MessageContext. SERVLET_CONTEXT)); Object obj =\r
+        * ctx.getAttribute(objKey); log.trace("Retrieving object with key '" +\r
+        * objKey + "' and value '" + obj + "' from the application context");\r
+        * return obj; }\r
+        */\r
 }\r