- // Ask for resource injection\r
- @Resource\r
- WebServiceContext wsContext;\r
-\r
- private static Logger statLog = Logger.getLogger("ProbconsWS-stats");\r
-\r
- private static Logger log = Logger.getLogger(ProbconsWS.class);\r
-\r
- private static final RunnerConfig<Probcons> probconsOptions = Util\r
- .getSupportedOptions(Probcons.class);\r
-\r
- @Override\r
- public String align(List<FastaSequence> sequences)\r
- throws JobSubmissionException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
- return WSUtil.align(sequences, confProbcons, null, "align",\r
- getLimit(""));\r
- }\r
-\r
- ConfiguredExecutable<Probcons> init(List<FastaSequence> dataSet)\r
- throws JobSubmissionException {\r
- Probcons probcons = new Probcons();\r
- probcons.setInput("fasta.in").setOutput("alignment.out");\r
- return Configurator.configureExecutable(probcons, dataSet);\r
- }\r
-\r
- @Override\r
- public String customAlign(List<FastaSequence> sequences,\r
- List<Option<Probcons>> options) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
- List<String> params = WSUtil.getCommands(options,\r
- Probcons.KEY_VALUE_SEPARATOR);\r
- log.info("Setting parameters:" + params);\r
- confProbcons.addParameters(params);\r
- return WSUtil.align(sequences, confProbcons, null, "customAlign",\r
- getLimit(""));\r
- }\r
-\r
- @Override\r
- public String presetAlign(List<FastaSequence> sequences,\r
- Preset<Probcons> preset) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- if (preset == null) {\r
- throw new WrongParameterException("Preset must be provided!");\r
+ // Ask for resource injection\r
+ @Resource\r
+ WebServiceContext wsContext;\r
+\r
+ private static Logger statLog = Logger.getLogger("ProbconsWS-stats");\r
+\r
+ private static Logger log = Logger.getLogger(ProbconsWS.class);\r
+\r
+ private static final RunnerConfig<Probcons> probconsOptions = Util\r
+ .getSupportedOptions(Probcons.class);\r
+\r
+ private static final LimitsManager<Probcons> limitMan = compbio.runner.Util\r
+ .getLimits(new Probcons().getType());\r
+\r
+ @Override\r
+ public String align(List<FastaSequence> sequences)\r
+ throws JobSubmissionException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
+ return WSUtil.align(sequences, confProbcons, null, "align",\r
+ getLimit(""));\r
+ }\r
+\r
+ ConfiguredExecutable<Probcons> init(List<FastaSequence> dataSet)\r
+ throws JobSubmissionException {\r
+ Probcons probcons = new Probcons();\r
+ probcons.setInput("fasta.in").setOutput("alignment.out");\r
+ return Configurator.configureExecutable(probcons, dataSet);\r
+ }\r
+\r
+ @Override\r
+ public String customAlign(List<FastaSequence> sequences,\r
+ List<Option<Probcons>> options) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
+ List<String> params = WSUtil.getCommands(options,\r
+ Probcons.KEY_VALUE_SEPARATOR);\r
+ log.info("Setting parameters:" + params);\r
+ confProbcons.addParameters(params);\r
+ return WSUtil.align(sequences, confProbcons, null, "customAlign",\r
+ getLimit(""));\r
+ }\r
+\r
+ @Override\r
+ public String presetAlign(List<FastaSequence> sequences,\r
+ Preset<Probcons> preset) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ if (preset == null) {\r
+ throw new WrongParameterException("Preset must be provided!");\r
+ }\r
+ ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
+ confProbcons.addParameters(preset.getOptions());\r
+ Limit<Probcons> limit = getLimit(preset.getName());\r
+ return WSUtil\r
+ .align(sequences, confProbcons, null, "presetAlign", limit);\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+ WSUtil.validateJobId(jobId);\r
+ AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+ ConfiguredExecutable<Probcons> probcons = (ConfiguredExecutable<Probcons>) asyncEngine\r
+ .getResults(jobId);\r
+ Alignment al = probcons.getResults();\r
+ // log(jobId, "getResults");\r
+ return al;\r
+ }\r
+\r
+ @Override\r
+ public Limit<Probcons> getLimit(String presetName) {\r
+ return limitMan.getLimitByName(presetName);\r
+ }\r
+\r
+ @Override\r
+ public LimitsManager<Probcons> getLimits() {\r
+ return limitMan;\r
+ }\r
+\r
+ @Override\r
+ public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+ WSUtil.validateJobId(jobId);\r
+ // TODO check if output is the one to return\r
+ String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+ + new Probcons().getError();\r
+ return WSUtil.pullFile(file, position);\r
+ }\r
+\r
+ @Override\r
+ public boolean cancelJob(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ return WSUtil.cancelJob(jobId);\r
+ }\r
+\r
+ @Override\r
+ public JobStatus getJobStatus(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ return WSUtil.getJobStatus(jobId);\r
+ }\r
+\r
+ @Override\r
+ public PresetManager<Probcons> getPresets() {\r
+ return null;\r
+ }\r
+\r
+ @Override\r
+ public RunnerConfig<Probcons> getRunnerOptions() {\r
+ return probconsOptions;\r