X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webservices%2Fcompbio%2Fws%2Fserver%2FWSUtil.java;h=62996e521d709b0c67b26be0e1814ba382b97acc;hb=fab6bab770b548a0c99ed6f5dfb46f5aa99f67c7;hp=dd1051f7f6b823f8b5ea74c68c65cb99b79d9406;hpb=cb02e8a08893701386c270a8bf9d0f08b9cbc4db;p=jabaws.git diff --git a/webservices/compbio/ws/server/WSUtil.java b/webservices/compbio/ws/server/WSUtil.java index dd1051f..62996e5 100644 --- a/webservices/compbio/ws/server/WSUtil.java +++ b/webservices/compbio/ws/server/WSUtil.java @@ -36,73 +36,73 @@ import compbio.util.Timer; public final class WSUtil { - public static final void validateJobId(String jobId) - throws InvalidParameterException { - if (!compbio.engine.client.Util.isValidJobId(jobId)) { - throw new InvalidParameterException( - "JobId is not provided or cannot be recognised! Given value: " - + jobId); + public static final void validateJobId(String jobId) + throws InvalidParameterException { + if (!compbio.engine.client.Util.isValidJobId(jobId)) { + throw new InvalidParameterException( + "JobId is not provided or cannot be recognised! Given value: " + + jobId); + } } - } - public static final void validateFastaInput(List sequences) - throws InvalidParameterException { - if (sequences == null || sequences.isEmpty()) { - throw new InvalidParameterException( - "List of fasta sequences required but not provided! "); + public static final void validateFastaInput(List sequences) + throws InvalidParameterException { + if (sequences == null || sequences.isEmpty()) { + throw new InvalidParameterException( + "List of fasta sequences required but not provided! "); + } } - } - public static JobStatus getJobStatus(String jobId) { - AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); - return asyncEngine.getJobStatus(jobId); - } - - public static ChunkHolder pullFile(String file, long position) { - return ProgressGetter.pull(file, position); - } + public static JobStatus getJobStatus(String jobId) { + AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); + return asyncEngine.getJobStatus(jobId); + } - public static byte getProgress(String jobId) { - throw new UnsupportedOperationException(); - } + public static ChunkHolder pullFile(String file, long position) { + return ProgressGetter.pull(file, position); + } - public static AsyncExecutor getEngine(ConfiguredExecutable confClustal) { - assert confClustal != null; - return Configurator.getAsyncEngine(confClustal); - } + public static byte getProgress(String jobId) { + throw new UnsupportedOperationException(); + } - public static boolean cancelJob(String jobId) { - AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); - return asyncEngine.cancelJob(jobId); - } + public static AsyncExecutor getEngine(ConfiguredExecutable confClustal) { + assert confClustal != null; + return Configurator.getAsyncEngine(confClustal); + } - public static String align(List sequences, - ConfiguredExecutable confExec, WSLogger logger, - String callingMethod, Limit limit) - throws LimitExceededException, JobSubmissionException { - Timer timer = Timer.getMilliSecondsTimer(); - if (limit.isExceeded(sequences)) { - throw LimitExceededException.newLimitExceeded(limit, sequences); + public static boolean cancelJob(String jobId) { + AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); + return asyncEngine.cancelJob(jobId); } - compbio.runner.Util.writeInput(sequences, confExec); - AsyncExecutor engine = Configurator.getAsyncEngine(confExec); - String jobId = engine.submitJob(confExec); - if (logger != null) { - logger.log(timer, callingMethod, jobId); + + public static String align(List sequences, + ConfiguredExecutable confExec, WSLogger logger, + String callingMethod, Limit limit) + throws LimitExceededException, JobSubmissionException { + Timer timer = Timer.getMilliSecondsTimer(); + 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); + if (logger != null) { + logger.log(timer, callingMethod, jobId); + } + return jobId; } - return jobId; - } - /* - * TODO Rewrite using purely CommandBuilder. This is breaking encapsulation - */ - public static final List getCommands(List> options, - String keyValueSeparator) { - List oList = new ArrayList(); - for (Option o : options) { - oList.add(o.toCommand(keyValueSeparator)); + /* + * TODO Rewrite using purely CommandBuilder. This is breaking encapsulation + */ + public static final List getCommands(List> options, + String keyValueSeparator) { + List oList = new ArrayList(); + for (Option o : options) { + oList.add(o.toCommand(keyValueSeparator)); + } + return oList; } - return oList; - } }