Fix problem with the JpredWS service. Now Jws2Client is able to test the service
[jabaws.git] / webservices / compbio / ws / server / ProbconsWS.java
index 4ab7a34..d4fa3df 100644 (file)
@@ -1,6 +1,6 @@
-/* Copyright (c) 2009 Peter Troshin\r
+/* Copyright (c) 2011 Peter Troshin\r
  *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
+ *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0     \r
  * \r
  *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
  *  Apache License version 2 as published by the Apache Software Foundation\r
@@ -25,6 +25,7 @@ import javax.jws.WebService;
 \r
 import org.apache.log4j.Logger;\r
 \r
+import compbio.data.msa.JABAService;\r
 import compbio.data.msa.MsaWS;\r
 import compbio.data.sequence.Alignment;\r
 import compbio.data.sequence.FastaSequence;\r
@@ -46,32 +47,28 @@ import compbio.metadata.WrongParameterException;
 import compbio.runner.Util;\r
 import compbio.runner.msa.Probcons;\r
 \r
-@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "ProbconsWS")\r
+@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.SERVICE_NAMESPACE, serviceName = "ProbconsWS")\r
 public class ProbconsWS implements MsaWS<Probcons> {\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.engine.client.Util\r
-                       .getLimits(new Probcons().getType());\r
+       private static final RunnerConfig<Probcons> probconsOptions = Util.getSupportedOptions(Probcons.class);\r
+       private static final LimitsManager<Probcons> limitMan = compbio.engine.client.Util.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
+               return WSUtil.align(sequences, confProbcons, log, "align", getLimit(""));\r
        }\r
 \r
        ConfiguredExecutable<Probcons> init(List<FastaSequence> dataSet)\r
                        throws JobSubmissionException {\r
                Probcons probcons = new Probcons();\r
-               probcons.setInput(SkeletalExecutable.INPUT)\r
-                               .setOutput(SkeletalExecutable.OUTPUT)\r
-                               .setError(SkeletalExecutable.ERROR);\r
+               probcons.setInput(SkeletalExecutable.INPUT);\r
+               probcons.setOutput(SkeletalExecutable.OUTPUT);\r
+               probcons.setError(SkeletalExecutable.ERROR);\r
                return Configurator.configureExecutable(probcons, dataSet);\r
        }\r
 \r
@@ -81,12 +78,10 @@ public class ProbconsWS implements MsaWS<Probcons> {
                        WrongParameterException {\r
                WSUtil.validateFastaInput(sequences);\r
                ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
-               List<String> params = WSUtil.getCommands(options,\r
-                               Probcons.KEY_VALUE_SEPARATOR);\r
+               List<String> params = WSUtil.getCommands(options, 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
+               return WSUtil.align(sequences, confProbcons, log, "customAlign",getLimit(""));\r
        }\r
 \r
        @Override\r
@@ -100,8 +95,7 @@ public class ProbconsWS implements MsaWS<Probcons> {
                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
+               return WSUtil.align(sequences, confProbcons, log, "presetAlign", limit);\r
        }\r
 \r
        @SuppressWarnings("unchecked")\r
@@ -109,8 +103,7 @@ public class ProbconsWS implements MsaWS<Probcons> {
        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
+               ConfiguredExecutable<Probcons> probcons = (ConfiguredExecutable<Probcons>) asyncEngine.getResults(jobId);\r
                Alignment al = probcons.getResults();\r
                // log(jobId, "getResults");\r
                return al;\r
@@ -134,8 +127,7 @@ public class ProbconsWS implements MsaWS<Probcons> {
        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
+               String file = Configurator.getWorkDirectory(jobId) + File.separator + new Probcons().getError();\r
                return WSUtil.pullFile(file, position);\r
        }\r
 \r