From 7dc4e39ab68dfe70e50dbf27452e9dfebca6eb62 Mon Sep 17 00:00:00 2001 From: Daniel Barton Date: Thu, 15 Aug 2013 22:19:34 +0100 Subject: [PATCH] Webservice Updated for scoremanager but I think I broke something on the way. --- webservices/compbio/ws/client/Jws2Client.java | 8 - webservices/compbio/ws/client/Services.java | 3 +- webservices/compbio/ws/server/RNAalifoldWS.java | 144 ++-------- .../compbio/ws/server/resource/RNAalifoldWS.wsdl | 292 -------------------- 4 files changed, 29 insertions(+), 418 deletions(-) delete mode 100644 webservices/compbio/ws/server/resource/RNAalifoldWS.wsdl diff --git a/webservices/compbio/ws/client/Jws2Client.java b/webservices/compbio/ws/client/Jws2Client.java index aa048b0..18424f6 100644 --- a/webservices/compbio/ws/client/Jws2Client.java +++ b/webservices/compbio/ws/client/Jws2Client.java @@ -150,7 +150,6 @@ public class Jws2Client { String presetName = CmdHelper.getPresetName(cmd); Metadata msaws = (Metadata) connect(hostname, service); - Metadata foldws = (Metadata) connect(hostname, service); Preset preset = null; if (presetName != null) { preset = MetadataHelper.getPreset(msaws, presetName); @@ -164,7 +163,6 @@ public class Jws2Client { // System.out.println("The Options read from the command line: " + customOptions); Alignment alignment = null; - String rnastruct = null; if (inputFile != null) { Writer writer = null; if (outFile != null) { @@ -183,12 +181,6 @@ public class Jws2Client { alignment = align(inputFile, (MsaWS) msaws, preset, customOptions); IOHelper.writeOut(writer, alignment); - } else if (service.getServiceType() == FoldWS.class) { - rnastruct = fold(inputFile, (FoldWS) foldws, preset, customOptions); - // No IOHelper method for rnastruct/String yet - if (writer != null) { - writer.write(rnastruct); - } } writer.close(); } diff --git a/webservices/compbio/ws/client/Services.java b/webservices/compbio/ws/client/Services.java index 6840916..8b0d200 100644 --- a/webservices/compbio/ws/client/Services.java +++ b/webservices/compbio/ws/client/Services.java @@ -78,6 +78,7 @@ public enum Services { case DisemblWS : case GlobPlotWS : case IUPredWS : + case RNAalifoldWS : return SequenceAnnotation.class; // deliberate leaking @@ -89,8 +90,6 @@ public enum Services { case TcoffeeWS : return MsaWS.class; - case RNAalifoldWS : - return FoldWS.class; default : throw new RuntimeException("Unrecognised Web Service Type " + this + " - Should never happened!"); diff --git a/webservices/compbio/ws/server/RNAalifoldWS.java b/webservices/compbio/ws/server/RNAalifoldWS.java index 7ff54e7..b05c973 100644 --- a/webservices/compbio/ws/server/RNAalifoldWS.java +++ b/webservices/compbio/ws/server/RNAalifoldWS.java @@ -12,6 +12,7 @@ import compbio.data.msa.FoldWS; import compbio.data.msa.JABAService; import compbio.data.msa.JManagement; import compbio.data.msa.Metadata; +import compbio.data.msa.SequenceAnnotation; import compbio.data.sequence.Alignment; import compbio.data.sequence.RNAStruct; import compbio.data.sequence.FastaSequence; @@ -23,143 +24,54 @@ import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; import compbio.metadata.Limit; +import compbio.metadata.LimitExceededException; import compbio.metadata.LimitsManager; import compbio.metadata.Option; import compbio.metadata.Preset; import compbio.metadata.PresetManager; import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; +import compbio.metadata.UnsupportedRuntimeException; import compbio.metadata.WrongParameterException; import compbio.runner.Util; +import compbio.runner.disorder.GlobPlot; import compbio.runner.structure.RNAalifold; -@WebService(endpointInterface = "compbio.data.msa.FoldWS", targetNamespace = JABAService.SERVICE_NAMESPACE, serviceName = "RNAalifoldWS") -public class RNAalifoldWS implements FoldWS { +@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = JABAService.V2_SERVICE_NAMESPACE, serviceName = "RNAalifoldWS") +public class RNAalifoldWS extends SequenceAnnotationService + implements + SequenceAnnotation { private static Logger log = Logger.getLogger(ClustalWS.class); - private static final RunnerConfig rnaalifoldOptions = Util. - getSupportedOptions(RNAalifold.class); - - private static final PresetManager rnaalifoldPresets = Util - .getPresets(RNAalifold.class); - - private static final LimitsManager limitMan = compbio.engine.client.Util - .getLimits(new RNAalifold().getType()); - - - @Override - public String fold(Alignment alignment) - throws JobSubmissionException { - - // Validate clustal input here? - ConfiguredExecutable confRNAalifold = init(alignment); - return WSUtil.fold(alignment, confRNAalifold, log, "fold", getLimit("")); - } - - - ConfiguredExecutable init(Alignment dataset) throws JobSubmissionException { - RNAalifold rnaalifold = new RNAalifold(); - rnaalifold.setInput(SkeletalExecutable.INPUT) - .setOutput(SkeletalExecutable.OUTPUT) - .setError(SkeletalExecutable.ERROR); - ConfiguredExecutable confRNAalifold = Configurator - .configureExecutable(rnaalifold, dataset.getSequences()); - return confRNAalifold; + public RNAalifoldWS() { + super (new RNAalifold(), log); } - + + /* + * No options are supported, thus the result of this call will be as simple + * call to analize without parameters + */ @Override - public String presetFold(Alignment alignment, - Preset preset) throws JobSubmissionException, - WrongParameterException { - // validate - if (preset == null) { - throw new WrongParameterException("Preset must be Provided!"); - } - Limit limit = getLimit(preset.getName()); - ConfiguredExecutable confRNAalifold = init(alignment); - confRNAalifold.addParameters(preset.getOptions()); - return WSUtil.fold(alignment, confRNAalifold, log, "presetFold", limit); - } - - @Override - public String customFold(Alignment alignment, - List> options) throws JobSubmissionException, + public String customAnalize(List sequences, + List> options) throws UnsupportedRuntimeException, + LimitExceededException, JobSubmissionException, WrongParameterException { - // validate - ConfiguredExecutable confRNAalifold = init(alignment); - List params = WSUtil.getCommands(options, - RNAalifold.KEY_VALUE_SEPARATOR); - confRNAalifold.addParameters(params); - log.info("Setting parameters: " + params); - return WSUtil.fold(alignment, confRNAalifold, log, "customFold", - getLimit("")); - } - - @Override - public RunnerConfig getRunnerOptions() { - return rnaalifoldOptions; - } - - @SuppressWarnings("unchecked") - public String getResult(String jobId) throws ResultNotAvailableException { - WSUtil.validateJobId(jobId); - AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); - ConfiguredExecutable rnaalifold = (ConfiguredExecutable) asyncEngine - .getResults(jobId); - return rnaalifold.getResults(); - } - - @Override - public boolean cancelJob(String jobId) { - WSUtil.validateJobId(jobId); - boolean result = WSUtil.cancelJob(jobId); - return result; - } - - @Override - public JobStatus getJobStatus(String jobId) { - WSUtil.validateJobId(jobId); - JobStatus status = WSUtil.getJobStatus(jobId); - return status; - } - - @Override - public Limit getLimit(String presetName) { - if (limitMan == null) { - // No limit is configured - return null; - } - Limit limit = limitMan.getLimitByName(presetName); - return limit; - } - - @Override - public LimitsManager getLimits() { - return limitMan; - } - - @Override - // PlaceHolder - public PresetManager getPresets() { - if (rnaalifoldPresets == null) { - // No presets are configured - return null; - } - return rnaalifoldPresets; + return analize(sequences); } + /* + * No presets are supported, thus the result of this call will be as simple + * call to analize without parameters + */ @Override - // PlaceHolder - public ChunkHolder pullExecStatistics(String jobId, long position) { + public String presetAnalize(List sequences, + Preset preset) throws UnsupportedRuntimeException, + LimitExceededException, JobSubmissionException, + WrongParameterException { -// WSUtil.validateJobId(jobId); -// String file = Configurator.getWorkDirectory(jobId) + File.separator -// + RNAalifold.getStatFile(); -// ChunkHolder cholder = WSUtil.pullFile(file, position); -// return cholder; - return new ChunkHolder("", -1); + return analize(sequences); } } diff --git a/webservices/compbio/ws/server/resource/RNAalifoldWS.wsdl b/webservices/compbio/ws/server/resource/RNAalifoldWS.wsdl deleted file mode 100644 index fea5adb..0000000 --- a/webservices/compbio/ws/server/resource/RNAalifoldWS.wsdl +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 1.7.10.2