more fixes and extension to allow return data types to be specified JAL-715
[jalview.git] / src / jalview / ws / rest / RestServiceDescription.java
index 6794a8d..befae8f 100644 (file)
@@ -19,14 +19,19 @@ package jalview.ws.rest;
 
 
 import jalview.datamodel.SequenceI;
+import jalview.io.packed.DataProvider;
+import jalview.io.packed.SimpleDataProvider;
+import jalview.io.packed.DataProvider.JvDataType;
 import jalview.util.GroupUrlLink.UrlStringTooLongException;
 import jalview.util.Platform;
 import jalview.ws.rest.params.Alignment;
 import jalview.ws.rest.params.AnnotationFile;
 import jalview.ws.rest.params.SeqGroupIndexVector;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Hashtable;
+import java.util.List;
 import java.util.Map;
 
 
@@ -76,16 +81,26 @@ public class RestServiceDescription
    */
   String urlSuffix;
   
-  /***
-   * modelling the io: 
-   * validation of input
-   * { formatter for type, parser for type }
-   *  
-   */
   /** input info given as key/value pairs - mapped to post arguments 
    */ 
   Map<String,InputType> inputParams=new HashMap();
   /**
+   * assigns the given inputType it to its corresponding input parameter token it.token  
+   * @param it
+   */
+  public void setInputParam(InputType it)
+  {
+    inputParams.put(it.token, it);
+  }
+  /**
+   * remove the given input type it from the set of service input parameters.
+   * @param it
+   */
+  public void removeInputParam(InputType it)
+  {
+    inputParams.remove(it.token);
+  }
+  /**
    * service requests alignment data
    */
   boolean aligndata;
@@ -908,4 +923,25 @@ public class RestServiceDescription
     // TODO: correctly write ?/& appropriate to result URL format.
     return jobId+urlSuffix;
   }
+  private List<JvDataType> resultData;
+  public void addResultDatatype(JvDataType dt)
+  {
+    if (resultData==null)
+    {
+      resultData = new ArrayList<JvDataType>();
+    }
+    resultData.add(dt);
+  }
+  public boolean removeRsultDatatype(JvDataType dt)
+  {
+    if (resultData!=null)
+    {
+      return resultData.remove(dt);
+    }
+    return false;
+  }
+  public List<JvDataType> getResultDataTypes()
+  {
+    return resultData;
+  }
 }