X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fjws2%2Fjabaws2%2FJws2Instance.java;h=9f2d4aecb41211791a4a6645a50d47b2f0778838;hb=dbf124d82413368d7aba34f8e3d8e7ad25167dea;hp=6097bdf0fa7c1f41ed0cfa578638bd7fe1ee2b7d;hpb=5b9a101b16476a4cbce179a326dfa99276a552e1;p=jalview.git diff --git a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java index 6097bdf..9f2d4ae 100644 --- a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java +++ b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java @@ -32,6 +32,7 @@ import jalview.ws.params.ParamDatastoreI; import jalview.ws.params.ParamManager; import java.io.Closeable; +import java.net.URL; import javax.swing.JMenu; @@ -42,13 +43,11 @@ import compbio.metadata.PresetManager; import compbio.metadata.RunnerConfig; public class Jws2Instance extends ServiceWithParameters - implements JalviewServiceEndpointProviderI + implements JalviewServiceEndpointProviderI, AutoCloseable { public JABAService service; - public String docUrl; - /** * * @param hosturl @@ -71,11 +70,26 @@ public class Jws2Instance extends ServiceWithParameters int p = description.indexOf("MORE INFORMATION:"); if (p > -1) { - docUrl = description.substring(description.indexOf("http", p)).trim(); + String docUrl = description.substring(description.indexOf("http", p)) + .trim(); if (docUrl.indexOf('\n') > -1) { docUrl = docUrl.substring(0, docUrl.indexOf("\n")).trim(); } + if (docUrl.length() > 0) + { + try + { + URL url = new URL(docUrl); + if (url != null) + { + setDocumentationUrl(docUrl); + } + } catch (Exception x) + { + + } + } } } @@ -137,7 +151,7 @@ public class Jws2Instance extends ServiceWithParameters } @Override - protected void finalize() throws Throwable + public void close() { if (service != null) { @@ -149,7 +163,7 @@ public class Jws2Instance extends ServiceWithParameters // ignore } } - super.finalize(); + // super.finalize(); } @Override @@ -172,20 +186,9 @@ public class Jws2Instance extends ServiceWithParameters return paramStore; } - public String getUri() - { - // TODO verify that service parameter sets in projects are consistent with - // Jalview 2.10.4 - // this is only valid for Jaba 1.0 - this formula might have to change! - return getHostURL() - + (getHostURL().lastIndexOf("/") == (getHostURL().length() - 1) - ? "" - : "/") - + getName(); - } - private boolean hasParams = false, lookedForParams = false; + @Override public boolean hasParameters() { if (!lookedForParams) @@ -215,18 +218,6 @@ public class Jws2Instance extends ServiceWithParameters } } - public String getNameURI() - { - return "java:" + getName(); - } - - jalview.ws.uimodel.AlignAnalysisUIText aaui; - - public jalview.ws.uimodel.AlignAnalysisUIText getAlignAnalysisUI() - { - return aaui; - } - /** * initialise a parameter store for this service * @@ -250,18 +241,39 @@ public class Jws2Instance extends ServiceWithParameters @Override public Object getEndpoint() { - if (aaui!=null) { - // TODO complete - return null; - } else { - if (service instanceof MsaWS) + if (service instanceof MsaWS) + { + if (aaui != null) + { + throw new Error( + "JABAWS MsaWS based instant calculation not implemented."); + + } + else + { + return new JabawsMsaInstance(this); + } + } + else + { + if (service instanceof compbio.data.msa.SequenceAnnotation) { - return new JabawsMsaInstance(this); - } else { - // TODO complete - // service is for sequence analysis - return null; + if (aaui != null) + { + try + { + // probably a factory would be nicer but.. + return aaui.getClient().getConstructor(getClass()) + .newInstance(this); + } catch (Throwable t) + { + throw new Error("Implementation Error in web service framework", + t); + } + } + return new AADisorderClient(this); + } + return null; } } } -}