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