[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Thu Mar 13 23:05:48 UTC 2008


gordonp
Thu Mar 13 19:05:47 EDT 2008
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util
In directory dev.open-bio.org:/tmp/cvs-serv31699/src/main/ca/ucalgary/services/util

Modified Files:
	XHTMLForm.java 
Added Files:
	MobySpecWrapper.java 
Log Message:
Moved a bunch of code common to all legacy wrapping configs to MobySpecWrapper
moby-live/Java/src/main/ca/ucalgary/services/util MobySpecWrapper.java,NONE,1.1 XHTMLForm.java,1.6,1.7
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java	2008/02/12 09:00:16	1.6
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java	2008/03/13 23:05:47	1.7
@@ -21,27 +21,13 @@
  * This allows us to wrap Web pages as Moby services using a similar mechanism to that
  * which wraps ACD-described command line tools such as EMBOSS programs.
  */
-public class XHTMLForm{
+public class XHTMLForm extends MobySpecWrapper{
 
     private static XPath xPath;
     private static DocumentBuilder docBuilder;
     private Document xhtmlDoc;
     private URL formURL;
     
-    private Map<String,String> serviceNames;
-    private String currentService;
-    private Map<String,String> serviceTypes;
-    private Map<String,String> serviceDescs;
-    private Map<String,String> providerURIs;
-    private Map<String,String> centralEndpoints;
-    private String contactEmail;
-
-    private Map<String,Map<String,String>> serviceInputs;
-    private Map<String,Map<String,String>> serviceInputFormats;
-    private Map<String,Map<String,String>> serviceSecondaries;
-    private Map<String,String[]> serviceOutputs;
-    private Map<String,Map<String,String>> fixedParams;
-
     private Map<String,List<String>> formFiles;
     private Map<String,String> formEncType;
     private Map<String,String> formAction;
@@ -102,17 +88,6 @@
     public XHTMLForm(URL url) throws Exception{
 	formURL = url;
 
-	serviceNames = new HashMap<String,String>();
-	currentService = "";
-	serviceTypes = new HashMap<String,String>();
-	serviceDescs = new HashMap<String,String>();
-	providerURIs = new HashMap<String,String>();
-	centralEndpoints = new HashMap<String,String>();
-	fixedParams = new HashMap<String,Map<String,String>>();
-	serviceInputs = new HashMap<String,Map<String,String>>();
-	serviceInputFormats = new HashMap<String,Map<String,String>>();
-	serviceSecondaries = new HashMap<String,Map<String,String>>();
-	serviceOutputs = new HashMap<String,String[]>();
 	formFiles = new HashMap<String,List<String>>();
 	formEncType = new HashMap<String,String>();
 	formAction = new HashMap<String,String>();
@@ -677,7 +652,7 @@
 
 	// The output datatype of the service is also declared in the form tag
 	List<String> outputSpecs = parseMobySpecs(serviceFormElement, mobyPrefix);
-	String[] cleanOutputSpecs = new String[outputSpecs.size()];
+	Map<String,String> cleanOutputSpecs = new HashMap<String,String>();
 	for(int i = 0; i < outputSpecs.size(); i++){
 	    String spec = outputSpecs.get(i);
 	    if(!outputSpecs.get(i).startsWith(serviceName+":")){
@@ -693,7 +668,17 @@
 				    ") not of the required form '"+mobyPrefix+":"+
 				    serviceName+":paramName:DataType'");
 	    }
-	    cleanOutputSpecs[i] = spec.substring(serviceName.length()+1);
+	    // The outputs have no existing names in the HTML/text/etc. output, 
+	    // so enforce that they be the same as the Moby param names 
+	    // (i.e. the stuff before the first colon in the moby param spec)
+	    String outParam = spec.substring(serviceName.length()+1);
+	    if(!outParam.contains(":")){
+		throw new Exception("The form for service '" + serviceName +
+				    "' contains moby specs (" + spec + 
+				    ") not of the required form '"+mobyPrefix+":"+
+				    serviceName+":paramName:DataType' (last colon missing)");
+	    }
+	    cleanOutputSpecs.put(outParam.substring(0, outParam.indexOf(":")), outParam);
 	}
 
 	setPrimaryOutputs(cleanOutputSpecs);
@@ -966,105 +951,6 @@
 	return optionsMap;
     }
 
-    public String[] getServiceNames(){
-	return providerURIs.keySet().toArray(new String[providerURIs.size()]);
-    }
-
-    public void setCurrentService(String serviceToReport) throws IllegalArgumentException{
-	currentService = serviceToReport;
-    }
-
-    public String getServiceName(){
-	return currentService;
-    }
-
-    public void setServiceType(String type){
-	serviceTypes.put(currentService, type);
-    }
-
-    public String getServiceType(){
-	return serviceTypes.get(currentService);
-    }
-
-    public void setServiceDesc(String desc){
-	serviceDescs.put(currentService, desc);
-    }
-
-    public String getServiceDesc(){
-	return serviceDescs.get(currentService);
-    }
-
-    public void setProviderURI(String uri){
-	providerURIs.put(currentService, uri);
-    }
-
-    public String getProviderURI(){
-	return providerURIs.get(currentService);
-    }
-
-    public void setCentralEndpoint(String ep){
-	centralEndpoints.put(currentService, ep);
-    }
-
-    public String getCentralEndpoint(){
-	return centralEndpoints.get(currentService);
-    }
-
-    public void setContactEmail(String email){
-	contactEmail = email;
-    }
-
-    public String getContactEmail(){
-	return contactEmail;
-    }
-
-    /**
-     * @param specs Map<cgi_param_name,mobyservlet_param_spec>, where mobyservlet_param_spec has an extra field at the end describing the text-type
-     */
-    public void setPrimaryInputs(Map<String,String> specs){
-	serviceInputs.put(currentService, specs);
-    }
-
-    public Map<String,String> getPrimaryInputs(){
-	return serviceInputs.get(currentService);
-    }
-
-    public void setPrimaryInputFormats(Map<String,String> specs){
-	serviceInputFormats.put(currentService, specs);
-    }
-
-    public Map<String,String> getPrimaryInputFormats(){
-	return serviceInputFormats.get(currentService);
-    }
-
-    public void setPrimaryOutputs(String[] specs){
-	serviceOutputs.put(currentService, specs);
-    }
-
-    public String[] getPrimaryOutputs(){
-	return serviceOutputs.get(currentService);
-    }
-
-    /**
-     * @param specs Map<cgi_param_name,mobyservlet_secondary_param_spec>
-     */
-    public void setSecondaryInputs(Map<String,String> specs){
-	serviceSecondaries.put(currentService, specs);
-    }
-
-    public Map<String,String> getSecondaryInputs(){
-	return serviceSecondaries.get(currentService);
-    }
-
-    // Note that the map is not cloned...
-    public void setFixedParams(Map<String,String> params){
-	fixedParams.put(currentService, params);
-    }
-
-    public Map<String,String> getFixedParams(){
-	return fixedParams.get(currentService);
-    }
-   
     // Note that the map is not cloned...
     public void setSubmitOptions(Map<String,String> options){
 	formSubmitOptions.put(currentService, options);




More information about the MOBY-guts mailing list