[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Tue Feb 12 01:03:39 UTC 2008
gordonp
Mon Feb 11 20:03:38 EST 2008
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util
In directory dev.open-bio.org:/tmp/cvs-serv9550/src/main/ca/ucalgary/services/util
Modified Files:
XHTMLForm.java
Log Message:
Moved legacy text format specs to their own Map in order to make primary input specs as MobyServlet annotations expect
moby-live/Java/src/main/ca/ucalgary/services/util XHTMLForm.java,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java 2008/02/07 20:03:26 1.3
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java 2008/02/12 01:03:38 1.4
@@ -37,6 +37,7 @@
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;
@@ -108,7 +109,8 @@
providerURIs = new HashMap<String,String>();
centralEndpoints = new HashMap<String,String>();
fixedParams = new HashMap<String,Map<String,String>>();
- serviceInputs = 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>>();
@@ -322,11 +324,12 @@
Map<String,String> submits = new HashMap<String,String>();
Map<String,String> images = new HashMap<String,String>();
Map<String,String[]> inputSpecs = new HashMap<String,String[]>();
+ Map<String,String> inputFormats = new HashMap<String,String>();
Map<String,String[]> secondarySpecs = new HashMap<String,String[]>();
for(int i = 0; i < formParams.getLength(); i++){
Element input = (Element) formParams.item(i);
String mobySpec = parseMobySpec(input, mobyPrefix);
- parseFormField(input, serviceName, mobySpec, inputSpecs, secondarySpecs, fixed, submits, images);
+ parseFormField(input, serviceName, mobySpec, inputSpecs, inputFormats, secondarySpecs, fixed, submits, images);
}
Map<String,String> inputSpecsAsStrings = new HashMap<String,String>();
Map<String,String> secondarySpecsAsStrings = new HashMap<String,String>();
@@ -345,6 +348,7 @@
}
setPrimaryInputs(inputSpecsAsStrings);
+ setPrimaryInputFormats(inputFormats);
setSecondaryInputs(secondarySpecsAsStrings);
setFixedParams(fixed);
setSubmitOptions(submits);
@@ -358,6 +362,7 @@
*/
protected void parseFormField(Element inputElement, String serviceName, String mobySpec,
Map<String,String[]> inputSpecs,
+ Map<String,String> inputFormats,
Map<String,String[]> secondarySpecs,
Map<String,String> fixed,
Map<String,String> submits,
@@ -484,7 +489,15 @@
"\" is used more than once in defining service \"" +
serviceName + "\"");
}
- inputSpecs.put(defaultSpec[0], specFields);
+ // Cleave off the last array item, the text format, and
+ // put it in another hash, as this is not part of the spec
+ // MobyServlet recognizes.
+ inputFormats.put(defaultSpec[0], specFields[specFields.length-1]);
+ String[] mobyServletSpecFields = new String[specFields.length-1];
+ for(int i = 0; i < mobyServletSpecFields.length; i++){
+ mobyServletSpecFields[i] = specFields[i];
+ }
+ inputSpecs.put(defaultSpec[0], mobyServletSpecFields);
}
// else it's a secondary, maybe with a fixed value (in which case
// it's set aside specially in fixedParams)
@@ -998,6 +1011,14 @@
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);
}
@@ -1110,12 +1131,12 @@
return formFiles.get(currentService);
}
- static String join(String delim, String[] array){
+ public static String join(String delim, String[] array){
StringBuffer sb = join(delim, array, new StringBuffer());
return sb.toString();
}
- static StringBuffer join(String delim, String[] array, StringBuffer sb){
+ public static StringBuffer join(String delim, String[] array, StringBuffer sb){
for(int i = 0; i < array.length; i++) {
if(i != 0){
sb.append(delim);
More information about the MOBY-guts
mailing list