X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webservices%2Fcompbio%2Fws%2Fserver%2FGlobPlotWS.java;h=d54bcd98a020d03d3e021ee7c054ea670e2af0b7;hb=68fe46f278b4ec408d6c68677bd56199aac749b3;hp=b0588825182bb697c0c405a27769a8a59f651669;hpb=24b1f578d0752ca4e3ee410031af5678b3ff1189;p=jabaws.git diff --git a/webservices/compbio/ws/server/GlobPlotWS.java b/webservices/compbio/ws/server/GlobPlotWS.java index b058882..d54bcd9 100644 --- a/webservices/compbio/ws/server/GlobPlotWS.java +++ b/webservices/compbio/ws/server/GlobPlotWS.java @@ -1,137 +1,48 @@ +/* Copyright (c) 2011 Peter Troshin + * + * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 + * + * This library is free software; you can redistribute it and/or modify it under the terms of the + * Apache License version 2 as published by the Apache Software Foundation + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache + * License for more details. + * + * A copy of the license is in apache_license.txt. It is also available here: + * @see: http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Any republication or derived work distributed in source code form + * must include this copyright and license notice. + */ package compbio.ws.server; import java.util.List; -import javax.annotation.Resource; import javax.jws.WebService; -import javax.xml.ws.WebServiceContext; import org.apache.log4j.Logger; +import compbio.data.msa.JABAService; import compbio.data.msa.SequenceAnnotation; import compbio.data.sequence.FastaSequence; -import compbio.data.sequence.ScoreManager; -import compbio.engine.AsyncExecutor; -import compbio.engine.Configurator; -import compbio.engine.client.ConfiguredExecutable; -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; -@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "GlobPlotWS") -public class GlobPlotWS implements SequenceAnnotation { - - // Ask for resource injection - @Resource - WebServiceContext wsContext; - - private static Logger statLog = Logger.getLogger("GlobPlotWS-stats"); +@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = JABAService.V2_SERVICE_NAMESPACE, serviceName = "GlobPlotWS") +public class GlobPlotWS extends SequenceAnnotationService + implements + SequenceAnnotation { private static Logger log = Logger.getLogger(GlobPlotWS.class); - private static final RunnerConfig globPlotOptions = Util - .getSupportedOptions(GlobPlot.class); - - 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(); - globPlot.setInput("fasta.in").setOutput("globPlot.out"); - return Configurator.configureExecutable(globPlot, sequences); - } - - @Override - public ScoreManager getAnnotation(String jobId) - throws ResultNotAvailableException { - WSUtil.validateJobId(jobId); - AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); - ConfiguredExecutable globPlot = (ConfiguredExecutable) asyncEngine - .getResults(jobId); - ScoreManager mas = globPlot.getResults(); - log.trace(jobId + " getConservation : " + mas); - return mas; - } - - @Override - public Limit getLimit(String presetName) { - if (limitMan == null) { - // Limit is not defined - return null; - } - return limitMan.getLimitByName(presetName); - } - - @Override - public LimitsManager getLimits() { - return limitMan; - } - - @Override - public ChunkHolder pullExecStatistics(String jobId, long position) { - // Execution stat is not supported - return new ChunkHolder("", -1); - } - - @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 globPlotPresets; - } - - @Override - public RunnerConfig getRunnerOptions() { - return globPlotOptions; - } - - String analize(List sequences, - ConfiguredExecutable confExec, Logger log, String method, - Limit limit) throws JobSubmissionException { - if (limit != null && limit.isExceeded(sequences)) { - throw LimitExceededException.newLimitExceeded(limit, sequences); - } - - compbio.runner.Util.writeInput(sequences, confExec); - AsyncExecutor engine = Configurator.getAsyncEngine(confExec); - String jobId = engine.submitJob(confExec); - return jobId; - } - - @Override - public String analize(List sequences) - throws UnsupportedRuntimeException, LimitExceededException, - JobSubmissionException { - WSUtil.validateFastaInput(sequences); - ConfiguredExecutable confGlobPlot = init(sequences); - - return analize(sequences, confGlobPlot, null, "analize", getLimit("")); + public GlobPlotWS() { + super(new GlobPlot(), log); } /*