X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webservices%2Fcompbio%2Fws%2Fclient%2FJws2Client.java;h=eda6533fc8d2d02ed04fd7a52724f729c66b1b89;hb=3644426ec0e9e9ceb798bd426085d8d9dd8dbb56;hp=1673e18338d2bccd640c695b1b74416daed06260;hpb=8033a51860de2200a54e64add0809d6780f5b092;p=jabaws.git diff --git a/webservices/compbio/ws/client/Jws2Client.java b/webservices/compbio/ws/client/Jws2Client.java index 1673e18..eda6533 100644 --- a/webservices/compbio/ws/client/Jws2Client.java +++ b/webservices/compbio/ws/client/Jws2Client.java @@ -38,20 +38,19 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Arrays; import java.util.List; -import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.ws.Service; import javax.xml.ws.WebServiceException; -import compbio.data.msa.Annotation; import compbio.data.msa.JABAService; import compbio.data.msa.Metadata; import compbio.data.msa.MsaWS; +import compbio.data.msa.SequenceAnnotation; import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; -import compbio.data.sequence.Score; +import compbio.data.sequence.ScoreManager; import compbio.data.sequence.SequenceUtil; import compbio.data.sequence.UnknownFileFormatException; import compbio.metadata.JobSubmissionException; @@ -159,17 +158,17 @@ public class Jws2Client { // std.out will not be outStream = System.out; } - if (service == Services.AAConWS) { - Set result = analize(inputFile, ((Annotation) msaws), - preset, customOptions); + if (service.getServiceType() == SequenceAnnotation.class) { + ScoreManager result = analize(inputFile, + ((SequenceAnnotation) msaws), preset, customOptions); + IOHelper.writeOut(outStream, result); } else { alignment = align(inputFile, (MsaWS) msaws, preset, customOptions); IOHelper.writeOut(outStream, alignment); } - - // stream is closed in the method no need to close it here + outStream.close(); } boolean listParameters = CmdHelper.listParameters(cmd); @@ -202,13 +201,14 @@ public class Jws2Client { * @return Set the conservation scores * @throws UnknownFileFormatException */ - Set analize(File file, Annotation wsproxy, Preset preset, - List> customOptions) { + ScoreManager analize(File file, SequenceAnnotation wsproxy, + Preset preset, List> customOptions) { List fastalist = null; - Set scores = null; + ScoreManager scores = null; try { fastalist = SequenceUtil.openInputStream(file.getAbsolutePath()); + assert !fastalist.isEmpty() : "Input is empty!"; String jobId = null; if (customOptions != null && preset != null) { @@ -220,9 +220,11 @@ public class Jws2Client { } else if (preset != null) { jobId = wsproxy.presetAnalize(fastalist, preset); } else { + System.out.println("\n\ncalling analise........."); jobId = wsproxy.analize(fastalist); } - Thread.sleep(1000); + Thread.sleep(2000); + scores = wsproxy.getAnnotation(jobId); } catch (IOException e) { @@ -287,8 +289,13 @@ public class Jws2Client { serv = service.getService(url, V2_QUALIFIED_SERVICE_NAME); } } + if (serv == null) { + System.err.println("Could not connect to " + url + + " the server is down?"); + // FIXME + } JABAService serviceIF = service.getInterface(serv); - log.log(Level.FINE, "Connected successfully!"); + log.log(Level.INFO, "Connected successfully!"); return serviceIF; } @@ -426,7 +433,7 @@ public class Jws2Client { /** * Starts command line client, if no parameter are supported print help. Two - * parameters are required for successfull call the JWS2 host name and a + * parameters are required for successful call the JWS2 host name and a * service name. * * @param args