From 6620d54e38b513dbaba0edb0ae02778fd2d07e40 Mon Sep 17 00:00:00 2001 From: James Procter Date: Fri, 5 Jun 2015 10:58:56 +0100 Subject: [PATCH] JAl-1601 JAL-715 RestServiceDescription constructor allows specification of a series of URLs for retrieving results --- src/jalview/gui/RestServiceEditorPane.java | 8 ++++---- src/jalview/ws/rest/RestClient.java | 2 +- src/jalview/ws/rest/RestServiceDescription.java | 18 +++++++++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/jalview/gui/RestServiceEditorPane.java b/src/jalview/gui/RestServiceEditorPane.java index 8a77329..75ebcd5 100644 --- a/src/jalview/gui/RestServiceEditorPane.java +++ b/src/jalview/gui/RestServiceEditorPane.java @@ -112,7 +112,7 @@ public class RestServiceEditorPane extends GRestServiceEditorPane }); currentservice = new RestServiceDescription("Analysis", "service description", "service name", "http://localhost/", "", - null, false, false, '-'); + null, null, false, false, '-'); initGuiWith(currentservice); refreshCutnPaste(false); updateButtons(); @@ -130,7 +130,7 @@ public class RestServiceEditorPane extends GRestServiceEditorPane { currentservice = new RestServiceDescription("Analysis", "service description", "service name", "http://localhost/", - "", null, false, false, '-'); + "", null, null, false, false, '-'); } initGuiWith(currentservice); refreshCutnPaste(false); @@ -373,8 +373,8 @@ public class RestServiceEditorPane extends GRestServiceEditorPane RestServiceDescription newService = new RestServiceDescription( (String) action.getSelectedItem(), descr.getText().trim(), name .getText().trim(), url.getText().trim(), urlsuff - .getText().trim(), inputTypes, hSeparable.isSelected(), - vSeparable.isSelected(), gc); + .getText().trim(), null, inputTypes, + hSeparable.isSelected(), vSeparable.isSelected(), gc); if (newService.isValid()) { diff --git a/src/jalview/ws/rest/RestClient.java b/src/jalview/ws/rest/RestClient.java index f9b72e3..29f51e1 100644 --- a/src/jalview/ws/rest/RestClient.java +++ b/src/jalview/ws/rest/RestClient.java @@ -346,7 +346,7 @@ public class RestClient extends WSClient implements WSClientI, description, name, "http://zeus.few.vu.nl/programs/shmrwww/index.php?tool=jalview",// ?tool=jalview&mbjob[method]=shmr&mbjob[description]=step1", - "?tool=jalview", iparams, true, false, '-'); + "?tool=jalview", null, iparams, true, false, '-'); // a priori knowledge of the data returned from the service shmrService.addResultDatatype(JvDataType.ANNOTATION); return new RestClient(shmrService); diff --git a/src/jalview/ws/rest/RestServiceDescription.java b/src/jalview/ws/rest/RestServiceDescription.java index 6f89393..cfaa76f 100644 --- a/src/jalview/ws/rest/RestServiceDescription.java +++ b/src/jalview/ws/rest/RestServiceDescription.java @@ -51,18 +51,21 @@ public class RestServiceDescription } /** - * @param details * @param postUrl * @param urlSuffix + * @param urlPrefix + * null or prefix for forming result URL from job * @param inputParams * @param hseparable * @param vseparable * @param gapCharacter + * @param details */ public RestServiceDescription(String action, String description, String name, String postUrl, String urlSuffix, - Map inputParams, boolean hseparable, - boolean vseparable, char gapCharacter) + List urlPrefix, + Map inputParams, + boolean hseparable, boolean vseparable, char gapCharacter) { super(); this.details = new UIinfo(); @@ -70,6 +73,8 @@ public class RestServiceDescription details.description = description == null ? "" : description; details.Name = name == null ? "" : name; this.postUrl = postUrl == null ? "" : postUrl; + // TODO decide if nullable + this.rurlPref = urlPrefix; this.urlSuffix = urlSuffix == null ? "" : urlSuffix; if (inputParams != null) { @@ -93,6 +98,8 @@ public class RestServiceDescription diff |= hseparable != other.hseparable; diff |= !(urlSuffix == null && other.urlSuffix == null || (urlSuffix != null && other.urlSuffix != null && urlSuffix.equals(other.urlSuffix))); + diff |= !(rurlPref == null && other.rurlPref == null || (rurlPref != null + && other.rurlPref != null && rurlPref.equals(other.rurlPref))); // TODO - robust diff that includes constants and reordering of URL // diff |= !(postUrl.equals(other.postUrl)); // diff |= !inputParams.equals(other.inputParams); @@ -234,6 +241,11 @@ public class RestServiceDescription String urlSuffix; /** + * prefix for poll and result URLs when null, urlSuffix is used + */ + List rurlPref = null; + + /** * input info given as key/value pairs - mapped to post arguments */ Map inputParams = new HashMap(); -- 1.7.10.2