From kawas at dev.open-bio.org Mon Feb 4 11:03:55 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 4 Feb 2008 11:03:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200802041603.m14G3ttq029563@dev.open-bio.org> kawas Mon Feb 4 11:03:55 EST 2008 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv29527/Docs/MOBY-S_API Modified Files: RegistryScripts.html Log Message: added the form for generating RDF for service instances to the doc. moby-live/Docs/MOBY-S_API RegistryScripts.html,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/RegistryScripts.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/RegistryScripts.html 2008/01/16 21:46:21 1.6 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/RegistryScripts.html 2008/02/04 16:03:55 1.7 @@ -173,6 +173,8 @@
For a form based page, click here.
+Generate RDF For Services - +Create RDF for any one service or group of services already registered in the registry.
++For a form based page, click here. +
+
Ping Registered Services - Invoke the service pinger on any already registered service or group of services from a single service provider.
From kawas at dev.open-bio.org Mon Feb 4 11:07:26 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 4 Feb 2008 11:07:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200802041607.m14G7PMJ029697@dev.open-bio.org> kawas Mon Feb 4 11:07:25 EST 2008 Update of /home/repository/moby/moby-live/Perl/scripts In directory dev.open-bio.org:/tmp/cvs-serv29662/Perl/scripts Modified Files: Moby Log Message: changed 'servlets' to read 'scripts' moby-live/Perl/scripts Moby,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/scripts/Moby,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/scripts/Moby 2008/02/04 16:04:20 1.4 +++ /home/repository/moby/moby-live/Perl/scripts/Moby 2008/02/04 16:07:25 1.5 @@ -225,7 +225,7 @@ -BioMOBY Registry Servlets
+BioMOBY Registry Scripts
RDF Agent Test - Invoke the RDF agent on the remote location that houses your RDF.
From mwilkinson at dev.open-bio.org Mon Feb 4 15:16:24 2008 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Mon, 4 Feb 2008 15:16:24 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200802042016.m14KGOUV030162@dev.open-bio.org> mwilkinson Mon Feb 4 15:16:24 EST 2008 Update of /home/repository/moby/moby-live/Perl In directory dev.open-bio.org:/tmp/cvs-serv30143 Modified Files: Makefile.PL Log Message: added template::toolkit to the requires in teh makefile to fix Pieters bug report moby-live/Perl Makefile.PL,1.32,1.33 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/Makefile.PL,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- /home/repository/moby/moby-live/Perl/Makefile.PL 2007/12/02 17:15:49 1.32 +++ /home/repository/moby/moby-live/Perl/Makefile.PL 2008/02/04 20:16:24 1.33 @@ -216,7 +216,8 @@ 'Crypt::OpenSSL::RSA' => '', 'XML::CanonicalizeXML' => 0.02, 'Sys::Hostname::Long' => '', - 'RDF::Core' => '.51', + 'RDF::Core' => '.51', + 'Template::Toolkit' => 2.19, # Sharable only used for isAlive script #'IPC::Shareable' => '0.6', #presence of this lib makes windows a no no ... #obtain from http://sourceforge.net/project/showfiles.php?group_id=130827 From gordonp at ucalgary.ca Mon Feb 4 17:15:10 2008 From: gordonp at ucalgary.ca (Paul Gordon) Date: Mon, 04 Feb 2008 15:15:10 -0700 Subject: [MOBY-guts] biomoby commit In-Reply-To: <200802042016.m14KGOUV030162@dev.open-bio.org> References: <200802042016.m14KGOUV030162@dev.open-bio.org> Message-ID: <47A78E6E.20909@ucalgary.ca> Hi Pieter, Looks from the CVS commits that Mark has already fixed this...you may want to do a CVS update. Mark Wilkinson wrote: > mwilkinson > Mon Feb 4 15:16:24 EST 2008 > Update of /home/repository/moby/moby-live/Perl > In directory dev.open-bio.org:/tmp/cvs-serv30143 > > Modified Files: > Makefile.PL > Log Message: > added template::toolkit to the requires in teh makefile to fix Pieters bug report > moby-live/Perl Makefile.PL,1.32,1.33 > =================================================================== > RCS file: /home/repository/moby/moby-live/Perl/Makefile.PL,v > retrieving revision 1.32 > retrieving revision 1.33 > diff -u -r1.32 -r1.33 > --- /home/repository/moby/moby-live/Perl/Makefile.PL 2007/12/02 17:15:49 1.32 > +++ /home/repository/moby/moby-live/Perl/Makefile.PL 2008/02/04 20:16:24 1.33 > @@ -216,7 +216,8 @@ > 'Crypt::OpenSSL::RSA' => '', > 'XML::CanonicalizeXML' => 0.02, > 'Sys::Hostname::Long' => '', > - 'RDF::Core' => '.51', > + 'RDF::Core' => '.51', > + 'Template::Toolkit' => 2.19, > # Sharable only used for isAlive script > #'IPC::Shareable' => '0.6', #presence of this lib makes windows a no no ... > #obtain from http://sourceforge.net/project/showfiles.php?group_id=130827 > > _______________________________________________ > MOBY-guts mailing list > MOBY-guts at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/moby-guts > > > From edward.kawas at gmail.com Mon Feb 4 17:40:43 2008 From: edward.kawas at gmail.com (Edward Kawas) Date: Mon, 4 Feb 2008 14:40:43 -0800 Subject: [MOBY-guts] biomoby commit In-Reply-To: <47A78E6E.20909@ucalgary.ca> References: <200802042016.m14KGOUV030162@dev.open-bio.org> <47A78E6E.20909@ucalgary.ca> Message-ID: <47a7946d.14b48c0a.7c94.ffffbffa@mx.google.com> But the makefile is for MoSeS and not really for the registry. I need to fix the actual cpan module. Looking back at the versions required for the dependencies to MoSeS, I need to make sure that the right modules are said to be required and used... Eddie -----Original Message----- From: moby-guts-bounces at lists.open-bio.org [mailto:moby-guts-bounces at lists.open-bio.org] On Behalf Of Paul Gordon Sent: February-04-08 2:15 PM To: Pieter Neerincx Cc: moby-guts at lists.open-bio.org Subject: Re: [MOBY-guts] biomoby commit Hi Pieter, Looks from the CVS commits that Mark has already fixed this...you may want to do a CVS update. Mark Wilkinson wrote: > mwilkinson > Mon Feb 4 15:16:24 EST 2008 > Update of /home/repository/moby/moby-live/Perl > In directory dev.open-bio.org:/tmp/cvs-serv30143 > > Modified Files: > Makefile.PL > Log Message: > added template::toolkit to the requires in teh makefile to fix Pieters bug report > moby-live/Perl Makefile.PL,1.32,1.33 > =================================================================== > RCS file: /home/repository/moby/moby-live/Perl/Makefile.PL,v > retrieving revision 1.32 > retrieving revision 1.33 > diff -u -r1.32 -r1.33 > --- /home/repository/moby/moby-live/Perl/Makefile.PL 2007/12/02 17:15:49 1.32 > +++ /home/repository/moby/moby-live/Perl/Makefile.PL 2008/02/04 20:16:24 1.33 > @@ -216,7 +216,8 @@ > 'Crypt::OpenSSL::RSA' => '', > 'XML::CanonicalizeXML' => 0.02, > 'Sys::Hostname::Long' => '', > - 'RDF::Core' => '.51', > + 'RDF::Core' => '.51', > + 'Template::Toolkit' => 2.19, > # Sharable only used for isAlive script > #'IPC::Shareable' => '0.6', #presence of this lib makes windows a no no ... > #obtain from http://sourceforge.net/project/showfiles.php?group_id=130827 > > _______________________________________________ > MOBY-guts mailing list > MOBY-guts at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/moby-guts > > > _______________________________________________ MOBY-guts mailing list MOBY-guts at lists.open-bio.org http://lists.open-bio.org/mailman/listinfo/moby-guts From mwilkinson at dev.open-bio.org Tue Feb 5 09:51:48 2008 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Tue, 5 Feb 2008 09:51:48 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200802051451.m15EpmvD032562@dev.open-bio.org> mwilkinson Tue Feb 5 09:51:48 EST 2008 Update of /home/repository/moby/moby-live/Perl In directory dev.open-bio.org:/tmp/cvs-serv32543 Modified Files: Makefile.PL Log Message: Template added moby-live/Perl Makefile.PL,1.33,1.34 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/Makefile.PL,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- /home/repository/moby/moby-live/Perl/Makefile.PL 2008/02/04 20:16:24 1.33 +++ /home/repository/moby/moby-live/Perl/Makefile.PL 2008/02/05 14:51:47 1.34 @@ -217,7 +217,7 @@ 'XML::CanonicalizeXML' => 0.02, 'Sys::Hostname::Long' => '', 'RDF::Core' => '.51', - 'Template::Toolkit' => 2.19, + 'Template' => 2.14, # Sharable only used for isAlive script #'IPC::Shareable' => '0.6', #presence of this lib makes windows a no no ... #obtain from http://sourceforge.net/project/showfiles.php?group_id=130827 From gordonp at dev.open-bio.org Wed Feb 6 11:00:58 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Feb 2008 11:00:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200802061600.m16G0wrh005214@dev.open-bio.org> gordonp Wed Feb 6 11:00:57 EST 2008 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util In directory dev.open-bio.org:/tmp/cvs-serv5178/src/main/ca/ucalgary/services/util Modified Files: XHTMLForm.java Log Message: Commit of XHTML form parsing that passes a the parsing test (logic test not done yet) moby-live/Java/src/main/ca/ucalgary/services/util XHTMLForm.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java 2008/01/29 19:11:10 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java 2008/02/06 16:00:57 1.2 @@ -289,6 +289,9 @@ for(int i = 0; i < formParams.getLength(); i++){ Element input = (Element) formParams.item(i); String mobySpec = parseMobySpec(input, mobyPrefix); + if(mobySpec != null && mobySpec.length() > mobyPrefix.length()+1){ + mobySpec = mobySpec.substring(mobyPrefix.length()+1); + } parseFormField(input, serviceName, mobySpec, inputSpecs, secondarySpecs, fixed, submits, images); } Map@@ -103,7 +102,7 @@inputSpecsAsStrings = new HashMap (); @@ -327,14 +330,6 @@ Map images) throws Exception{ - // if no spec or type is hidden, interpret as a secondary parameter to auto-configure - if(mobySpec == null || mobySpec.length() == 0){ - parseFormFieldDefault(inputElement, serviceName, secondarySpecs, fixed); - return; // next param, nothing else to config here... - } - - // If we get this far, there is a moby spec (we're not just using HTML defaults) - String[] specFields = mobySpec.split(":"); String[] defaultSpec = createDefaultSecondarySpec(inputElement, serviceName); if(defaultSpec == null){ return; // e.g. reset buttons ignored @@ -343,6 +338,18 @@ // See if a default value needs to be filled in anywhere boolean isRadioDefault = RADIO_DEFAULT_SENTINEL.equals(defaultSpec[3]); boolean isRadio = isRadioDefault || RADIO_SENTINEL.equals(defaultSpec[3]); + + // if no spec or type is hidden, interpret as a secondary parameter to auto-configure + // radios without sopecs are a special case, as they may have real specs + // in other input fields. + if(!isRadio && (mobySpec == null || mobySpec.length() == 0)){ + parseFormFieldDefault(inputElement, serviceName, secondarySpecs, fixed, submits, images); + return; // next param, nothing else to config here... + } + + // If we get this far, there is a moby spec (we're not just using HTML defaults) + // -1 means keep trailing blank values in split() + String[] specFields = mobySpec == null ? new String[4] : mobySpec.split(":", -1); for(int j = 0; j < defaultSpec.length && j < specFields.length; j++){ if(specFields[j] == null || specFields[j].length() == 0){ specFields[j] = defaultSpec[j]; @@ -356,11 +363,12 @@ // don't send this value, nor make it part of the moby params return; } - else if(specFields.length != 4){ + else if(specFields.length != 3 && specFields.length != 4){ throw new Exception("The moby parameter specification for form field \""+ - specFields[0]+"\" did not have any of the expected formats: " + - "moby:paramName:secondaryType:[value_range] " + - "moby:paramName:mobyDataType:textformat or moby:null"); + specFields[0]+"\" (" + mobySpec + + ") did not have any of the expected formats: " + + "moby:paramName:secondaryType:defaultValue:[value_range], " + + "moby:paramName:mobyDataType:textformat or moby:null"); } // submit buttons aren't like other params, handle them separately else if(defaultSpec[1].equals(SUBMIT_DATATYPE) || @@ -432,10 +440,8 @@ submits.put(specFields[0], specFields[2]); } } - // if spec says this is a primary param (i.e. last arg in spec - // isn't a range or enum of the form [...]) - else if(specFields[3] != null && specFields[3].length() > 0 && - !specFields[3].matches("\\[.*\\]")){ + // if spec says this is a primary param (i.e. only three args in spec) + else if(specFields.length == 3){ if(inputSpecs.containsKey(defaultSpec[0]) || secondarySpecs.containsKey(defaultSpec[0])){ throw new Exception("The parameter name \""+defaultSpec[0]+ @@ -469,7 +475,9 @@ } // else: ignore any other radio value, we're sticking with the fixed value } - else if(specFields[2] != null && specFields[2].length() > 0){ + // Did the user manually set a fixed value for the readio button? + else if(specFields[2] != null && specFields[2].length() > 0 && + !specFields[2].equals(defaultSpec[2])){ // first time we're fixing the radio param value to send fixed.put(defaultSpec[0], specFields[2]); secondarySpecs.remove(defaultSpec[0]); //in case we've encountered the radio earlier @@ -535,14 +543,31 @@ */ protected void parseFormFieldDefault(Element inputElement, String serviceName, Map secondarySpecs, - Map fixed) + Map fixed, + Map submits, + Map images) throws Exception{ String[] defaultSpec = createDefaultSecondarySpec(inputElement, serviceName); if(defaultSpec == null){ return; // e.g. reset button } - if(secondarySpecs.containsKey(defaultSpec[0])){ + + // The if/elses below direct the params accordingly depending on if + // the param is an image, a submit, a hidden, or other + if(SUBMIT_DATATYPE.equals(defaultSpec[1])){ + if(defaultSpec[2].equals(submits.get(defaultSpec[0]))){ + // TODO: how do we handle multiple submits with the same name but different values?? + } + submits.put(defaultSpec[0], defaultSpec[2]); + } + else if(IMAGE_DATATYPE.equals(defaultSpec[1])){ + if(defaultSpec[2].equals(images.get(defaultSpec[0]))){ + // TODO: how do we handle multiple submits with the same name but different values?? + } + images.put(defaultSpec[0], defaultSpec[2]); + } + else if(secondarySpecs.containsKey(defaultSpec[0])){ // Radio buttons are a funny case where the spec is // spread over multiple input elements. if(RADIO_SENTINEL.equals(defaultSpec[3]) || @@ -551,7 +576,7 @@ // append the value to the existing radio param value enumeration existingSpec[3] += ","+defaultSpec[2]; if(RADIO_DEFAULT_SENTINEL.equals(defaultSpec[3])){ - // we've been told this item os the default value for the radio + // we've been told this item is the default value for the radio existingSpec[2] = defaultSpec[2]; } } @@ -768,7 +793,7 @@ // use a special sentinel to denote this nameAttr = SUBMIT_ANONYMOUS_NAME; } - // submits with names will need to be handled specialluy by the caller + // submits with names will need to be handled specially by the caller dataType = SUBMIT_DATATYPE; } else if("hidden".equals(fieldType)){ From gordonp at dev.open-bio.org Wed Feb 6 11:00:58 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Feb 2008 11:00:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200802061600.m16G0wxf005228@dev.open-bio.org> gordonp Wed Feb 6 11:00:58 EST 2008 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test In directory dev.open-bio.org:/tmp/cvs-serv5178/src/main/ca/ucalgary/services/util/test Added Files: XHTMLFormTestCase.java osprey_pcr.html Log Message: Commit of XHTML form parsing that passes a the parsing test (logic test not done yet) moby-live/Java/src/main/ca/ucalgary/services/util/test XHTMLFormTestCase.java,NONE,1.1 osprey_pcr.html,NONE,1.1 From gordonp at dev.open-bio.org Thu Feb 7 15:03:27 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Feb 2008 15:03:27 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200802072003.m17K3RAD008951@dev.open-bio.org> gordonp Thu Feb 7 15:03:26 EST 2008 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util In directory dev.open-bio.org:/tmp/cvs-serv8915/src/main/ca/ucalgary/services/util Modified Files: XHTMLForm.java Log Message: Version of XHTMLForm and unit tests that pass parsing, meta-data and logic tests moby-live/Java/src/main/ca/ucalgary/services/util XHTMLForm.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java 2008/02/06 16:00:57 1.2 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/XHTMLForm.java 2008/02/07 20:03:26 1.3 @@ -34,7 +34,7 @@ private Map serviceDescs; private Map providerURIs; private Map centralEndpoints; - private Map contactEmails; + private String contactEmail; private Map > serviceInputs; private Map > serviceSecondaries; @@ -65,7 +65,7 @@ private final String MOBY_PREFIX_PLACEHOLDER = "%MOBYPREFIX%"; - private final String META_AUTHOR_XPATH = "/xhtml:html/xhtml:head/xhtml:meta[@name = \""+MOBY_PREFIX_PLACEHOLDER+":author\"]"; + private final String META_CONTACT_XPATH = "/xhtml:html/xhtml:head/xhtml:meta[@name = \""+MOBY_PREFIX_PLACEHOLDER+":contact\"]"; private final String META_SERVICE_XPATH = "/xhtml:html/xhtml:head/xhtml:meta[@name = \""+MOBY_PREFIX_PLACEHOLDER+":service\"]"; private final String SERVICE_SCHEME_ATTR = "scheme"; private final String SERVICE_SPEC_ATTR = "content"; @@ -107,7 +107,6 @@ serviceDescs = new HashMap (); providerURIs = new HashMap (); centralEndpoints = new HashMap (); - contactEmails = new HashMap (); fixedParams = new HashMap >(); serviceInputs = new HashMap >(); serviceSecondaries = new HashMap >(); @@ -150,12 +149,46 @@ } - protected List parseMetaData(String mobyPrefix) throws Exception{ - // Find the author info (email contact, or md5 hash of an address for privacy reasons) - String authorInfo = xPath.evaluate(META_AUTHOR_XPATH.replaceAll(MOBY_PREFIX_PLACEHOLDER, mobyPrefix), - xhtmlDoc); + protected String parseAuthorData(String mobyPrefix) throws Exception{ + String contactXPathString = META_CONTACT_XPATH.replaceAll(MOBY_PREFIX_PLACEHOLDER, mobyPrefix); + // Find the contact info (email contact, or md5 hash of an address for privacy reasons) + NodeList contactTags = (NodeList) xPath.evaluate(contactXPathString, + xhtmlDoc, + XPathConstants.NODESET); + if(contactTags.getLength() == 0){ + throw new Exception("Could not find any service author tags of the required form '" + + contactXPathString + "'"); + } + if(contactTags.getLength() > 1){ + throw new Exception("Found multiple (hence ambiguous) service author tags of the form '" + + contactXPathString + "'"); + } + Node contactElement = contactTags.item(0); + if(!(contactElement instanceof Element)){ + throw new Exception("The XPath to retrieve the service contact info '" + + contactXPathString + "' did not return an element as expected (" + + "got a " + contactElement.getClass().getName() + " instead)"); + } + + String contactInfo = ((Element) contactElement).getAttribute(SERVICE_SPEC_ATTR); + if(contactInfo == null || contactInfo.trim().length() == 0){ + throw new Exception("The service contact info is missing or blank in the HTML meta data headers" + + " (the XPath used was " + + contactXPathString + ")"); + } + contactInfo = contactInfo.trim(); + // Make sure it's an MD5 hash, or a real (probably qualified) SMTP e-mail format + if(!contactInfo.matches("[0-9a-f]{40}") && + !contactInfo.matches("\\S+@\\S+\\.\\S{2,}")){ + throw new Exception("The value of the service contact info (" + contactInfo + + " appears to be neither a qualified email address (e.g." + + " foo at bar.tld), nor an md5 hash of one"); + } + return contactInfo; + } + protected List parseMetaData(String mobyPrefix) throws Exception{ List serviceNames = new Vector (); NodeList serviceTags = (NodeList) xPath.evaluate(META_SERVICE_XPATH.replaceAll(MOBY_PREFIX_PLACEHOLDER, mobyPrefix), xhtmlDoc, @@ -173,6 +206,10 @@ } serviceNames.add(parseServiceTag((Element) serviceTag)); } + + // There can be only one contact email for the form, so this call is not in the loop + setContactEmail(parseAuthorData(mobyPrefix)); + return serviceNames; } @@ -220,7 +257,7 @@ throw new Exception(errorPrefix + " (serviceName was blank)"); } serviceName = serviceName.trim(); - String serviceDesc = firstColonIndex < spec.length()-1 ? spec.substring(firstColonIndex+1) : ""; + String serviceDesc = firstColonIndex < spec.length()-1 ? spec.substring(firstColonIndex+1).trim() : ""; currentService = serviceName; setCentralEndpoint(scheme); @@ -289,9 +326,6 @@ for(int i = 0; i < formParams.getLength(); i++){ Element input = (Element) formParams.item(i); String mobySpec = parseMobySpec(input, mobyPrefix); - if(mobySpec != null && mobySpec.length() > mobyPrefix.length()+1){ - mobySpec = mobySpec.substring(mobyPrefix.length()+1); - } parseFormField(input, serviceName, mobySpec, inputSpecs, secondarySpecs, fixed, submits, images); } Map inputSpecsAsStrings = new HashMap (); @@ -304,7 +338,7 @@ } for(Map.Entry spec: secondarySpecs.entrySet()){ String[] value = spec.getValue(); - if(value[3] != null && !value[3].matches("\\[.*\\]")){ + if(value[3] != null && value[3].length() > 0 && !value[3].matches("\\[.*\\]")){ value[3] = "["+value[3]+"]"; } secondarySpecsAsStrings.put(spec.getKey(), join(":", value)); @@ -361,6 +395,8 @@ // if spec says to ignore the value as a Moby parameter if(specFields.length == 1 && specFields[0].equals(NULL_NAME)){ // don't send this value, nor make it part of the moby params + // If it is a file type input, remove it from the form file list + removeFormFile(defaultSpec[0]); return; } else if(specFields.length != 3 && specFields.length != 4){ @@ -379,7 +415,7 @@ specFields[0]+"\" specifies an allowable data range of \"" + specFields[3]+"\", but submission parameters are only allowed " + "fixed values (in this case \"" + specFields[2] + "\"). Please " + - "remove the data range parameter in order top avoid a " + + "remove the data range parameter in order to avoid a " + "conflicting specification."); } if(specFields[1] != null && specFields[1].length() > 0 && @@ -475,7 +511,7 @@ } // else: ignore any other radio value, we're sticking with the fixed value } - // Did the user manually set a fixed value for the readio button? + // Did the user manually set a fixed value for the radio button? else if(specFields[2] != null && specFields[2].length() > 0 && !specFields[2].equals(defaultSpec[2])){ // first time we're fixing the radio param value to send @@ -495,11 +531,12 @@ "Moby specs as \"" + existingSpec[0] + "\" and \"" + specFields[0]); } - // otherwise it's the default name maintained, // or we're renaming for the first time - if(!existingSpec[0].equals(specFields[0])){ + else if(existingSpec[0].equals(defaultSpec[0]) && !existingSpec[0].equals(specFields[0])){ existingSpec[0] = specFields[0]; } + // otherwise it's the default name maintained + if(isRadioDefault){ //we've been told this item is the default value existingSpec[2] = specFields[2]; } @@ -558,6 +595,8 @@ if(SUBMIT_DATATYPE.equals(defaultSpec[1])){ if(defaultSpec[2].equals(submits.get(defaultSpec[0]))){ // TODO: how do we handle multiple submits with the same name but different values?? + System.err.println("Overriding submit with same name but with new different value: " + + defaultSpec[0] + ", " + defaultSpec[2]); } submits.put(defaultSpec[0], defaultSpec[2]); } @@ -607,8 +646,26 @@ // The output datatype of the service is also declared in the form tag List outputSpecs = parseMobySpecs(serviceFormElement, mobyPrefix); + String[] cleanOutputSpecs = new String[outputSpecs.size()]; + for(int i = 0; i < outputSpecs.size(); i++){ + String spec = outputSpecs.get(i); + if(!outputSpecs.get(i).startsWith(serviceName+":")){ + throw new Exception("The form for service '" + serviceName + + "' also contains moby specs (" + spec + + ") not of the required form '"+mobyPrefix+":"+ + serviceName+":paramName:DataType'. " + + "You can only specify one service per form."); + } + if(spec.length() < serviceName.length()+4){ + throw new Exception("The form for service '" + serviceName + + "' contains moby specs (" + spec + + ") not of the required form '"+mobyPrefix+":"+ + serviceName+":paramName:DataType'"); + } + cleanOutputSpecs[i] = spec.substring(serviceName.length()+1); + } - setPrimaryOutputs(outputSpecs.toArray(new String[outputSpecs.size()])); + setPrimaryOutputs(cleanOutputSpecs); String encType = URLENCODED; // This is the default XHTML value setFormEncodingType(encType); @@ -670,8 +727,8 @@ } for(String classSpec: classSpecs.split("\\s")){ String[] classParts = classSpec.split(":"); - if(classParts[0].equals(mobyPrefix)){ - mobySpecs.add(classSpec); + if(classParts.length > 1 && classParts[0].equals(mobyPrefix)){ + mobySpecs.add(classSpec.substring(mobyPrefix.length()+1)); } } @@ -807,20 +864,24 @@ addFormFile(nameAttr); } - // Try to parse the default value multiple ways - dataType = MobyTags.MOBYINTEGER; - - try{new BigInteger(valueAttr); - }catch(Exception e){ - dataType = MobyTags.MOBYFLOAT;} - - try{new BigDecimal(valueAttr); - }catch(Exception e){ - dataType = MobyTags.MOBYDATETIME;} - - try{MobyDataDateTime.parseISO8601(valueAttr); - }catch(Exception e){ - dataType = MobyTags.MOBYSTRING;} + if(valueAttr != null && valueAttr.length() > 0){ + + // Try to parse the default value multiple ways + dataType = MobyTags.MOBYINTEGER; + + try{new BigInteger(valueAttr); + }catch(Exception e){ + dataType = MobyTags.MOBYFLOAT;} + + try{new BigDecimal(valueAttr); + }catch(Exception e){ + dataType = MobyTags.MOBYDATETIME;} + + try{MobyDataDateTime.parseISO8601(valueAttr); + }catch(Exception e){ + dataType = MobyTags.MOBYSTRING;} + } + //else we keep the default of MobyTags.MOBYSTRING } return new String[]{nameAttr, dataType, valueAttr, range}; @@ -861,7 +922,7 @@ } String selAttr = option.getAttributeNS(MobyPrefixResolver.XHTML_NAMESPACE, "selected"); - if(selAttr == null){ + if(selAttr == null || selAttr.length() == 0){ selAttr = option.getAttribute("selected"); } if(selAttr != null && selAttr.length() > 0 && !"0".equals(selAttr) && !"false".equals(selAttr)){ @@ -919,11 +980,11 @@ } public void setContactEmail(String email){ - contactEmails.put(currentService, email); + contactEmail = email; } public String getContactEmail(){ - return contactEmails.get(currentService); + return contactEmail; } /** @@ -981,7 +1042,7 @@ // Note that the map is not cloned... public void setImageOptions(Map options){ - formSubmitOptions.put(currentService, options); + formImageOptions.put(currentService, options); } /** @@ -1036,6 +1097,12 @@ formFiles.get(currentService).add(paramName); } + public void removeFormFile(String paramName){ + if(currentService != null && formFiles.containsKey(currentService)){ + formFiles.get(currentService).remove(paramName); + } + } + /** * @return the list of input parameters (primary and/or secondary) that should be submitted in "file" style */ From gordonp at dev.open-bio.org Thu Feb 7 15:03:27 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Feb 2008 15:03:27 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200802072003.m17K3RUq008975@dev.open-bio.org> gordonp Thu Feb 7 15:03:27 EST 2008 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test In directory dev.open-bio.org:/tmp/cvs-serv8915/src/main/ca/ucalgary/services/util/test Modified Files: XHTMLFormTestCase.java osprey_pcr.html Log Message: Version of XHTMLForm and unit tests that pass parsing, meta-data and logic tests moby-live/Java/src/main/ca/ucalgary/services/util/test XHTMLFormTestCase.java,1.1,1.2 osprey_pcr.html,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/XHTMLFormTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/XHTMLFormTestCase.java 2008/02/06 16:00:58 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/XHTMLFormTestCase.java 2008/02/07 20:03:27 1.2 @@ -9,11 +9,213 @@ public class XHTMLFormTestCase extends TestCase{ private final static String XHTMLFORM_RESOURCE = "ca/ucalgary/services/util/test/osprey_pcr.html"; + // meta-data tests + private final static String SERVICE_CATEGORY = "Primers"; + private final static String SERVICE_PROVIDER = "moby.ucalgary.ca"; + private final static String SERVICE_NAME = "CalcPCRPrimers"; + private final static String SERVICE_DESC = "Takes a DNA sequence and calculates PCR probes satisfying a given set of conditions"; + private final static String SERVICE_CONTACT = "096ff557f644d44fc6f40043b4bfffa24445c0d4"; + private final static String CENTRAL_ENDPOINT = "http://moby.ucalgary.ca/moby/MOBY-Central.pl"; + + // cardinality tests + private final static int NUM_SERVICES = 1; + private final static int NUM_PRIMARY_INPUTS = 1; + private final static int NUM_SECONDARY_INPUTS = 17; + private final static int NUM_FIXED_INPUTS = 1; + private final static int NUM_OUTPUTS = 1; + private final static int NUM_SUBMITS = 2; + private final static int NUM_IMAGES = 0; //TODO other form tests, incl. images and checkboxes + private final static int NUM_FILES = 0;// there are 3 in the form, but class="moby:null" is set for all of them + + // param spec tests + // primary + private final static String inputHTMLParamName = "input_text"; + private final static String inseq = "inseq:DNASequence:fasta"; //TODO: should we keep the fasta part in another map? + private final static String primers = "primers:Collection(DNASequence)"; + // secondary + private final static String bias = "product_bias:String:3:[5,3]"; + private final static String dimer_delta_g_max = "dimer_delta_g_max:String:auto (GC% & length based):[auto (GC% & length based),10,11,12,13,14,15,16,17,18]"; + private final static String dna_conc = "dna_conc:Float:0.0002:[0,1]"; + private final static String hairpin_delta_g_max = "hairpin_delta_g_max:String:auto (GC% & length based):[auto (GC% & length based),10,11,12,13,14,15,16,17,18]"; + private final static String interval = "interval:String::"; + private final static String max_prod_len = "MaximumProductLength:Integer:1000:[1,]"; + private final static String melt_temp_diff = "melt_temp_diff:String:2:[0,1,2,3,4,5]"; + private final static String melt_temp_max = "melt_temp_max:String:60:[40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70]"; + private final static String melt_temp_min = "melt_temp_min:String:54:[40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70]"; + private final static String min_prod_len = "MinimumProductLength:Integer:100:[1,]"; + private final static String oligo_length_max = "oligo_length_max:String:23:[15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]"; + private final static String oligo_length_min = "oligo_length_min:String:18:[15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]"; + private final static String oligo_length_opt = "oligo_length_opt:String:auto (min/max enforced):[auto (min/max enforced),15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]"; + private final static String opt_prod_len = "OptimalProductLength:Integer:600:[1,]"; + private final static String salt_conc = "salt_conc:Float:0.05:[0,10]"; + private final static String secondary_delta_g_max = "secondary_delta_g_max:String:auto (based on temp margin):[auto (based on temp margin),10,11,12,13,14,15,16,17,18,19,20]"; + private final static String secondary_melt_margin = "secondary_melt_margin:String:8:[5,6,7,8,9,10,11,12,13,14,15]"; + // fixed + private final static String foo = "bar"; + public XHTMLFormTestCase(String name){ super(name); } + /** + * See if the xhtml and moby spec class values are properly parsed + */ public void testParsingBasic(){ + loadForm(); + } + + /** + * See if the meta data for the service is parsed correctly + */ + public void testMetaData(){ + XHTMLForm form = loadForm(); + assertTrue("The service type (" + form.getServiceType() + + ") was not as expected (" + SERVICE_CATEGORY + ")", + SERVICE_CATEGORY.equals(form.getServiceType())); + assertTrue("The service provider URI (" + form.getProviderURI() + + ") was not as expected (" + SERVICE_PROVIDER + ")", + SERVICE_PROVIDER.equals(form.getProviderURI())); + assertTrue("The service contact (" + form.getContactEmail() + + ") was not as expected (" + SERVICE_CONTACT + ")", + SERVICE_CONTACT.equals(form.getContactEmail())); + assertTrue("The service contact (" + form.getServiceDesc() + + ") was not as expected (" + SERVICE_DESC + ")", + SERVICE_DESC.equals(form.getServiceDesc())); + assertTrue("The central endpoint (" + form.getCentralEndpoint() + + ") was not as expected (" + CENTRAL_ENDPOINT + ")", + CENTRAL_ENDPOINT.equals(form.getCentralEndpoint())); + } + + /** + * See if the values for the parameters are correctly noted (i.e. rules of + * overriding and defaults are properly applied when combining the HTML spec and + * the Moby spec). + */ + public void testLogic(){ + XHTMLForm form = loadForm(); + String[] serviceNames = form.getServiceNames(); + assertTrue("The number of services defined (" + serviceNames.length + + ") was not as expected (" + NUM_SERVICES + ")", + NUM_SERVICES == serviceNames.length); + + // Check the Moby-facing specs + Map primaryInputs = form.getPrimaryInputs(); + assertTrue("The number of primary input parameters defined (" + primaryInputs.size() + + ") was not as expected (" + NUM_PRIMARY_INPUTS + ")", + NUM_PRIMARY_INPUTS == primaryInputs.size()); + + Map secondaryInputs = form.getSecondaryInputs(); + + assertTrue("The number of secondary input parameters defined (" + secondaryInputs.size() + + ") was not as expected (" + NUM_SECONDARY_INPUTS + ")", + NUM_SECONDARY_INPUTS == secondaryInputs.size()); + + String[] outputs = form.getPrimaryOutputs(); + assertTrue("The number of primary output parameters defined (" + outputs.length + + ") was not as expected (" + NUM_OUTPUTS + ")", + NUM_OUTPUTS == outputs.length); + + // Check the HTML-specific specs + Map fixedParams = form.getFixedParams(); + assertTrue("The number of fixed HTML parameters defined (" + fixedParams.size() + + ") was not as expected (" + NUM_FIXED_INPUTS + ")", + NUM_FIXED_INPUTS == fixedParams.size()); + + Map submitParams = form.getSubmitOptions(); + assertTrue("The number of submit parameters defined (" + submitParams.size() + + ") was not as expected (" + NUM_SUBMITS + ")", + NUM_SUBMITS == submitParams.size()); + + Map imageParams = form.getImageOptions(); + assertTrue("The number of image parameters defined (" + imageParams.size() + + ") was not as expected (" + NUM_IMAGES + ")", + NUM_IMAGES == imageParams.size()); + + List fileParams = form.getFormFiles(); + assertTrue("The number of file parameters defined (" + fileParams.size() + + ") was not as expected (" + NUM_FILES + ")", + NUM_FILES == fileParams.size()); + + // Check that the parameter values are okay + assertTrue("The value of the primary parameter 'inseq' (" + + primaryInputs.get(inputHTMLParamName) + ") was not the expected value '" + + inseq + "'", + inseq.equals(primaryInputs.get(inputHTMLParamName))); + assertTrue("The value of the output parameter 'primers' (" + + outputs[0] + ") was not the expected value '" + + primers + "'", + primers.equals(outputs[0])); + + assertTrue("The value of the secondary parameter 'bias' (" + + secondaryInputs.get("bias") + ") was not the expected value '" + bias + "'", + bias.equals(secondaryInputs.get("bias"))); + assertTrue("The value of the secondary parameter 'dimer_delta_g_max' (" + + secondaryInputs.get("dimer_delta_g_max") + ") was not the expected value '" + + dimer_delta_g_max + "'", + dimer_delta_g_max.equals(secondaryInputs.get("dimer_delta_g_max"))); + assertTrue("The value of the secondary parameter 'dna_conc' (" + + secondaryInputs.get("dna_conc") + ") was not the expected value '" + + dna_conc + "'", + dna_conc.equals(secondaryInputs.get("dna_conc"))); + assertTrue("The value of the secondary parameter 'hairpin_delta_g_max' " + + secondaryInputs.get("hairpin_delta_g_max") + ") was not the expected value '" + + hairpin_delta_g_max + "'", + hairpin_delta_g_max.equals(secondaryInputs.get("hairpin_delta_g_max"))); + assertTrue("The value of the secondary parameter 'interval' (" + secondaryInputs.get("interval") + + ") was not the expected value '" + interval + "'", + interval.equals(secondaryInputs.get("interval"))); + assertTrue("The value of the secondary parameter 'max_prod_len' (" + + secondaryInputs.get("max_prod_len") + ") was not the expected value '" + + max_prod_len + "'", + max_prod_len.equals(secondaryInputs.get("max_prod_len"))); + assertTrue("The value of the secondary parameter 'melt_temp_diff' (" + + secondaryInputs.get("melt_temp_diff") + ") was not the expected value '" + + melt_temp_diff + "'", + melt_temp_diff.equals(secondaryInputs.get("melt_temp_diff"))); + assertTrue("The value of the secondary parameter 'melt_temp_max' (" + + secondaryInputs.get("melt_temp_max") + ") was not the expected value '" + + melt_temp_max + "'", + melt_temp_max.equals(secondaryInputs.get("melt_temp_max"))); + assertTrue("The value of the secondary parameter 'melt_temp_min' (" + + secondaryInputs.get("melt_temp_min") + ") was not the expected value '" + + melt_temp_min + "'", + melt_temp_min.equals(secondaryInputs.get("melt_temp_min"))); + assertTrue("The value of the secondary parameter 'min_prod_len' (" + + secondaryInputs.get("min_prod_len") + ") was not the expected value '" + + min_prod_len + "'", + min_prod_len.equals(secondaryInputs.get("min_prod_len"))); + assertTrue("The value of the secondary parameter 'oligo_length_max' (" + + secondaryInputs.get("oligo_length_max") + ") was not the expected value '" + + oligo_length_max + "'", + oligo_length_max.equals(secondaryInputs.get("oligo_length_max"))); + assertTrue("The value of the secondary parameter 'oligo_length_min' (" + + secondaryInputs.get("oligo_length_min") + ") was not the expected value '" + + oligo_length_min + "'", + oligo_length_min.equals(secondaryInputs.get("oligo_length_min"))); + assertTrue("The value of the secondary parameter 'oligo_length_opt' (" + + secondaryInputs.get("oligo_length_opt") + ") was not the expected value '" + + oligo_length_opt + "'", + oligo_length_opt.equals(secondaryInputs.get("oligo_length_opt"))); + assertTrue("The value of the secondary parameter 'opt_prod_len' (" + + secondaryInputs.get("opt_prod_len") + ") was not the expected value '" + + opt_prod_len + "'", + opt_prod_len.equals(secondaryInputs.get("opt_prod_len"))); + assertTrue("The value of the secondary parameter 'salt_conc' (" + + secondaryInputs.get("salt_conc") + ") was not the expected value '" + + salt_conc + "'", + salt_conc.equals(secondaryInputs.get("salt_conc"))); + assertTrue("The value of the secondary parameter 'secondary_delta_g_max' (" + + secondaryInputs.get("secondary_delta_g_max") + ") was not the expected value '" + + secondary_delta_g_max + "'", + secondary_delta_g_max.equals(secondaryInputs.get("secondary_delta_g_max"))); + assertTrue("The value of the secondary parameter 'secondary_melt_margin' (" + + secondaryInputs.get("secondary_melt_margin") + ") was not the expected value '" + + secondary_melt_margin + "'", + secondary_melt_margin.equals(secondaryInputs.get("secondary_melt_margin"))); + + } + + private XHTMLForm loadForm(){ URL u = getClass().getClassLoader().getResource(XHTMLFORM_RESOURCE); assertNotNull("Could not find the test HTML form resource ("+XHTMLFORM_RESOURCE+")", u); @@ -23,7 +225,9 @@ } catch(Exception e){ e.printStackTrace(); fail("Could not load and parse the test input resource ("+u+"): " + e); - } + } + + return form; } /** @@ -33,6 +237,8 @@ TestSuite suite = new TestSuite(); suite.addTest(new XHTMLFormTestCase("testParsingBasic")); + suite.addTest(new XHTMLFormTestCase("testMetaData")); + suite.addTest(new XHTMLFormTestCase("testLogic")); return suite; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/osprey_pcr.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/osprey_pcr.html 2008/02/06 16:00:58 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/util/test/osprey_pcr.html 2008/02/07 20:03:27 1.2 @@ -7,7 +7,7 @@ - Osprey: PCR Product Oligo Design Calculation Form @@ -37,7 +37,8 @@ described here. -Eddie Kawas=================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ConfigureRDFAgent.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/docs/ConfigureRDFAgent.html 2007/09/11 16:48:27 1.4 +++ /home/repository/moby/moby-live/Java/docs/ConfigureRDFAgent.html 2008/02/14 06:13:34 1.5 @@ -48,20 +48,10 @@
-Last modified: Wed May 25 10:50:58 2005 +Last modified: Thu Feb 14 15:05:58 2008
You can build the latest RDFAgent from the cvs. - --
+- on a unix box,
---/moby-live/Java/build.sh bindist_rdfagent
-+ant bindist-rdfagent
+-
- on a windows box -
---/moby-live/Java/build.bat bindist_rdfagent
-The newly created archive will be placed at /moby-live/Java/docs/dist/, with the filename 'rdfagent-yyyy-mm-dd.zip' or 'rdfagent-yyyy-mm-dd.tar.gz'
@@ -493,8 +483,8 @@ Edward Kawas
- Last modified: Tue May 17 15:49:04 2005 - +Last modified: Thu Feb 14 15:07:15 2008 +$Date$
=================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Dashboard.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/docs/Dashboard.html 2006/10/02 21:12:45 1.7 +++ /home/repository/moby/moby-live/Java/docs/Dashboard.html 2008/02/14 06:13:34 1.8 @@ -51,7 +51,7 @@@@ -69,7 +69,7 @@-./build-dev.sh dashboard +ant dashboard@@ -118,7 +118,7 @@-build-dev.bat dashboard +ant dashboard@@ -303,7 +303,7 @@-./build-dev.sh docs +ant docs@@ -352,7 +352,7 @@-./build-dev.sh dashboard +ant dashboardMartin Senger
-Last modified: Mon Oct 2 22:09:01 2006 +Last modified: Thu Feb 14 15:02:09 2008