public class UIinfo
{
+ public String getAction()
+ {
+ return Action;
+ }
+
+ public void setAction(String action)
+ {
+ Action = action;
+ }
+
+ public String getName()
+ {
+ return Name;
+ }
+
+ public void setName(String name)
+ {
+ Name = name;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
String Action;
String Name;
public UIinfo details = new UIinfo();
+ public String getAction()
+ {
+ return details.getAction();
+ }
+
+ public void setAction(String action)
+ {
+ details.setAction(action);
+ }
+
+ public String getName()
+ {
+ return details.getName();
+ }
+
+ public void setName(String name)
+ {
+ details.setName(name);
+ }
+
+ public String getDescription()
+ {
+ return details.getDescription();
+ }
+
+ public void setDescription(String description)
+ {
+ details.setDescription(description);
+ }
+
/**
* Service base URL
*/
String postUrl;
+ public String getPostUrl()
+ {
+ return postUrl;
+ }
+
+ public void setPostUrl(String postUrl)
+ {
+ this.postUrl = postUrl;
+ }
+
+ public String getUrlSuffix()
+ {
+ return urlSuffix;
+ }
+
+ public void setUrlSuffix(String urlSuffix)
+ {
+ this.urlSuffix = urlSuffix;
+ }
+
+ public Map<String, InputType> getInputParams()
+ {
+ return inputParams;
+ }
+
+ public void setInputParams(Map<String, InputType> inputParams)
+ {
+ this.inputParams = inputParams;
+ }
+
+ public void setHseparable(boolean hseparable)
+ {
+ this.hseparable = hseparable;
+ }
+
+ public void setVseparable(boolean vseparable)
+ {
+ this.vseparable = vseparable;
+ }
+
+ public void setGapCharacter(char gapCharacter)
+ {
+ this.gapCharacter = gapCharacter;
+ }
+
/**
* suffix that should be added to any url used if it does not already end in
* the suffix.
/**
* input info given as key/value pairs - mapped to post arguments
*/
- Map<String, InputType> inputParams = new HashMap();
+ Map<String, InputType> inputParams = new HashMap<String,InputType>();
/**
* assigns the given inputType it to its corresponding input parameter token
public RestServiceDescription(RestServiceDescription toedit)
{
+ // Rather then do the above, we cheat and use our human readable serialization code to clone everything
+ this(toedit.toString());
+ /**
if (toedit == null)
{
return;
}
- // TODO Implement copy constructor NOW
+ /**
+ urlSuffix = toedit.urlSuffix;
+ postUrl = toedit.postUrl;
+ hseparable = toedit.hseparable;
+ vseparable = toedit.vseparable;
+ gapCharacter = toedit.gapCharacter;
+ details = new RestServiceDescription.UIinfo();
+ details.Action = toedit.details.Action;
+ details.description = toedit.details.description;
+ details.Name = toedit.details.Name;
+ for (InputType itype: toedit.inputParams.values())
+ {
+ inputParams.put(itype.token, itype.clone());
+
+ }
+
+ */
+ // TODO Implement copy constructor NOW*/
}
/**
int cp = 0, pos, escape;
boolean wasescaped = false;
String lstitem = null;
- while ((pos = list.indexOf(separator, cp)) > cp)
+ while ((pos = list.indexOf(separator, cp)) >= cp)
{
escape = (list.charAt(pos - 1) == '\\') ? -1 : 0;
if (wasescaped)
}
if (prop.equals("returns"))
{
- _configureOurputFormatFrom(val, warnings);
+ _configureOutputFormatFrom(val, warnings);
}
}
}
return buff;
}
- private void _configureOurputFormatFrom(String outstring,
+ private void _configureOutputFormatFrom(String outstring,
StringBuffer warnings)
{
+ if (outstring.indexOf(";")==-1) {
+ // we add a token, for simplicity
+ outstring = outstring+";";
+ }
StringTokenizer st = new StringTokenizer(outstring, ";");
String tok = "";
resultData = new ArrayList<JvDataType>();
iprmparams = iprm.substring(colon + 1);
iprm = iprm.substring(0, colon);
}
- // TODO - find a better way of maintaining this classlist
- for (Class type : new Class[]
- { jalview.ws.rest.params.Alignment.class,
- jalview.ws.rest.params.AnnotationFile.class,
- SeqGroupIndexVector.class,
- jalview.ws.rest.params.SeqIdVector.class,
- jalview.ws.rest.params.SeqVector.class,
- jalview.ws.rest.params.Tree.class })
- {
- try
- {
- jinput = (InputType) (type.getConstructor().newInstance(null));
- if (iprm.equalsIgnoreCase(jinput.getURLtokenPrefix()))
- {
- ArrayList<String> al = new ArrayList<String>();
- for (String prprm : separatorListToArray(iprmparams, ","))
- {
- al.add(prprm);
- }
- if (!jinput.configureFromURLtokenString(al, warnings))
- {
- valid = false;
- warnings.append("Failed to parse '" + prms.group(0)
- + "' as a " + jinput.getURLtokenPrefix()
- + " input tag.\n");
- }
- else
- {
- jinput.token = tok;
- iparams.put(tok, jinput);
- }
- break;
- }
-
- } catch (Throwable thr)
- {
- }
- ;
- }
+ valid = parseTypeString(prms.group(0), tok, iprm, iprmparams, iparams, warnings);
}
if (valid)
{
return valid;
}
+ public static boolean parseTypeString(String fullstring, String tok, String iprm, String iprmparams,
+ Map<String, InputType> iparams, StringBuffer warnings)
+ {
+ boolean valid=true;
+ InputType jinput;
+ // TODO - find a better way of maintaining this classlist
+ for (Class type : new Class[]
+ { jalview.ws.rest.params.Alignment.class,
+ jalview.ws.rest.params.AnnotationFile.class,
+ SeqGroupIndexVector.class,
+ jalview.ws.rest.params.SeqIdVector.class,
+ jalview.ws.rest.params.SeqVector.class,
+ jalview.ws.rest.params.Tree.class })
+ {
+ try
+ {
+ jinput = (InputType) (type.getConstructor().newInstance(null));
+ if (iprm.equalsIgnoreCase(jinput.getURLtokenPrefix()))
+ {
+ ArrayList<String> al = new ArrayList<String>();
+ for (String prprm : separatorListToArray(iprmparams, ","))
+ {
+ al.add(prprm.trim());
+ }
+ if (!jinput.configureFromURLtokenString(al, warnings))
+ {
+ valid = false;
+ warnings.append("Failed to parse '" + fullstring
+ + "' as a " + jinput.getURLtokenPrefix()
+ + " input tag.\n");
+ }
+ else
+ {
+ jinput.token = tok;
+ iparams.put(tok, jinput);
+ valid=true;
+ }
+ break;
+ }
+
+ } catch (Throwable thr)
+ {
+ }
+ ;
+ }
+ return valid;
+ }
+
+
public static void main(String argv[])
{
if (argv.length == 0)
{
return resultData;
}
+
}