From gordonp at dev.open-bio.org Mon Dec 4 17:12:13 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 4 Dec 2006 17:12:13 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612042212.kB4MCD6l016671@dev.open-bio.org> gordonp Mon Dec 4 17:12:12 EST 2006 Update of /home/repository/moby/jars-archive/current In directory dev.open-bio.org:/tmp/cvs-serv16636 Modified Files: MobyServlet.war Log Message: First try of new automated MobyServlet WAR construction methodology jars-archive/current MobyServlet.war,1.6,1.7 =================================================================== RCS file: /home/repository/moby/jars-archive/current/MobyServlet.war,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 Binary files /home/repository/moby/jars-archive/current/MobyServlet.war 2006/11/21 19:11:23 1.6 and /home/repository/moby/jars-archive/current/MobyServlet.war 2006/12/04 22:12:12 1.7 differ rcsdiff: /home/repository/moby/jars-archive/current/MobyServlet.war: diff failed From gordonp at dev.open-bio.org Mon Dec 4 17:30:49 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 4 Dec 2006 17:30:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612042230.kB4MUnZE016827@dev.open-bio.org> gordonp Mon Dec 4 17:30:49 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util In directory dev.open-bio.org:/tmp/cvs-serv16792/src/main/ca/ucalgary/seahawk/util Modified Files: MinJarMaker.java Log Message: Added check for extra resources (non-pattern), not just classes moby-live/Java/src/main/ca/ucalgary/seahawk/util MinJarMaker.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MinJarMaker.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/seahawk/util/MinJarMaker.java 2006/11/23 19:28:58 1.3 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MinJarMaker.java 2006/12/04 22:30:49 1.4 @@ -456,9 +456,12 @@ e.printStackTrace(); } if(classBytes == null){ - System.err.println("Could not find the specified extra class: " + - classPathElement); - continue; + URL u = findResource(classPathElement); + if(u == null){ + System.err.println("Could not find the specified extra class: " + + classPathElement); + continue; + } } classes.add(classPathElement); } From gordonp at dev.open-bio.org Mon Dec 4 17:33:50 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 4 Dec 2006 17:33:50 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612042233.kB4MXo76016950@dev.open-bio.org> gordonp Mon Dec 4 17:33:50 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service In directory dev.open-bio.org:/tmp/cvs-serv16919/src/main/org/biomoby/service Added Files: mobyService.java Log Message: Annotation class used in MobyServlet-style service creation moby-live/Java/src/main/org/biomoby/service mobyService.java,NONE,1.1 From senger at dev.open-bio.org Tue Dec 5 12:18:16 2006 From: senger at dev.open-bio.org (Martin Senger) Date: Tue, 5 Dec 2006 12:18:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612051718.kB5HIGP3019480@dev.open-bio.org> senger Tue Dec 5 12:18:15 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv19461/src/Perl/MOSES/MOBY/Cache Modified Files: Registries.pm Log Message: MIPS registry removed moby-live/Java/src/Perl/MOSES/MOBY/Cache Registries.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Registries.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Registries.pm 2006/10/13 21:51:16 1.1 +++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Registries.pm 2006/12/05 17:18:15 1.2 @@ -37,11 +37,6 @@ public => 'yes', text => 'The MOBY registry at the International Rice Research Institute (IRRI) is intended mostly for Generation Challenge Program (GCP) developers. It allows the registration of experimental moby entities within GCP.', }, - MIPS => { endpoint => 'http://mips.gsf.de/cgi-bin/proj/planet/moby/MOBY-Central.pl', - namespace => 'http://mips.gsf.de/MOBY/Central', - name => 'MIPS, Germany', - contact => 'Dirk Haase (d.haase at gsf.de)', - }, testing => { endpoint => 'http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl', namespace => 'http://bioinfo.icapture.ubc.ca/MOBY/Central', name => 'Testing BioMoby registry', From senger at dev.open-bio.org Tue Dec 5 12:18:16 2006 From: senger at dev.open-bio.org (Martin Senger) Date: Tue, 5 Dec 2006 12:18:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612051718.kB5HIGrt019498@dev.open-bio.org> senger Tue Dec 5 12:18:16 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta In directory dev.open-bio.org:/tmp/cvs-serv19461/src/main/org/biomoby/registry/meta Modified Files: RegistriesList.java Log Message: MIPS registry removed moby-live/Java/src/main/org/biomoby/registry/meta RegistriesList.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta/RegistriesList.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta/RegistriesList.java 2006/10/02 17:57:49 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta/RegistriesList.java 2006/12/05 17:18:16 1.2 @@ -53,15 +53,6 @@ "The MOBY registry at the International Rice Research Institute (IRRI) is intended mostly for Generation Challenge Program (GCP) developers. It allows the registration of experimental moby entities within GCP."), new Registry - ("MIPS", - "http://mips.gsf.de/cgi-bin/proj/planet/moby/MOBY-Central.pl", - "http://mips.gsf.de/MOBY/Central", - "MIPS, Germany", - "Dirk Haase (d.haase at gsf.de)", - true, - ""), - - new Registry ("testing", "http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl", "http://bioinfo.icapture.ubc.ca/MOBY/Central", From gordonp at dev.open-bio.org Wed Dec 6 10:09:04 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 10:09:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061509.kB6F94nv023973@dev.open-bio.org> gordonp Wed Dec 6 10:09:03 EST 2006 Update of /home/repository/moby/jars-archive/current In directory dev.open-bio.org:/tmp/cvs-serv23938 Modified Files: MobyServlet.war Log Message: Updated to use new Java annotation based meta-data specification (now fully working) jars-archive/current MobyServlet.war,1.7,1.8 =================================================================== RCS file: /home/repository/moby/jars-archive/current/MobyServlet.war,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 Binary files /home/repository/moby/jars-archive/current/MobyServlet.war 2006/12/04 22:12:12 1.7 and /home/repository/moby/jars-archive/current/MobyServlet.war 2006/12/06 15:09:02 1.8 differ rcsdiff: /home/repository/moby/jars-archive/current/MobyServlet.war: diff failed From gordonp at dev.open-bio.org Wed Dec 6 10:50:37 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 10:50:37 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061550.kB6Fob71024216@dev.open-bio.org> gordonp Wed Dec 6 10:50:37 EST 2006 Update of /home/repository/moby/moby-live/Java/src/webapps/WEB-INF In directory dev.open-bio.org:/tmp/cvs-serv24182/src/webapps/WEB-INF Log Message: Directory /home/repository/moby/moby-live/Java/src/webapps/WEB-INF added to the repository moby-live/Java/src/webapps/WEB-INF - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/webapps/WEB-INF/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/webapps/WEB-INF/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/webapps/WEB-INF/RCS/directory,v: No such file or directory From gordonp at dev.open-bio.org Wed Dec 6 10:51:30 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 10:51:30 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061551.kB6FpUfN024300@dev.open-bio.org> gordonp Wed Dec 6 10:51:29 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv24266/xmls/servlet Log Message: Directory /home/repository/moby/moby-live/Java/xmls/servlet added to the repository moby-live/Java/xmls/servlet - New directory rcsdiff: /home/repository/moby/moby-live/Java/xmls/servlet/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/xmls/servlet/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/xmls/servlet/RCS/directory,v: No such file or directory From gordonp at dev.open-bio.org Wed Dec 6 11:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7AMF024457@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util In directory dev.open-bio.org:/tmp/cvs-serv24370/src/main/ca/ucalgary/seahawk/util Modified Files: MinJarMaker.java Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/src/main/ca/ucalgary/seahawk/util MinJarMaker.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MinJarMaker.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MinJarMaker.java 2006/12/04 22:30:49 1.4 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MinJarMaker.java 2006/12/06 16:07:10 1.5 @@ -617,6 +617,9 @@ if(classname.startsWith("junit")){ //for testing only, we assume continue; } + //if(classname.startsWith("javax.servlet")){ //servlet container will have a version, we assume + // continue; + //} // Haven't noted the inclusion of classes from this package yet for future reference by // secondary jar dumper From gordonp at dev.open-bio.org Wed Dec 6 11:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7Ab2024405@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java In directory dev.open-bio.org:/tmp/cvs-serv24370 Modified Files: build.xml Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java build.xml,1.61,1.62 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- /home/repository/moby/moby-live/Java/build.xml 2006/11/21 13:04:15 1.61 +++ /home/repository/moby/moby-live/Java/build.xml 2006/12/06 16:07:10 1.62 @@ -1,15 +1,15 @@ - - - - - - - - - + + + + + + + + + + ]> @@ -34,6 +34,8 @@ + + @@ -519,10 +521,14 @@ + + + + - + + + + + + + + + + + + + + + + + From gordonp at dev.open-bio.org Wed Dec 6 11:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7AYT024517@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv24370/src/main/org/biomoby/shared/data Modified Files: MobyContentInstance.java Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/src/main/org/biomoby/shared/data MobyContentInstance.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/10/26 01:32:06 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/12/06 16:07:10 1.7 @@ -32,7 +32,7 @@ private int xmlMode = MobyDataInstance.SERVICE_XML_MODE; private HashMap members; private int autoID = 1; // to name members without existing names - private Vector exceptions; + private Vector exceptions; /** * Creates a blank MOBY envelope, to be filled in programatically with data instances. @@ -40,7 +40,7 @@ */ public MobyContentInstance(){ members = new HashMap(); - exceptions = new Vector(); + exceptions = new Vector(); } /** @@ -342,12 +342,42 @@ } /** - * @return the list of exceptions assocaited with this content + * @return the list of exceptions associated with this content */ public ServiceException[] getExceptions(){ return (ServiceException[]) exceptions.toArray(new ServiceException[exceptions.size()]); } + /** + * Indicates whether the moby content has any exception (according to the style of MOBY-S RFC 1863) + * + * @return true if there are exceptions (any severity) in the content + */ + public boolean hasExceptions(){ + return exceptions != null && exceptions.size() > 0; + } + + /** + * Indicates whether the moby content has any exception of the given severity or worse + * (according to the style of MOBY-S RFC 1863). + * + * @param severity the minimum severity of exception (info < warning < error) to report + * + * @return true if there are exceptions (of the specified severity or greater) in the content + */ + public boolean hasExceptions(int severity){ + if(exceptions == null || exceptions.size() == 0){ + return false; + } + + for(ServiceException se: exceptions){ + if(se.getSeverity() <= severity){ + return true; + } + } + return false; + } + public void setXmlMode(int mode) throws IllegalArgumentException{ if(mode != MobyDataInstance.CENTRAL_XML_MODE && mode != MobyDataInstance.SERVICE_XML_MODE){ throw new IllegalArgumentException("Value passed to setXmlMode was neither " + From gordonp at dev.open-bio.org Wed Dec 6 11:07:11 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7BpN024557@dev.open-bio.org> gordonp Wed Dec 6 11:07:11 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls In directory dev.open-bio.org:/tmp/cvs-serv24370/xmls Modified Files: seahawkBuild.xml Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/xmls seahawkBuild.xml,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2006/11/24 21:10:39 1.5 +++ /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2006/12/06 16:07:11 1.6 @@ -1,12 +1,13 @@ - + + - + @@ -19,6 +20,11 @@ + + + + + @@ -37,9 +43,6 @@ - - - @@ -55,6 +58,7 @@ + @@ -76,6 +80,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+ + + + + +
+ From gordonp at dev.open-bio.org Wed Dec 6 11:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7Ad6024477@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service In directory dev.open-bio.org:/tmp/cvs-serv24370/src/main/org/biomoby/service Modified Files: MobyServlet.java Added Files: Asynchronous.java Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/src/main/org/biomoby/service Asynchronous.java,NONE,1.1 MobyServlet.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java 2006/11/22 22:23:55 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java 2006/12/06 16:07:10 1.3 @@ -7,6 +7,9 @@ * the documentation on how to use this servlet. */ +import org.biomoby.service.test.TestServletConfig; +import org.biomoby.service.test.TestServletContext; + import org.biomoby.shared.*; import org.biomoby.shared.data.*; import org.biomoby.shared.parser.*; @@ -29,6 +32,13 @@ import java.util.StringTokenizer; import java.util.Vector; + at mobyService(name="MobyServlet", + type="Testing", + provider="moby.ucalgary.ca", + author="gordonp at ucalgary.ca", + in={}, + out={}, + description={"No-operation base service implementation"}) public class MobyServlet extends HttpServlet implements Remote{ public static final String MOBY_CENTRAL_URL_PARAM = "mobyCentralURL"; @@ -37,6 +47,7 @@ public static final String MOBY_SERVICE_DESC_PARAM = "mobyServiceDescription"; public static final String MOBY_PROVIDER_URI_PARAM = "mobyProviderURI"; public static final String MOBY_SERVICETYPE_PARAM = "mobyServiceType"; + public static final String MOBY_SERVICENAME_PARAM = "mobyServiceName"; public static final String MOBY_INPUT_PARAM = "mobyInput"; public static final String MOBY_SECONDARY_PARAM = "mobySecondaryInput"; public static final String MOBY_OUTPUT_PARAM = "mobyOutput"; @@ -45,8 +56,9 @@ public static final String ADMIN_MODE = "admin"; public static final int INIT_OUTPUT_BUFFER_SIZE = 100000; + private static boolean shouldExit = true; + protected static MobyRequest mobyRequest; - protected static MobyService thisService; protected static DocumentBuilder docBuilder; // Members used to wrap the response in SOAP @@ -57,18 +69,20 @@ protected final static String stringEncAttrValue = "xsd:string"; protected static Name faultName; + protected MobyService thisService; protected MobyContentInstance currentContent = null; protected boolean isInitialized = false; /** Changing this value makes logging more or less verbose */ protected boolean isDebug = false; - protected void doGet(HttpServletRequest request, + public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException{ if(thisService == null){ try{ thisService = createServiceFromConfig(request); } catch(Exception e){ + log("While attempting to configure service on first run:", e); throw new ServletException("While attempting to configure service on first run: " + e); } } @@ -183,10 +197,11 @@ */ protected boolean validSOAPEndPoint(HttpServletRequest request, HttpServletResponse response){ - String methodName = "http://biomoby.org/#"+getServletName(); + String methodName = "http://biomoby.org/#"+getServiceName(); String qMethodName = "\""+methodName+"\""; String requestedActionName = null; boolean endPointMatches = false; + // TODO: This is where we should add code to deal with asynchronous calls for(java.util.Enumeration actionsCalled = request.getHeaders("SOAPAction"); actionsCalled.hasMoreElements();){ @@ -223,7 +238,7 @@ return false; } catch(Exception e){ - log("While writing SOAP fault response to client for " + getServletName(), e); + log("While writing SOAP fault response to client for " + getServiceName(), e); return false; } } @@ -377,7 +392,6 @@ // The SOAP envelope (headerless) consists of a body with one string element inside it if(soapMessageFactory == null){ soapMessageFactory = MessageFactory.newInstance(); - log("SOAP Message Factory (when writeResponse is called) is " + soapMessageFactory); } SOAPMessage message = soapMessageFactory.createMessage(); message.getSOAPHeader().detachNode(); @@ -394,7 +408,7 @@ out.write(outBuffer.toByteArray()); } catch(Exception e){ - log("While writing SOAP response to client for " + getServletName(), e); + log("While writing SOAP response to client for " + getServiceName(), e); return; } @@ -407,10 +421,10 @@ if(currentContent != null){ currentContent.addException(se); if(isInitialized){ - log("While executing Moby Service " + getServletName(), se); + log("While executing Moby Service (initialized) " + getServiceName(), se); } - else{ - System.err.println("While executing Moby Service " + getClass().getName()); + else if(thisService != null){ + System.err.println("While executing Moby Service (uninitialized) " + getClass().getName()); se.printStackTrace(); } } @@ -437,10 +451,10 @@ ex.toString())); } if(isInitialized){ - log("While executing Moby Service " + getServletName(), ex); + log("While executing Moby Service (initialized) " + getServiceName(), ex); } - else{ - System.err.println("While executing Moby Service " + getClass().getName()); + else if(thisService != null){ + System.err.println("While executing Moby Service (uninitialized) " + getClass().getName()); ex.printStackTrace(); } } @@ -461,10 +475,10 @@ ex.toString())); } if(isInitialized){ - log("While executing Moby Service " + getServletName() + ", job '" + job.getID()+"'", ex); + log("While executing Moby Service (initialized) " + getServiceName() + ", job '" + job.getID()+"'", ex); } - else{ - System.err.println("While executing Moby Service " + getClass().getName() + ", job '" + job.getID()+"'"); + else if(thisService != null){ + System.err.println("While executing Moby Service (uninitialized) " + getClass().getName() + ", job '" + job.getID()+"'"); ex.printStackTrace(); } } @@ -492,17 +506,17 @@ "org.apache.axis.soap.MessageFactoryImpl"); } soapMessageFactory = MessageFactory.newInstance(); // Should find Axis by default - log("SOAP Message Factory (when init is called) is " + soapMessageFactory); + //log("SOAP Message Factory (when init is called) is " + soapMessageFactory); - if(System.getProperty("javax.xml.soap.MessageFactory") == null){ + if(System.getProperty("javax.xml.soap.SOAPFactory") == null){ System.setProperty("javax.xml.soap.SOAPFactory", "org.apache.axis.soap.SOAPFactoryImpl"); } SOAPFactory soapFactory = SOAPFactory.newInstance(); - bodyContentsName = soapFactory.createName(getServletName()+"Return", + bodyContentsName = soapFactory.createName(getServiceName()+"Return", MobyPrefixResolver.MOBY_TRANSPORT_PREFIX, MobyPrefixResolver.MOBY_TRANSPORT_NAMESPACE); - bodyName = soapFactory.createName(getServletName()+"Response", + bodyName = soapFactory.createName(getServiceName()+"Response", MobyPrefixResolver.MOBY_TRANSPORT_PREFIX, MobyPrefixResolver.MOBY_TRANSPORT_NAMESPACE); stringEncAttrName = soapFactory.createName("type", @@ -531,46 +545,60 @@ isInitialized = true; } - private synchronized MobyService createServiceFromConfig(HttpServletRequest request) throws Exception{ - MobyService service = new MobyService(getServletName()); + public synchronized MobyService createServiceFromConfig(HttpServletRequest request) throws Exception{ + MobyService service = new MobyService(getServiceName()); Vector inputTypes = new Vector(); Vector outputTypes = new Vector(); - javax.servlet.ServletContext context = getServletContext(); + mobyService ann = + this.getClass().getAnnotation(mobyService.class); + if(ann == null){ + throw new Exception("The servlet does not have a @mobyService() class annotation as required, " + + "cannot configure the service"); + } + else{ + //log("Reading service meta-data from Java class annotation for "+ann.name()); + } + + javax.servlet.ServletConfig config = getServletConfig(); - java.util.Enumeration paramNamesEnum = context.getInitParameterNames(); String paramNames = ""; - if(paramNamesEnum.hasMoreElements()){ - paramNames = paramNamesEnum.nextElement().toString(); - } - while(paramNamesEnum.hasMoreElements()){ - paramNames += ", "+paramNamesEnum.nextElement(); + if(config != null){ + java.util.Enumeration paramNamesEnum = config.getInitParameterNames(); + if(paramNamesEnum.hasMoreElements()){ + paramNames = paramNamesEnum.nextElement().toString(); + } + while(paramNamesEnum.hasMoreElements()){ + paramNames += ", "+paramNamesEnum.nextElement(); + } } // Inputs and outputs and service type must be defined - String ins = context.getInitParameter(MOBY_INPUT_PARAM); + String[] ins = ann.in(); + if(config != null && config.getInitParameter(MOBY_INPUT_PARAM) != null){ + ins = config.getInitParameter(MOBY_INPUT_PARAM).split(","); + } if(ins == null){ throw new Exception("Could not find required " + MOBY_INPUT_PARAM + - " parameter in servlet context, available parameters were: " + paramNames); + " parameter in servlet config, available parameters were: " + paramNames); } - StringTokenizer st = new StringTokenizer(ins, ","); - while(st.hasMoreTokens()){ - String value = st.nextToken(); + for(int i = 0; i < ins.length; i++){ // non-void param - inputTypes.add(stringToPrimaryDataTemplate(value)); + inputTypes.add(stringToPrimaryDataTemplate(ins[i])); } - String outs = context.getInitParameter(MOBY_OUTPUT_PARAM); + String[] outs = ann.out(); + if(config != null && config.getInitParameter(MOBY_OUTPUT_PARAM) != null){ + outs = config.getInitParameter(MOBY_OUTPUT_PARAM).split(","); + } if(outs == null){ throw new Exception("Could not find required " + MOBY_OUTPUT_PARAM + - " parameter in servlet context "); + " parameter in servlet config "); } - st = new StringTokenizer(outs, ","); - while(st.hasMoreTokens()){ - String value = st.nextToken(); - if(value.length() > 0){// non-void param - outputTypes.add(stringToPrimaryDataTemplate(value)); + for(int i = 0; i < outs.length; i++){ + if(outs[i] != null && outs[i].length() > 0){// non-void param + outputTypes.add(stringToPrimaryDataTemplate(outs[i])); } } @@ -578,14 +606,18 @@ service.setOutputs(outputTypes.toArray(new MobyData[outputTypes.size()])); // A description and provider URI must be available too - String param = context.getInitParameter(MOBY_SERVICETYPE_PARAM); + String param = ann.type(); + // Did we override the service type in the web.xml? + if(config != null && config.getInitParameter(MOBY_SERVICETYPE_PARAM) != null){ + param = config.getInitParameter(MOBY_SERVICETYPE_PARAM); + } if(param == null){ throw new Exception("Could not find required " + MOBY_SERVICETYPE_PARAM + - " parameter in servlet context "); + " parameter in servlet config "); } if(param.length() == 0){ throw new Exception("Required " + MOBY_SERVICETYPE_PARAM + - " parameter in servlet context cannot be blank"); + " parameter in servlet config cannot be blank"); } MobyServiceType serviceType = MobyServiceType.getServiceType(param); if(serviceType == null){ @@ -594,80 +626,126 @@ } service.setServiceType(serviceType); - param = context.getInitParameter(MOBY_SERVICE_DESC_PARAM); - if(param == null){ + String[] desc = ann.description(); + // Did we override the service type in the web.xml? + if(config != null && config.getInitParameter(MOBY_SERVICETYPE_PARAM) != null){ + desc = new String[1]; + desc[0] = config.getInitParameter(MOBY_SERVICETYPE_PARAM); + } + if(desc == null){ throw new Exception("Could not find required " + MOBY_SERVICE_DESC_PARAM + - " parameter in servlet context "); + " parameter in servlet config "); } - if(param.length() == 0){ + if(desc.length == 0){ throw new Exception("Required " + MOBY_SERVICE_DESC_PARAM + - " parameter in servlet context cannot be blank"); + " parameter in servlet config cannot be blank"); + } + StringBuffer descBuffer = new StringBuffer(); + for(int i = 0; i < desc.length; i++){ + descBuffer.append(desc[i]); + } + service.setDescription(descBuffer.toString()); + + param = ann.provider(); + // Did we override the provider info in web.xml? + if(config != null && config.getInitParameter(MOBY_PROVIDER_URI_PARAM) != null){ + param = config.getInitParameter(MOBY_PROVIDER_URI_PARAM); } - service.setDescription(param); - - param = context.getInitParameter(MOBY_PROVIDER_URI_PARAM); if(param == null){ throw new Exception("Could not find required " + MOBY_PROVIDER_URI_PARAM + - " parameter in servlet context "); + " parameter in servlet config "); } if(param.length() == 0){ throw new Exception("Required " + MOBY_PROVIDER_URI_PARAM + - " parameter in servlet context cannot be blank"); + " parameter in servlet config cannot be blank"); } service.setAuthority(param); + // Now we have all the info we need to create the LSID for the service String time = MobyDataDateTime.getString( new java.util.GregorianCalendar( java.util.TimeZone.getTimeZone("Zulu"))).replaceAll(":", "-"); - service.setLSID("urn:lsid:biomoby.org:serviceinstance:"+param+","+getServletName()+":"+time); + service.setLSID("urn:lsid:biomoby.org:serviceinstance:"+param+","+getServiceName()+":"+time); - param = context.getInitParameter(MOBY_CONTACT_PARAM); + param = ann.author(); + // Did we override the contact info in web.xml? + if(config != null && config.getInitParameter(MOBY_CONTACT_PARAM) != null){ + param = config.getInitParameter(MOBY_CONTACT_PARAM); + } if(param == null){ throw new Exception("Could not find required " + MOBY_CONTACT_PARAM + - " parameter in servlet context "); + " parameter in servlet config "); } if(param.length() == 0){ throw new Exception("Required " + MOBY_CONTACT_PARAM + - " parameter in servlet context cannot be blank " + + " parameter in servlet config cannot be blank " + "(must have form name at mail.domain)"); } if(param.indexOf("@") < 2 || param.indexOf("@") > param.length()-2 || param.indexOf(".") < 2 || param.indexOf(".") > param.length()-2 || param.lastIndexOf("@") > param.lastIndexOf(".")){ throw new Exception("Required " + MOBY_CONTACT_PARAM + - " parameter in servlet context did not have the form \"name at mail.domain\")"); + " parameter in servlet config did not have the form \"name at mail.domain\")"); } service.setEmailContact(param); // From the request, determine the URL used to access this service - String endPointURL = HttpUtils.getRequestURL(request).toString(); + String endPointURL = request == null ? "" : request.getRequestURL().toString(); // When we POST this URL, the service is executed service.setURL(endPointURL); // When we GET this URL, the RDF is returned service.setSignatureURL(endPointURL+"?"+MODE_HTTP_PARAM+"="+RDF_MODE); // Other fields (authoritative and contact info) are highly recommended, but optional - param = context.getInitParameter(MOBY_AUTHORITATIVE_PARAM); - if(param != null){ - if("YES".equals(param.toUpperCase()) || "Y".equals(param.toUpperCase()) || "1".equals(param)){ - service.setAuthoritative(true); + if(config != null){ + param = config.getInitParameter(MOBY_AUTHORITATIVE_PARAM); + if(param != null){ + if("YES".equals(param.toUpperCase()) || "Y".equals(param.toUpperCase()) || "1".equals(param)){ + service.setAuthoritative(true); + } + else{ + log("Interpreting config parameter '" + param + "' as NO for authoritative property of the service"); + service.setAuthoritative(false); + } } else{ - log("Interpreting config parameter '" + param + "' as NO for authoritative property of the service"); - service.setAuthoritative(false); + service.setAuthoritative(ann.authoritative()); } } else{ - service.setAuthoritative(false); + service.setAuthoritative(ann.authoritative()); } - mobyRequest.setService(service); return service; } /** + * Reads the service name from the mobyService annotation. + */ + public String getServiceName(){ + mobyService ann = + this.getClass().getAnnotation(mobyService.class); + + javax.servlet.ServletConfig config = getServletConfig(); + String param = null; + // Did we override the service type in the web.xml? + if(config != null && config.getInitParameter(MOBY_SERVICENAME_PARAM) != null){ + param = config.getInitParameter(MOBY_SERVICENAME_PARAM); + if(param != null && param.length() != 0){ + return param; + } + } + + if(ann == null){ + return "AnonymousService"; // this should never happen unless the class files are out of sync... + } + + return ann.name(); + } + + /** * Strings have the form name:objectType:namespace, with ":namespace" optional * If the input is expected to be a Collection, then the syntax is name:Collection(objectType):namespace */ @@ -694,10 +772,12 @@ MobyPrimaryData dataTemplate = null; + boolean isCollection = false; if(objectType.indexOf("Collection(") == 0 && objectType.lastIndexOf(")") == objectType.length()-1){ objectType = objectType.substring(11, objectType.length()-1); dataTemplate = new MobyPrimaryDataSet(name); + isCollection = true; } else{ dataTemplate = new MobyPrimaryDataSimple(name); @@ -712,6 +792,12 @@ System.exit(1); } dataTemplate.setDataType(type); + if(isCollection){ + // Example data element in set needed for RDF creator to recognize the data type + MobyPrimaryDataSimple exampleData = new MobyPrimaryDataSimple(name); + exampleData.setDataType(type); + ((MobyPrimaryDataSet) dataTemplate).addElement(exampleData); + } // namespace is optional if(st.hasMoreTokens()){ @@ -763,7 +849,13 @@ // Should happen, unless main() was called validateArguments(currentRequest, thisService, "While executing service"); } - processRequest(currentRequest, resultContents.get(jobName)); + MobyDataJob currentResult = resultContents.get(jobName); + if(currentResult == null){ + currentResult = new MobyDataJob(); + currentResult.setID(jobName); + resultContents.put(jobName, currentResult); + } + processRequest(currentRequest, currentResult); }catch(Throwable e){ addException(resultContents, requestContents.get(jobName), e); } @@ -787,6 +879,15 @@ } /** + * Determines whether call to main() that terminate on error should call System.exit() + * or not. This is the default behaviour, and should generally be switched only for unit testing + * purposes. + */ + public static void setMainTerminationExit(boolean b){ + shouldExit = b; + } + + /** * Expects one argument, an example MOBY XML input file or URL. * processRequest() is then called for every job in the input data, * and the results are printed to the screen. @@ -794,9 +895,10 @@ public static void main(String[] args) throws Exception{ if(args.length != 2){ - System.err.println("MobyServlet is ignoring the main method, executing the subclass's main method."); + System.err.println("MobyServlet is ignoring the main method (called with " + args.length + " args) " + + ", executing the subclass's main method."); System.err.println("If you wish to run the Servlet test, the usage is: "); - System.err.println("java ServletName ServetName "); + System.err.println("java ServletName SerlvetName "); return; } @@ -837,30 +939,45 @@ } catch(Exception e){ System.err.println("The test data was invalid:"); e.printStackTrace(); - System.exit(2); + if(shouldExit) + System.exit(2); + else + throw e; } // TO DO: Should we validate the input somehow? // They'll find out when they run the servlet tests later, but the earlier the better... MobyContentInstance testResults = new MobyContentInstance(); - // Create as many output slots (blank) as there were input slots - // According to the MOBY spec, there must be a 1:1 relationship here - for(String jobName : testData.keySet()){ - MobyDataJob result = new MobyDataJob(); - result.setID(jobName); - testResults.put(jobName, result); - } - + // Configure the service, minimally, to check the input data + servlet.init(new TestServletConfig(args[0], new TestServletContext())); + servlet.thisService = servlet.createServiceFromConfig(null); + // It should populate the testResults try{ servlet.processRequests(testData, testResults); } catch(Exception e){ System.err.println("An error occured while testing your code's processRequest method:"); e.printStackTrace(); - } + if(shouldExit){ + System.exit(2); + } + else{ + throw e; + } + } - System.out.println(testResults.toString()); - System.exit(0); //so that subclasses's main methods don;t executed if the test was run + if(testResults.hasExceptions(ServiceException.WARNING)){ + for(ServiceException se: testResults.getExceptions()){ + se.printStackTrace(); + } + throw new Exception("Executing service " + args[0] + " cause exceptions"); + } + else{ + System.out.println(testResults.toString()); + } + if(shouldExit){ + System.exit(0); //so that subclasses's main methods don't executed if the test was run + } } } From gordonp at dev.open-bio.org Wed Dec 6 11:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7AsS024435@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv24370/docs Modified Files: ConvertAAtoFASTA_AA.java deployingServices.html tomcatInstall.html Removed Files: mobyAASeq.xml web.xml Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/docs ConvertAAtoFASTA_AA.java,1.1,1.2 deployingServices.html,1.10,1.11 tomcatInstall.html,1.2,1.3 mobyAASeq.xml,1.1,NONE web.xml,1.1,NONE =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ConvertAAtoFASTA_AA.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/docs/ConvertAAtoFASTA_AA.java 2006/08/01 15:20:53 1.1 +++ /home/repository/moby/moby-live/Java/docs/ConvertAAtoFASTA_AA.java 2006/12/06 16:07:10 1.2 @@ -1,6 +1,11 @@ import org.biomoby.shared.MobyDataType; import org.biomoby.shared.data.*; + at mobyService(type="FormatConversion", + provider="moby.ucalgary.ca", + author="gordonp at ucalgary.ca", + in={"inseq:AminoAcidSequence"}, + out={"outseq:FASTA_AA"}) public class ConvertAAtoFASTA_AA extends org.biomoby.client.MobyServlet{ public void processRequest(MobyDataJob request, MobyDataJob result) throws Exception{ =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/deployingServices.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/11/21 21:02:05 1.10 +++ /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/12/06 16:07:10 1.11 @@ -15,10 +15,11 @@ provider of a MOBY service. It should take you less than 30 minutes. The approach is based on extending a base jMOBY Servlet, but does not require you to have any knowledge of Servlets, SOAP, XML, RDF or any of the other technologies underlying its implementation. - You do not need to checkout the jMOBY CVS, or install Axis or even Ant. + You do not need to checkout the jMOBY CVS, or install Apache Axis. Alternatively, + you can do this tutorial without Apache Ant too.

- If on the other hand you are planning on directly hacking the jMOBY classes, the proper approach + If, on the other hand, you are planning on directly hacking the jMOBY classes, the other approach to developing services (using a code generator and the full jMOBY CVS) can be found in this document.

@@ -27,10 +28,11 @@

@@ -41,26 +43,59 @@
  1. A Java Development Kit version 5.0+
  2. +
  3. The Apache Ant build tool. If you have an aversion to Ant for some reason, you can follow these instructions instead, which give you the required java command lines.
  4. A Java Servlet container, such as Apache Tomcat. If you don't have one setup, here's a very quick guide.
  5. -
  6. Also download -
+ +

Step 1: Configure your build enviroment

+

You need to tell Ant where your code and servlet container are located. This is done by modifying the + mobyService.properties file you just downloaded: +
+# Where the project directory is located.
+project.dir=/home/gordonp/development/fastaConverter
+
+# Where the Java source directory is located.
+src.dir=${project.dir}/src
+
+# The package-qualified location of your main class (the one extending MobyServlet).
+# You could have no package, or org/bar/foo, etc. in a real service
+main.class.file=org/biomoby/service/test/ConvertAAtoFASTA_AA.java
+
+# Where all 3rd party libraries for your code are stored.
+lib.dir=${project.dir}/lib
+
+# Name of the output WAR archive to be generated (will also be the servlet name).
+my.servlet.war.file=ConvertAAtoFASTA_AA.war
+
+# The location of a test MOBY XML input data file (use as input to test your service).
+input.data.file=${project.dir}/mobyAASeq.xml
+
+# Your Java Servlet host URL
+servlet.host.url=http://moby.ucalgary.ca
+
+# Your Java Servlet port
+servlet.port=8089
+
+ +

+ -

Step 1: Write the function

+

Step 2: Write the function

MobyServlet takes care of all of the protocol issues for you, all you need to do is override the business logic method: processRequest

-

For example, the following service consumes a +

For example, the following service consumes a MOBY AminoAcidSequence object called "inseq", and returns it reformatted into a @@ -68,10 +103,22 @@ FASTA_AA object called "outseq":
+package org.biomoby.service.test; // This could be any package you want in real life...
+
 import org.biomoby.shared.MobyDataType;
 import org.biomoby.shared.data.*;
+import org.biomoby.service.*;
+
+ at mobyService(name="ConvertAAtoFASTA_AA",
+             type="FormatConversion", 
+	     provider="moby.ucalgary.ca", 
+	     author="gordonp at ucalgary.ca",
+	     in={"inseq:AminoAcidSequence"},
+	     out={"outseq:FASTA_AA"},
+	     description={"Converts amino acid objects into FastA formatted records, ", 
+			  "primarily to increase inter-service compatibility"})
 
-public class ConvertAAtoFASTA_AA extends org.biomoby.service.MobyServlet{
+public class ConvertAAtoFASTA_AA extends MobyServlet{
 
     public void processRequest(MobyDataJob request, MobyDataJob result) throws Exception{
          // The input parameter for this method is registered as "inseq"
@@ -94,115 +141,54 @@
          // Set the result that will be passed back to the client
          result.put("outseq", fastaObject);
     }
-}
-      
+} + +

Save a file with the code above in a file called + ${src.dir}/org/biomoby/service/test/ConvertAAtoFASTA_AA.java

-

That's it for the coding. Really! Now compile it (remember: Java 1.5), including the MobyServlet.war - you downloaded in the class path, e.g.:

+

Notice the @mobyService line. This is a Java + annotation used by + the base MobyServlet to do all the input type checking for you. If you've specified the annotation + correctly, you are guaranteed that processRequest will only receive syntactically + and semantically valid data. The same annotation is eventually used to publish your service's meta-data to + MOBY Central.

+ +

That's it for the coding. Really! Now compile it (Ant will automatically fetch the + MobyServlet.war you are extending), running the following command in the same + directory where you saved the build.xml file:

-
javac -cp MobyServlet.war:. ConvertAAtoFASTA_AA.java
+
ant compile

When you go to write your own services with different data types, a quick tutorial on the data API can be found here. All of the datatypes, service types and namespaces you use must be registered - in the MOBY Ontologies.

+ in the MOBY Ontologies. Also, + when you go to create your own services, you'll put the Java code in a directory that matches a package name of your + own choosing (e.g. ${src.dir}/org/foo/bar.java, or just ${src.dir}/foo.java for no-package code)

You should probably test that your business logic works! The base servlet has a built-in application test, so just type: -

java -cp MobyServlet.war:. ConvertAAtoFASTA_AA ConvertAAtoFASTA_AA mobyAASeq.xml
+
ant test
and make sure the output is as you expected. - Note that the class name is given twice, - once to the JVM, and once as an argument to the application itself.

+

-

Step 2: Package the code

- +

Step 3: Package the code

The default MobyServlet.war business logic is to just return blank MOBY messages. - You've got to customize it for your service with the following:

-
    -
  1. Copy MobyServlet.war to ConvertAAtoFASTA_AA.war
  2. -
  3. Edit the WAR's WEB-INF/web.xml to tell it about your class - (a WAR is just a JAR with a particular directory structure): -
    -# Extract the existing web.xml from the WAR
    -jar xvf ConvertAAtoFASTA_AA.war WEB-INF/web.xml
    -# Edit the file with your favorite editor (see the table below)
    -vi WEB-INF/web.xml
    -
  4. -
+ You've got to customize it as your new WAR file with the following:

-

For our example converter, it should minimally look like this, with the required changes to the default web.xml shown in bold: -
-
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE web-app 
-    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
-    "http://java.sun.com/dtd/web-app_2_3.dtd">
-
-<web-app>
-    <display-name>BioMOBY Web Service: Convert AA -> FASTA_AA</display-name>
-    <servlet>
-      <servlet-name>ConvertAAtoFASTA_AA</servlet-name>
-      <servlet-class>ConvertAAtoFASTA_AA</servlet-class>
-
-    </servlet>
-    <servlet-mapping>
-      <servlet-name>ConvertAAtoFASTA_AA</servlet-name>
-      <url-pattern>/</url-pattern>
-    </servlet-mapping>
-
-    <context-param>
-      <param-name>mobyServiceDescription</param-name>
-      <param-value>Converts amino acid objects into FastA formatted records, 
-                   primarily to increase inter-service compatibility</param-value>
-    </context-param>
-
-    <context-param>
-      <param-name>mobyInput</param-name>
-      <param-value>inseq:AminoAcidSequence</param-value>
-    </context-param>
-
-    <context-param>
-      <param-name>mobyOutput</param-name>
-      <param-value>outseq:FASTA_AA</param-value>
-    </context-param>
-
-    <context-param>
-      <param-name>mobyServiceType</param-name>
-      <param-value>FormatConversion</param-value>
-    </context-param>
-
-    <context-param>
-      <param-name>mobyProviderURI</param-name>
-      <param-value>your.domain.name</param-value>
-    </context-param>
-
-    <context-param>
-      <param-name>mobyAuthorContact</param-name>
-      <param-value>yourname at email.com</param-value>
-    </context-param>
-
-</web-app>
- -

  • Put your new class and the updated web.xml in the WAR file: -
    -mkdir WEB-INF/classes
    -cp ConvertAAtoFASTA_AA.class WEB-INF/classes
    -jar uvf ConvertAAtoFASTA_AA.war WEB-INF
    -	  
  • - -

    The web.xml file is used by the Servlet container (e.g. Tomcat), and by the base MobyServlet -to do all the input type checking for you. If you've specified this file correctly, you are guaranteed that -processRequest will only receive syntactically valid data.

    +
    ant war
    + +

    The resulting ConvertAAtoFASTA_AA.war is in the build directory you specified in Step 1. -

    Step 3: Deploy the servlet

    +

    Step 4: Deploy the servlet

    -

    ConvertAAtoFASTA_AA.war now contains your Web Service, and is ready to be deployed +

    ConvertAAtoFASTA_AA.war now contains your MOBY-S Web Service, and is ready to be deployed in the Servlet container. How you do this depends on the container. For Tomcat, the easiest way is to use the management Web interface (e.g. http://your.servlet.host:8080/manager/html, but change 8080 appropriately if you had to follow Step 0) and upload the WAR. @@ -228,14 +214,15 @@

    -

    Step 4: Register the service

    +

    Step 5: Register the service

    You should test your service to make sure it works in the servlet environment. - A testing client program is automagically included in your WAR, so type (with - the fully qualified host name, and change 8080 appropriately if you had follow - Step 0): -

    java -jar ConvertAAtoFASTA_AA.war http://your.servlet.host:8080/ConvertAAtoFASTA_AA mobyAASeq.xml
    + A testing client program is automagically included in your WAR, so type: + +
    ant testService
    + +

    If the service fails, a useful error message should be printed to help you diagnose the problem. - This would usually be an incorrect web.xml, or the data type you return isn't what you declared + This would usually be because the data type you return isn't what you declared (this is the first occasion your output is thoroughly checked). If you get a java.lang.NoClassDefFoundError, please see the notes below. If that doesn't help, let me know (gordonp -Last modified: Tue Nov 21 13:16:31 MST 2006 +Last modified: Wed Dec 6 08:39:50 MST 2006 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/tomcatInstall.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/docs/tomcatInstall.html 2006/11/21 21:02:26 1.2 +++ /home/repository/moby/moby-live/Java/docs/tomcatInstall.html 2006/12/06 16:07:10 1.3 @@ -61,7 +61,7 @@ </tomcat-users> -

  • Windows: in step 2 you created the admin account.
  • +
  • Windows: in step 2 you created the admin account.
  • Step 4: Start the servlet container. @@ -84,7 +84,7 @@
    Paul Gordon
    -Last modified: Tue Nov 21 13:17:49 MST 2006 +Last modified: Tue Dec 5 09:23:31 MST 2006 rcsdiff: /home/repository/moby/moby-live/Java/docs/RCS/mobyAASeq.xml,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/docs/RCS/web.xml,v: No such file or directory From gordonp at dev.open-bio.org Wed Dec 6 11:07:11 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7Bf2024531@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/webapps/WEB-INF In directory dev.open-bio.org:/tmp/cvs-serv24370/src/webapps/WEB-INF Added Files: web.xml Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/src/webapps/WEB-INF web.xml,NONE,1.1 From gordonp at dev.open-bio.org Wed Dec 6 11:07:11 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7BIT024571@dev.open-bio.org> gordonp Wed Dec 6 11:07:11 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv24370/xmls/servlet Added Files: build.xml mobyService.properties Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/xmls/servlet build.xml,NONE,1.1 mobyService.properties,NONE,1.1 From gordonp at dev.open-bio.org Wed Dec 6 11:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7Ab9024495@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test In directory dev.open-bio.org:/tmp/cvs-serv24370/src/main/org/biomoby/service/test Added Files: ConvertAAtoFASTA_AA.java FromFastaToDNASequence.java MobyServletTestCase.java ServletTester.java StringBufferServletOutputStream.java TestHttpServletRequest.java TestHttpServletResponse.java TestServletConfig.java TestServletContext.java mobyAASeq.xml Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/src/main/org/biomoby/service/test ConvertAAtoFASTA_AA.java,NONE,1.1 FromFastaToDNASequence.java,NONE,1.1 MobyServletTestCase.java,NONE,1.1 ServletTester.java,NONE,1.1 StringBufferServletOutputStream.java,NONE,1.1 TestHttpServletRequest.java,NONE,1.1 TestHttpServletResponse.java,NONE,1.1 TestServletConfig.java,NONE,1.1 TestServletContext.java,NONE,1.1 mobyAASeq.xml,NONE,1.1 From gordonp at dev.open-bio.org Wed Dec 6 11:25:51 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:25:51 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061625.kB6GPpsJ024665@dev.open-bio.org> gordonp Wed Dec 6 11:25:51 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv24630 Modified Files: index.html Log Message: Doc updates for today's commit moby-live/Java/docs index.html,1.28,1.29 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/index.html,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- /home/repository/moby/moby-live/Java/docs/index.html 2006/09/07 09:22:08 1.28 +++ /home/repository/moby/moby-live/Java/docs/index.html 2006/12/06 16:25:51 1.29 @@ -109,7 +109,7 @@
  • Using general methods
      -
    • Seahawk: An extensible, user-oriented MOBY client
    • How to @@ -137,12 +137,11 @@
    • Using general methods @@ -191,7 +190,7 @@
      Martin Senger
      -Last modified: 07 Sep 2006, 11:21:06 +Last modified: Wed Dec 6 09:24:31 MST 2006
      From gordonp at dev.open-bio.org Wed Dec 6 12:55:29 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 12:55:29 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061755.kB6HtTvf025098@dev.open-bio.org> gordonp Wed Dec 6 12:55:29 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv25063/xmls/servlet Modified Files: build.xml Log Message: Made log4j properties file optional moby-live/Java/xmls/servlet build.xml,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/servlet/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/xmls/servlet/build.xml 2006/12/06 16:07:11 1.1 +++ /home/repository/moby/moby-live/Java/xmls/servlet/build.xml 2006/12/06 17:55:29 1.2 @@ -102,7 +102,7 @@ - + From gordonp at dev.open-bio.org Wed Dec 6 13:19:05 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 13:19:05 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061819.kB6IJ5li025441@dev.open-bio.org> gordonp Wed Dec 6 13:19:05 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv25406/xmls/servlet Modified Files: mobyService.properties Log Message: Modified to work nicely with the tutorial moby-live/Java/xmls/servlet mobyService.properties,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/06 16:07:11 1.1 +++ /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/06 18:19:05 1.2 @@ -1,20 +1,20 @@ # Where the project directory is located. -project.dir=/export/home/qtrinh/DEPLOYMENT/codonUsageTable +project.dir=/export/home/gordonp/development/service # Where the Java source directory is located. src.dir=${project.dir}/src # The package-qualified location of your main class (the one extending MobyServlet). -main.class.file=ca/ucalgary/codonUsage/CodonUsageTable.java +main.class.file=org/biomoby/service/test/ConvertAAtoFASTA_AA.java # Where all 3rd party libraries for your code are stored. lib.dir=${project.dir}/lib # Name of the output WAR archive to be generated (will also be the servlet name). -my.servlet.war.file=GenerateCodonUsageTable.war +my.servlet.war.file=ConvertAAtoFASTA_AA.war # The location of a test MOBY XML input data file (use as input to test your service). -input.data.file=${project.dir}/mobyDNASeqs.xml +input.data.file=${project.dir}/mobyAASeq.xml # Java Servlet host URL servlet.host.url=http://moby.ucalgary.ca From gordonp at dev.open-bio.org Wed Dec 6 13:37:51 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 13:37:51 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061837.kB6IbpPu025771@dev.open-bio.org> gordonp Wed Dec 6 13:37:51 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv25736/xmls/servlet Modified Files: mobyService.properties Log Message: Modified to work nicely with the tutorial moby-live/Java/xmls/servlet mobyService.properties,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/06 18:19:05 1.2 +++ /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/06 18:37:51 1.3 @@ -4,7 +4,7 @@ # Where the Java source directory is located. src.dir=${project.dir}/src -# The package-qualified location of your main class (the one extending MobyServlet). +# The package-qualified location of your main class's source code (the one extending MobyServlet). main.class.file=org/biomoby/service/test/ConvertAAtoFASTA_AA.java # Where all 3rd party libraries for your code are stored. @@ -13,7 +13,7 @@ # Name of the output WAR archive to be generated (will also be the servlet name). my.servlet.war.file=ConvertAAtoFASTA_AA.war -# The location of a test MOBY XML input data file (use as input to test your service). +# The location of a test MOBY XML input data file (used as input to test your service). input.data.file=${project.dir}/mobyAASeq.xml # Java Servlet host URL From mwilkinson at dev.open-bio.org Thu Dec 7 11:18:04 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 7 Dec 2006 11:18:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071618.kB7GI4Km029581@dev.open-bio.org> mwilkinson Thu Dec 7 11:18:04 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv29562/MOBY Modified Files: Central.pm Log Message: proving that I am working in Germany :-) Heiko and I are making MOBY POST, as an alternative to MOBY SOAP. Will also help with message chunking, since you can process the message as it is streaming in. moby-live/Perl/MOBY Central.pm,1.262,1.263 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.262 retrieving revision 1.263 diff -u -r1.262 -r1.263 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/10/17 14:00:53 1.262 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/07 16:18:04 1.263 @@ -1302,18 +1302,18 @@ $error .= "missing Category \n" unless defined $Category; return &_error( "malformed payload $error\n\n", "" ) if ($error); return &_error( - "Category may take the (case sensitive) values 'moby', 'cgi', 'soap'\n", + "Category may take the (case sensitive) values 'moby', 'cgi', 'post', 'wsdl'\n", "" ) unless ( ( $Category eq "wsdl" ) - # || ($Category eq "cgi") + || ($Category eq "cgi") || ( $Category eq "moby" ) + || ( $Category eq "post" ) ); - $debug && &_LOG("Entering switch with $Category method\n"); - return &_error("Service categories other than 'moby' and 'wsdl' are not yet implemented","") - unless ( ( $Category eq "moby" ) || ( $Category eq "wsdl" ) ); + return &_error("Service categories other than 'moby', 'post' are not yet implemented","") + unless ( ( $Category eq "moby" ) || ( $Category eq "post" ) ); #test the existence of the service return &_error( "This service already exists", "" ) if (MOBY::service_instance->new( From mwilkinson at dev.open-bio.org Thu Dec 7 11:18:04 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 7 Dec 2006 11:18:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071618.kB7GI4fS029599@dev.open-bio.org> mwilkinson Thu Dec 7 11:18:04 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv29562/MOBY/Client Modified Files: Central.pm Log Message: proving that I am working in Germany :-) Heiko and I are making MOBY POST, as an alternative to MOBY SOAP. Will also help with message chunking, since you can process the message as it is streaming in. moby-live/Perl/MOBY/Client Central.pm,1.135,1.136 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.135 retrieving revision 1.136 diff -u -r1.135 -r1.136 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2006/05/04 19:33:08 1.135 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2006/12/07 16:18:04 1.136 @@ -712,9 +712,9 @@ #____________________________________________________________________________________________ return $self->errorRegXML( -"Only 'moby' and 'wsdl' Service Categories are currently allowed - you gave me $Category" +"Only 'moby', 'post' and 'wsdl' Service Categories are currently allowed - you gave me $Category" ) - unless ( ( $Category eq 'moby' ) || ( $Category eq 'wsdl' ) ); + unless ( ( $Category eq 'moby' ) || ( $Category eq 'wsdl' ) || ( $Category eq 'post' )); return $self->errorRegXML( "All Fields Required: serviceName, serviceType, authURI, contactEmail, URL, description, Category, input, output, secondary" ) @@ -736,7 +736,7 @@ $authURI $email"; - if ( $Category eq "moby" || $Category eq 'soap' ) { + if ( $Category eq "moby" || $Category eq 'soap' || $Category eq 'post') { my %SEC; if ( $a{'secondary'} && ( ref( $a{'secondary'} ) eq 'HASH' ) ) { %SEC = %{ $a{secondary} }; @@ -861,9 +861,7 @@ $message .= ""; } else { - return $self->errorRegXML( -"only 'moby' and 'wsdl' service types are allowed to be registered at this time." - ); + return $self->errorRegXML("only 'moby', 'post' and 'wsdl' service types are allowed to be registered at this time."); } #elsif ($Category eq "cgi") { From gordonp at dev.open-bio.org Thu Dec 7 11:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7Gbavw029758@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/shared/data Modified Files: MobyDataSecondaryInstance.java Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/shared/data MobyDataSecondaryInstance.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2006/07/07 04:12:40 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2006/12/07 16:37:36 1.7 @@ -4,6 +4,8 @@ import org.biomoby.shared.*; import org.biomoby.shared.parser.MobyTags; import org.w3c.dom.*; +import java.math.*; +import java.util.GregorianCalendar; // with apologies to the Julians among us... /** * A class that holds and displays secondary input data to a service. @@ -26,7 +28,11 @@ public MobyDataSecondaryInstance(MobySecondaryData type){ super(type.getName()); setId(type.getId()); - setDataType(type.getDataType()); + try{ + setDataType(type.getDataType()); + }catch(Exception e){ + e.printStackTrace(); + } setAllowedValues(type.getAllowedValues()); setDefaultValue(type.getDefaultValue()); setMinimumValue(type.getMinimumValue()); @@ -49,7 +55,11 @@ if(getName().length() == 0){ throw new MobyException("Secondary parameters with blank articleNames are not allowed, input was: " + objectTag); } - setDataType("String"); + try{ + setDataType(MobySecondaryData.STRING_TYPE); + } catch(Exception e){ + e.printStackTrace(); + } if(objectTag == null){ return; @@ -75,6 +85,38 @@ setValue(MobyDataObject.getTextContents((Element) values.item(0))); } + public boolean asBoolean(){ + return dataValue.equalsIgnoreCase("true") || dataValue.equals("1") || dataValue.equalsIgnoreCase("T"); + } + + public BigDecimal asFloat(){ + try{ + return new BigDecimal(dataValue); + } catch(Exception e){ + return null; + } + } + + public BigInteger asInteger(){ + try{ + return new BigInteger(dataValue); + } catch(Exception e){ + return null; + } + } + + public String asString(){ + return dataValue; + } + + public GregorianCalendar asDateTime(){ + try{ + return MobyDataDateTime.parseISO8601(dataValue); + } catch(Exception e){ + return null; + } + } + /** * For now, all secondary parameters are treated as strings. */ From gordonp at dev.open-bio.org Thu Dec 7 11:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7GbaPN029664@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/ca/ucalgary/seahawk/gui Modified Files: MobySecondaryInputGUI.java Log Message: Updates to secondary article handling moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobySecondaryInputGUI.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobySecondaryInputGUI.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/seahawk/gui/MobySecondaryInputGUI.java 2006/10/25 02:33:22 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobySecondaryInputGUI.java 2006/12/07 16:37:36 1.2 @@ -2,6 +2,7 @@ package ca.ucalgary.seahawk.gui; import org.biomoby.shared.data.MobyDataSecondaryInstance; +import org.biomoby.shared.MobySecondaryData; import java.awt.*; import javax.swing.*; import javax.swing.text.JTextComponent; @@ -177,18 +178,21 @@ return makeEnumWidget(msdi); } // Otherwise build a widget based on the data type - else if("Integer".equals(dataType)){ + else if(MobySecondaryData.INTEGER_TYPE.equals(dataType)){ return makeIntWidget(msdi); } - else if("Float".equals(dataType)){ + else if(MobySecondaryData.FLOAT_TYPE.equals(dataType)){ return makeFloatWidget(msdi); } - else if("String".equals(dataType)){ + else if(MobySecondaryData.STRING_TYPE.equals(dataType)){ return makeStringWidget(msdi); } - else if("DateTime".equals(dataType)){ + else if(MobySecondaryData.DATETIME_TYPE.equals(dataType)){ return makeDateTimeWidget(msdi); } + else if(MobySecondaryData.BOOLEAN_TYPE.equals(dataType)){ + return makeBooleanWidget(msdi); + } else{ logger.warn("Unrecognized secondary input data type (" + dataType + ") in " + getClass()); return null; @@ -219,6 +223,24 @@ return widget; } + public Component makeBooleanWidget(MobyDataSecondaryInstance msdi){ + String defaultValue = msdi.getDefaultValue(); + if(defaultValue == null){ + defaultValue = "false"; + } + + JPanel widget = new JPanel(); + widget.add(makeJLabel(msdi)); + JCheckBox checkbox = new JCheckBox(); + checkbox.setSelected(defaultValue.toLowerCase().equals("true") || + defaultValue.equals("1") || + defaultValue.equals("T")); + data2widget.put(msdi, checkbox); + widget.add(checkbox); + + return widget; + } + public Component makeStringWidget(MobyDataSecondaryInstance msdi){ String defaultValue = msdi.getDefaultValue(); if(defaultValue == null){ @@ -378,6 +400,7 @@ } public Component makeDateTimeWidget(MobyDataSecondaryInstance msdi){ + //TODO return null; } From gordonp at dev.open-bio.org Thu Dec 7 11:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7GbaYi029682@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool Modified Files: MobyInputOutputData.java Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool MobyInputOutputData.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool/MobyInputOutputData.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool/MobyInputOutputData.java 2005/07/19 15:44:10 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool/MobyInputOutputData.java 2006/12/07 16:37:36 1.3 @@ -173,7 +173,11 @@ else data = new MobySecondaryData("un-named"); - data.setDataType(dataTypeName); + try{ + data.setDataType(dataTypeName); + } catch(Exception e){ + e.printStackTrace(); // will default to string if unrecognized + } if (dataDefault != null && !dataDefault.equals("")) data.setDefaultValue(dataDefault); if (min != null && !min.equals("")) From gordonp at dev.open-bio.org Thu Dec 7 11:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7Gba92029740@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/shared Modified Files: MobySecondaryData.java Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/shared MobySecondaryData.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java 2006/11/11 23:04:34 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java 2006/12/07 16:37:36 1.10 @@ -23,8 +23,13 @@ public class MobySecondaryData extends MobyData { + public static final String INTEGER_TYPE = "Integer"; + public static final String FLOAT_TYPE = "Float"; + public static final String STRING_TYPE = "String"; + public static final String DATETIME_TYPE = "DateTime"; + public static final String BOOLEAN_TYPE = "Boolean"; - protected String dataType = "String"; + protected String dataType = STRING_TYPE; protected String defaultValue = ""; protected String minimumValue = ""; protected String maximumValue = ""; @@ -54,14 +59,18 @@ * </Parameter> * *************************************************************************/ - public MobySecondaryData (Element elem) { + public MobySecondaryData (Element elem){ super (elem.getAttribute ("articleName")); NodeList children = elem.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { String childName = children.item (i).getNodeName(); if (childName.equals ("datatype")) { if (children.item (i).getFirstChild() != null) - setDataType (children.item (i).getFirstChild().getNodeValue()); + try{ + setDataType (children.item (i).getFirstChild().getNodeValue()); + } catch(Exception e){ + e.printStackTrace(); + } } else if (childName.equals ("description")) { if (children.item (i).getFirstChild() != null) setDescription (children.item (i).getFirstChild().getNodeValue()); @@ -84,8 +93,29 @@ public String getDataType() { return dataType; } - public void setDataType (String value) { - dataType = (value == null ? "" : value); + + public void setDataType (String value) throws Exception{ + if(value.equalsIgnoreCase(INTEGER_TYPE)){ + dataType = INTEGER_TYPE; + } + else if(value.equalsIgnoreCase(FLOAT_TYPE)){ + dataType = FLOAT_TYPE; + } + else if(value.equalsIgnoreCase(STRING_TYPE)){ + dataType = STRING_TYPE; + } + else if(value.equalsIgnoreCase(DATETIME_TYPE)){ + dataType = DATETIME_TYPE; + } + else if(value.equalsIgnoreCase(BOOLEAN_TYPE)){ + dataType = BOOLEAN_TYPE; + } + else{ + throw new Exception("Data type for secondary parameter '" + getName() + + "' was not valid (\"" + value + "\"), must be one of " + + INTEGER_TYPE + ", " + FLOAT_TYPE + ", " + STRING_TYPE + ", " + + DATETIME_TYPE + ", " + BOOLEAN_TYPE); + } } public String getDefaultValue() { From gordonp at dev.open-bio.org Thu Dec 7 11:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7GbacV029722@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/service/test Modified Files: MobyServletTestCase.java mobyAASeq.xml Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/service/test MobyServletTestCase.java,1.1,1.2 mobyAASeq.xml,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java 2006/12/06 16:07:10 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java 2006/12/07 16:37:36 1.2 @@ -218,12 +218,10 @@ } public void testAsync(){ + // TODO } - public void testRegister(){ - } - - public void testUnregister(){ + public void testSecondaryParams(){ } /** @@ -235,6 +233,7 @@ suite.addTest(new MobyServletTestCase("testRDF")); suite.addTest(new MobyServletTestCase("testRequestChain")); suite.addTest(new MobyServletTestCase("testMain")); + suite.addTest(new MobyServletTestCase("testSecondaryParams")); suite.addTest(new MobyServletTestCase("testServletTester")); return suite; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/mobyAASeq.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/mobyAASeq.xml 2006/12/06 16:07:10 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/mobyAASeq.xml 2006/12/07 16:37:36 1.2 @@ -8,6 +8,11 @@ 499 + true + 100 + nr + 1.0e-5 + 2005-08-13 From gordonp at dev.open-bio.org Thu Dec 7 11:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7Gbadk029776@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/shared/extended Modified Files: ServiceInstanceParser.java Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/shared/extended ServiceInstanceParser.java,1.19,1.20 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/10/26 00:28:58 1.19 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/12/07 16:37:36 1.20 @@ -561,7 +561,11 @@ // create the datatype MobySecondaryData secondary = new MobySecondaryData(articlename); - secondary.setDataType(datatype); + try{ + secondary.setDataType(datatype); + } catch(Exception e){ + e.printStackTrace(); // will default to String if unrecognized + } if (parameter.hasProperty(FetaVocabulary.hasDefaultValue)) { secondary.setDefaultValue(parameter.getProperty( From gordonp at dev.open-bio.org Thu Dec 7 11:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7GbaGp029700@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/service Modified Files: MobyServlet.java Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/service MobyServlet.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java 2006/12/06 16:07:10 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java 2006/12/07 16:37:36 1.4 @@ -31,6 +31,7 @@ import javax.xml.soap.*; import java.util.StringTokenizer; import java.util.Vector; +import java.math.*; @mobyService(name="MobyServlet", type="Testing", @@ -49,7 +50,7 @@ public static final String MOBY_SERVICETYPE_PARAM = "mobyServiceType"; public static final String MOBY_SERVICENAME_PARAM = "mobyServiceName"; public static final String MOBY_INPUT_PARAM = "mobyInput"; - public static final String MOBY_SECONDARY_PARAM = "mobySecondaryInput"; + public static final String MOBY_SECONDARYINPUT_PARAM = "mobySecondaryInput"; public static final String MOBY_OUTPUT_PARAM = "mobyOutput"; public static final String MODE_HTTP_PARAM = "mode"; public static final String RDF_MODE = "rdf"; @@ -279,7 +280,9 @@ return mobyRequestContents; } - // throws an exception if the data is not as expected + /** + * Throws an exception if the data in the job does not match the input spec of the service + */ public static void validateArguments(MobyDataJob job, MobyService service, String errMessagePrefix) throws Exception{ @@ -362,6 +365,98 @@ " does not have one of the required namespaces"); } } + + // Check for secondary parameters, and fill in missing ones with the default values + MobySecondaryData[] template2 = service.getSecondaryInputs(); + MobyDataSecondaryInstance[] values2 = job.getSecondaryData(); + + for(MobySecondaryData param: template2){ + MobyDataSecondaryInstance matchingValue = null; + for(MobyDataSecondaryInstance value: values2){ + if(value.getName().equals(param.getName())){ + matchingValue = value; + break; + } + } + + if(matchingValue != null){ + String dataType = param.getDataType(); + // This is the first point at which we have enough info to assign + // a data type to the secondary parameter in the job (it is string by default + // when parsing the XML). + try{ + matchingValue.setDataType(dataType); + } catch(Exception e){ + e.printStackTrace(); // will default to String if unrecognized + } + // Check that the value given is valid + if(dataType.equals(MobySecondaryData.INTEGER_TYPE)){ + BigInteger val = matchingValue.asInteger(); + if(param.getMinValue() != null && param.getMinValue().length() > 0){ + BigInteger min = new BigInteger(param.getMinValue()); + if(min.compareTo(val) > 0){ + // Out of range (too small), reset the value + matchingValue.setValue(min.toString()); + } + } + if(param.getMaxValue() != null && param.getMaxValue().length() > 0){ + BigInteger max = new BigInteger(param.getMaxValue()); + if(max.compareTo(val) < 0){ + // Out of range (too big), reset the value + matchingValue.setValue(max.toString()); + } + } + } + else if(dataType.equals(MobySecondaryData.FLOAT_TYPE)){ + BigDecimal val = matchingValue.asFloat(); + if(param.getMinValue() != null && param.getMinValue().length() > 0){ + BigDecimal min = new BigDecimal(param.getMinValue()); + if(min.compareTo(val) > 0){ + // Out of range (too small), reset the value + matchingValue.setValue(min.toString()); + } + } + if(param.getMaxValue() != null && param.getMaxValue().length() > 0){ + BigDecimal max = new BigDecimal(param.getMaxValue()); + if(max.compareTo(val) < 0){ + // Out of range (too big), reset the value + matchingValue.setValue(max.toString()); + } + } + } + else if(dataType.equals(MobySecondaryData.STRING_TYPE)){ + // Enumerated? + String val = matchingValue.asString(); + String[] allowedVals = param.getAllowedValues(); + if(allowedVals != null && allowedVals.length > 0){ + boolean isInList = false; + for(String allowedVal: allowedVals){ + if(allowedVal != null && allowedVal.equals(val)){ + isInList = true; + break; + } + } + if(!isInList){ + // Illegal value given, use the default instead + matchingValue.setValue(param.getDefaultValue()); + } + } + } + else if(dataType.equals(MobySecondaryData.DATETIME_TYPE)){ + // TODO + } + else if(dataType.equals(MobySecondaryData.BOOLEAN_TYPE)){ + // no issues here... + } + else{ + // what type is this ??? + } + } + else{ + // Missing value, fill it in with the default + job.put(param.getName(), new MobyDataSecondaryInstance(param, param.getDefaultValue())); + } + } } private void writeResponse(HttpServletResponse response, MobyContentInstance mobyResults){ @@ -548,7 +643,7 @@ public synchronized MobyService createServiceFromConfig(HttpServletRequest request) throws Exception{ MobyService service = new MobyService(getServiceName()); - Vector inputTypes = new Vector(); + Vector inputTypes = new Vector(); Vector outputTypes = new Vector(); mobyService ann = @@ -602,6 +697,16 @@ } } + String[] secondaries = ann.secondaryParams(); + if(config != null && config.getInitParameter(MOBY_SECONDARYINPUT_PARAM) != null){ + secondaries = config.getInitParameter(MOBY_SECONDARYINPUT_PARAM).split(","); + } + if(secondaries != null && secondaries.length > 0){ + for(String secondary: secondaries){ + inputTypes.add(stringToSecondaryDataTemplate(secondary)); + } + } + service.setInputs(inputTypes.toArray(new MobyData[inputTypes.size()])); service.setOutputs(outputTypes.toArray(new MobyData[outputTypes.size()])); @@ -746,6 +851,144 @@ } /** + * Strings have the form name:paramType:default:spec where spec depends on the parameter type. + * Currently, these are the valid paramTypes and their specs: + * + *
      • Integer: blank or [,max] or [min,] or [min,max]
      • + *
      • Float: blank or [,max] or [min,] or [min,max]
      • + *
      • String: blank or [choice1,choice2,...]
      • + *
      • DateTime: blank or [,max] or [min,] or [min,max]
      • + *
      • Boolean: blank
      + * + * e.g. db:String:nr:[nr,nt,est,swissprot] + * + * e.g. filter:Boolean:true + * + * e.g. hits:Integer:100:[0,] + */ + public static MobySecondaryData stringToSecondaryDataTemplate(String template) throws Exception{ + String[] fields = template.split(":"); + if(fields.length < 3){ + throw new Exception("The parameter specification (" + + template + ") must have the minimal form " + + "\"name:paramType:defaultValue\", aborting!"); + } + if(fields[0].length() < 1){ + throw new Exception("The parameter specification (" + + template + ") has a blank parameter name, this is not allowed"); + } + if(fields[1].length() < 1){ + throw new Exception("The parameter specification (" + + template + ") has a blank parameter type, this is not allowed"); + } + MobySecondaryData dataTemplate = new MobySecondaryData(fields[0]); + String dataType = fields[1]; + try{ + dataTemplate.setDataType(dataType); // should throw an exception if invalid param type + } catch(Exception e){ + e.printStackTrace(); + throw new Exception("Error in parameter type (" + dataType + "') of secondary " + + "parameters specification '" + template + "': " + e); + } + + String defaultValue = fields[2]; + dataTemplate.setDefaultValue(defaultValue); + + String spec = ""; + int i = 3; + for(; i < fields.length-1; i++){ + spec = spec + fields[i] + ":"; + } + if(i == fields.length-1){ + spec = spec + fields[i]; + } + + // Ensure the [] are there, and strip them + if(spec.length() > 0){ + if(spec.indexOf('[') != 1 || spec.lastIndexOf(']') != spec.length()){ + throw new Exception("Parameter options specification (4th field of '" + + template + "') " + + "does not have the required form '[...]', but rather: " + spec); + } + spec = spec.substring(1, spec.length()); + } + String[] specValues = new String[0]; + if(spec.length() > 0){ + specValues = spec.split(","); + } + + if(dataType.equals(MobySecondaryData.INTEGER_TYPE) || + dataType.equals(MobySecondaryData.FLOAT_TYPE)){ + if(specValues.length > 0){ + if(specValues.length != 2){ + throw new Exception("Numeric parameter options specification (4th field of " + + template + "') " + + "does not have on of the required forms [min,] or [,max] or [min,max]"); + } + BigDecimal min = null; + BigDecimal max = null; + if(specValues[0].length() != 0){ + min = new BigDecimal(specValues[0]); // will throw exception if not a number + } + if(specValues[1].length() != 0){ + max = new BigDecimal(specValues[1]); // will throw exception if not a number + } + // We will actually accept [,] as an unlimited range + if(min != null && max != null && min.compareTo(max) > 0){ + throw new Exception("Numeric parameter range (4th field of " + template + "') " + + "has a minimum value greater than the maximum value"); + } + BigDecimal defaultNumber = new BigDecimal(defaultValue); // will throw exception if not a number + if(min != null){ + if(min.compareTo(defaultNumber) > 0){ + throw new Exception("Numeric parameter default (3rd field of " + template + "') " + + "is less than the minimum value specified"); + } + } + if(min != null){ + if(max.compareTo(defaultNumber) < 0){ + throw new Exception("Numeric parameter default (3rd field of " + template + "') " + + "is greater than the maximum value specified"); + } + } + } + } + else if(dataType.equals(MobySecondaryData.STRING_TYPE)){ + if(specValues.length > 0){ // an enumeration + boolean defaultListed = false; + for(String value: specValues){ + if(defaultValue.equals(value)){ + defaultListed = true; + break; + } + } + if(!defaultListed){ + throw new Exception("The default value (" + defaultValue + + ") was not listed in the enumeration (" + + spec + ")"); + } + + dataTemplate.setAllowedValues(specValues); + } + // otherwise it's a freeform string + } + else if(dataType.equals(MobySecondaryData.BOOLEAN_TYPE)){ + if(specValues.length > 0){ + throw new Exception("Boolean secondary parameter specification provided " + + "superfluous fields (only 3 needed): " + spec); + } + } + else if(dataType.equals(MobySecondaryData.DATETIME_TYPE)){ + // TODO + } + else{ + throw new Exception("Unrecognized secondary data type encountered: " + dataType); + } + + return dataTemplate; + } + + /** * Strings have the form name:objectType:namespace, with ":namespace" optional * If the input is expected to be a Collection, then the syntax is name:Collection(objectType):namespace */ @@ -753,21 +996,18 @@ StringTokenizer st = new StringTokenizer(spec, ":"); String name = st.nextToken(); if(name == null || name.length() == 0){ - System.err.println("Anonymous parameters are not allowed in service calls (" + - spec + "), aborting!"); - System.exit(1); + throw new Exception("Anonymous parameters are not allowed in service calls (" + + spec + "), aborting!"); } if(!st.hasMoreTokens()){ - System.err.println("The parameter specification (" + - spec + ") must have the minimal form " + - "\"name:objectType\", aborting!"); - System.exit(1); + throw new Exception("The parameter specification (" + + spec + ") must have the minimal form " + + "\"name:objectType\", aborting!"); } String objectType = st.nextToken(); if(objectType == null || objectType.length() == 0){ - System.err.println("The parameter specification (" + + throw new Exception("The parameter specification (" + spec + ") has a blank object type, aborting!"); - System.exit(1); } MobyPrimaryData dataTemplate = null; @@ -785,11 +1025,10 @@ MobyDataType type = MobyDataType.getDataType(objectType); if(type == null){ - System.err.println("The parameter specification (" + - spec + ") has a data type not found in the " + - "MOBY registry, aborting! (Either correct the type," + - " or register it as a new type in MOBY Central"); - System.exit(1); + throw new Exception("The parameter specification (" + + spec + ") has a data type not found in the " + + "MOBY registry, aborting! (Either correct the type," + + " or register it as a new type in MOBY Central"); } dataTemplate.setDataType(type); if(isCollection){ From mwilkinson at dev.open-bio.org Thu Dec 7 12:23:41 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 7 Dec 2006 12:23:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071723.kB7HNfTT030030@dev.open-bio.org> mwilkinson Thu Dec 7 12:23:41 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv29991/MOBY/Client Modified Files: Service.pm Log Message: untested. It should now handle POST services and create valid POST WSDL. not tested. moby-live/Perl/MOBY/Client Service.pm,1.25,1.26 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/07/07 22:25:12 1.25 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/07 17:23:41 1.26 @@ -67,7 +67,8 @@ uri => [ undef, 'read/write' ], serviceName => [ undef, 'read/write' ], _soapService => [ undef, 'read/write' ], - smessageVersion => ['0.87', 'read' ], + smessageVersion => ['0.88', 'read' ], + category => [undef, 'read/write'], ); #_____________________________________________________________ @@ -118,9 +119,11 @@ #print OUT $self->service; #close OUT; # ________________________________________ - my $wsdl = - URI::Escape::uri_escape( $self->service ); # this seems to fix the bug + my $wsdl = URI::Escape::uri_escape( $self->service ); # this seems to fix the bug return undef unless $wsdl; + if ($wsdl =~ //){ + $self->category('post'); + } my $soap = SOAP::Lite->service( "data:,$wsdl" ); if ( $self->uri ) { $soap->uri( $self->uri ) } $self->serviceName( &_getServiceName( $soap ) ); @@ -284,9 +287,17 @@ my $METHOD = $self->serviceName; &_LOG( %args, $METHOD ); my $response; - eval { ( $response ) = $self->_soapService->$METHOD( $data ) }; - if ($@) { die "Service execution failed: $@"} - else {return $response;} # the service execution failed then pass back "" + + if ($self->category eq 'post'){ + my $d = SOAP::Data->name('data' => $data); + eval { ( $response ) = $self->_soapService->$METHOD($d) }; + if ($@) { die "Service execution failed: $@"} + else {return $response;} # the service execution failed then pass back "" + } elsif ($self->category eq 'moby'){ + eval { ( $response ) = $self->_soapService->$METHOD( $data ) }; + if ($@) { die "Service execution failed: $@"} + else {return $response;} # the service execution failed then pass back "" + } } =head2 serviceName From mwilkinson at dev.open-bio.org Thu Dec 7 12:23:41 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 7 Dec 2006 12:23:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071723.kB7HNfNa030012@dev.open-bio.org> mwilkinson Thu Dec 7 12:23:41 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv29991/MOBY Modified Files: Central.pm Log Message: untested. It should now handle POST services and create valid POST WSDL. not tested. moby-live/Perl/MOBY Central.pm,1.263,1.264 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.263 retrieving revision 1.264 diff -u -r1.263 -r1.264 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/07 16:18:04 1.263 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/07 17:23:41 1.264 @@ -9,7 +9,7 @@ package MOBY::Central; use strict; use Carp; -use vars qw($AUTOLOAD $WSDL_TEMPLATE); +use vars qw($AUTOLOAD $WSDL_TEMPLATE $WSDL_POST_TEMPLATE); use XML::LibXML; use MOBY::OntologyServer; use MOBY::service_type; @@ -3201,11 +3201,52 @@ # the lines below causes no end of grief. It is now in a variable. #open (WSDL, "./MOBY/Central_WSDL_SandR.wsdl") || die "can't open WSDL file for search and replace\n"; #my $wsdl = join "", (); - my $wsdl = $WSDL_TEMPLATE; - $wsdl =~ s/^\n//gs; #close WSDL; # do substitutions + my $serviceType = $SI->category; + my $wsdl; + if ($serviceType eq "post"){ + $wsdl = &_doPostWSDLReplacement(@_) + } elsif ($serviceType eq "moby"){ + $wsdl = &_doMobyWSDLReplacement(@_) + } + return $wsdl; +} + +sub _doPostWSDLReplacement { + my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; + my $wsdl = $WSDL_POST_TEMPLATE; + $wsdl =~ s/^\n//gs; + my $serviceName = $SI->servicename; + my $AuthURI = $SI->authority_uri; + my $desc = $SI->description; + if ( $desc =~ /[^\]]+))\]\]>/ ) { + $desc = $1; + } + $desc =~ s"\<"<"g; # XMl encode now that it is not CDATAd + $desc =~ s"\>">"g; # XML encode now that it is not CDATAd + my $URL = $SI->url; + $URL =~ "http://(^/+)/(.*)"; + my $baseURL = $1; + my $relativeURL = $2; + my $IN = "NOT_YET_DEFINED_INPUTS"; + my $OUT = "NOT_YET_DEFINED_OUTPUTS"; + my $INxsd = &_getInputXSD( $InputXML, $SecondaryXML ); + my $OUTxsd = &_getOutputXSD($OutputXML); + $INxsd ||= ""; + $OUTxsd ||= ""; + $wsdl =~ s/MOBY__SERVICE__NAME__/$serviceName/g; # replace all of the goofy portbindingpottype crap + $wsdl =~s/\<\!\-\-\s*MOBY__SERVICE__DESCRIPTION\s*\-\-\>/Authority: $AuthURI - $desc/g; # add a sensible description + $wsdl =~ s/MOBY__SERVICE__URL/$baseURL/g; # the URL to the service + $wsdl =~ s/MOBY__SERVICE__POST/$relativeURL/g; # the URL to the service + $wsdl =~ s/MOBY__SERVICE__NAME/$serviceName/g; # finally replace the actual subroutine call +} + +sub _doMobyWSDLReplacement { + my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; + my $wsdl = $WSDL_TEMPLATE; + $wsdl =~ s/^\n//gs; my $serviceName = $SI->servicename; my $AuthURI = $SI->authority_uri; my $desc = $SI->description; @@ -3224,16 +3265,11 @@ $wsdl =~ s/MOBY__SERVICE__NAME__/$serviceName/g; # replace all of the goofy portbindingpottype crap $wsdl =~s/\<\!\-\-\s*MOBY__SERVICE__DESCRIPTION\s*\-\-\>/Authority: $AuthURI - $desc/g; # add a sensible description $wsdl =~ s/MOBY__SERVICE__URL/$URL/g; # the URL to the service - #if (scalar @in){my ($IN, $INxsd) = @{shift @in}}; - #if (scalar @out){my ($OUT, $OUTxsd) = @{shift @out}}; -# $wsdl =~ s/MOBY__INPUT__OBJECT__NAME/$IN/g; # SINGLE input object (for now) -# $wsdl =~ s/MOBY__OUTPUT__OBJECT__NAME/$OUT/g; # SINGLE output object (for now) -# $wsdl =~ s/\<\!\-\-\s*MOBY__INPUT__OBJECT__XSD\s*\-\-\>/$INxsd/g; # XSD stright from the database -# $wsdl =~ s/\<\!\-\-\s*MOBY__OUTPUT__OBJECT__XSD\s*\-\-\>/$OUTxsd/g; # XSD straight from the database - $wsdl =~ s/MOBY__SERVICE__NAME/$serviceName/g; # finally replace the actual subroutine call - return $wsdl; + $wsdl =~ s/MOBY__SERVICE__NAME/$serviceName/g; # finally replace the actual subroutine call + return $wsdl } + #sub _getCGIService { # my ( $dbh, $sth_hash, $id, $serviceName, $AuthURI, $URL, $desc, $category ) # = @_; @@ -3808,6 +3844,61 @@ END + + +$WSDL_POST_TEMPLATE = < + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +END + + =head2 _getInputXSD name : _getInputXSD($InputXML, $SecondaryXML) From gordonp at dev.open-bio.org Thu Dec 7 13:41:00 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 13:41:00 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071841.kB7If08J030510@dev.open-bio.org> gordonp Thu Dec 7 13:41:00 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Clients In directory dev.open-bio.org:/tmp/cvs-serv30475/src/Clients Modified Files: TestingCentral.java Log Message: Updates for secondary param data type checking moby-live/Java/src/Clients TestingCentral.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Clients/TestingCentral.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/Clients/TestingCentral.java 2005/10/27 04:15:23 1.9 +++ /home/repository/moby/moby-live/Java/src/Clients/TestingCentral.java 2006/12/07 18:41:00 1.10 @@ -87,7 +87,11 @@ *************************************************************************/ protected MobySecondaryData createSecondaryData (String objectName, String type) { MobySecondaryData data = new MobySecondaryData (objectName); - data.setDataType (type); + try{ + data.setDataType (type); + } catch(Exception e){ + e.printStackTrace(); // will default to String if unrecognized + } if (type.equalsIgnoreCase ("Integer")) { data.setDefaultValue ("123"); data.setMaximumValue (234); From mwilkinson at dev.open-bio.org Fri Dec 8 09:29:55 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 8 Dec 2006 09:29:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612081429.kB8ETt5q000878@dev.open-bio.org> mwilkinson Fri Dec 8 09:29:55 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv841/MOBY/Client Modified Files: Service.pm Log Message: this code is ALMOST CERTAINLY BROKEN so please don't check out the registry right now. I just need to get it on to Heiko's machine so we can test it further moby-live/Perl/MOBY/Client Service.pm,1.26,1.27 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/07 17:23:41 1.26 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 14:29:55 1.27 @@ -120,6 +120,8 @@ #close OUT; # ________________________________________ my $wsdl = URI::Escape::uri_escape( $self->service ); # this seems to fix the bug +# my $wsdl = $self->service; + return undef unless $wsdl; if ($wsdl =~ //){ $self->category('post'); From mwilkinson at dev.open-bio.org Fri Dec 8 10:15:05 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 8 Dec 2006 10:15:05 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612081515.kB8FF5hS001027@dev.open-bio.org> mwilkinson Fri Dec 8 10:15:05 EST 2006 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv1008/MOBY-S_API Modified Files: MobyCentralObjects.html Log Message: documentation error Protocol should be Category moby-live/Docs/MOBY-S_API MobyCentralObjects.html,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2006/11/21 23:04:27 1.7 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2006/12/08 15:15:05 1.8 @@ -167,7 +167,7 @@ </Output> </outputObjects> <serviceType>ServiceTypeTerm</serviceType> - <Protocol>moby</Protocol> + <Category>moby</Category> <authURI>desired.service.provider</authURI> <signatureURL>http://location.to/service/description</signatureURL> <serviceName>MyServiceName</serviceName>; From mwilkinson at dev.open-bio.org Fri Dec 8 10:46:44 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 8 Dec 2006 10:46:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612081546.kB8FkiIa001306@dev.open-bio.org> mwilkinson Fri Dec 8 10:46:44 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv1287/MOBY/Client Modified Files: Service.pm Log Message: okay, fixed now. It should work moby-live/Perl/MOBY/Client Service.pm,1.27,1.28 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 14:29:55 1.27 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 15:46:44 1.28 @@ -68,7 +68,7 @@ serviceName => [ undef, 'read/write' ], _soapService => [ undef, 'read/write' ], smessageVersion => ['0.88', 'read' ], - category => [undef, 'read/write'], + category => ['moby', 'read/write'], ); #_____________________________________________________________ From mwilkinson at dev.open-bio.org Fri Dec 8 11:16:41 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 8 Dec 2006 11:16:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612081616.kB8GGfs7001561@dev.open-bio.org> mwilkinson Fri Dec 8 11:16:41 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv1542/MOBY/Client Modified Files: Service.pm Log Message: MOBY can now execute HTTP POST services. register as category 'post'. prepare your service to accept a single named POST parameter called 'data'. the content of 'data' is a full block of MOBY XML, including the xml header and moby:MOBY etc elements moby-live/Perl/MOBY/Client Service.pm,1.28,1.29 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 15:46:44 1.28 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 16:16:41 1.29 @@ -110,6 +110,10 @@ $self->{$attrname} = $self->_default_for( $attrname ); } } + my $wsdl = $self->service; + if ($wsdl =~ //){ + $self->category('post'); + } #my $dir = cwd; # seems to be a bug in SOAP::Lite that the WSDL document @@ -119,13 +123,9 @@ #print OUT $self->service; #close OUT; # ________________________________________ - my $wsdl = URI::Escape::uri_escape( $self->service ); # this seems to fix the bug -# my $wsdl = $self->service; + $wsdl = URI::Escape::uri_escape( $self->service ); # this seems to fix the bug return undef unless $wsdl; - if ($wsdl =~ //){ - $self->category('post'); - } my $soap = SOAP::Lite->service( "data:,$wsdl" ); if ( $self->uri ) { $soap->uri( $self->uri ) } $self->serviceName( &_getServiceName( $soap ) ); @@ -290,18 +290,52 @@ &_LOG( %args, $METHOD ); my $response; - if ($self->category eq 'post'){ - my $d = SOAP::Data->name('data' => $data); - eval { ( $response ) = $self->_soapService->$METHOD($d) }; - if ($@) { die "Service execution failed: $@"} - else {return $response;} # the service execution failed then pass back "" - } elsif ($self->category eq 'moby'){ + if ($self->category eq 'moby'){ eval { ( $response ) = $self->_soapService->$METHOD( $data ) }; if ($@) { die "Service execution failed: $@"} else {return $response;} # the service execution failed then pass back "" + } elsif ($self->category eq 'post'){ + my $response = $self->_executePOSTService(data => $data, method => $METHOD); + # currently SOAP::Lite does not execute POST WSDL, so we need to + # use LWP or something like that in the executePOSTService method + #eval { ( $response ) = $self->_soapService->$METHOD( $data ) }; + unless ($response){ die "Service execution failed: $@"} + else {return $response;} # the service execution failed then pass back "" } } +sub _executePOSTService { + my ($self, %args) = @_; + my $serviceName = $args{method}; + my $data = $args{data}; + my $wsdl = $self->service; + $wsdl =~ /address\slocation=['"]([^'"]+)/s; + my $location = $1; + $wsdl =~/operation\slocation=['"]([^'"]+)/s; + my $path = $1; + use LWP::UserAgent; + my $ua = LWP::UserAgent->new; + + # Create a request + my $req = HTTP::Request->new(POST => "$location/$path"); + $req->content_type('application/x-www-form-urlencoded'); + $req->content('data=$data'); + + # Pass request to the user agent and get a response back + my $res = $ua->request($req); + my $result; + # Check the outcome of the response + if ($res->is_success) { + $result = $res->content; + } + else { + $result = ""; + } + return $result; +} + + + =head2 serviceName Usage : $name = $Service->serviceName() From gordonp at dev.open-bio.org Fri Dec 8 16:10:52 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 8 Dec 2006 16:10:52 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612082110.kB8LAqtf002012@dev.open-bio.org> gordonp Fri Dec 8 16:10:52 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv1971 Modified Files: deployingServices.html index.html Added Files: servletSecondaries.html Log Message: Updated secondary article docs moby-live/Java/docs servletSecondaries.html,NONE,1.1 deployingServices.html,1.11,1.12 index.html,1.29,1.30 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/deployingServices.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/12/06 16:07:10 1.11 +++ /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/12/08 21:10:52 1.12 @@ -3,11 +3,11 @@ - Ridiculously Easy MOBY Service Creation + Super-Easy MOBY Service Creation -

      Ridiculously Easy MOBY Service Creation

      +

      Super-Easy MOBY Service Creation

      What is this?

      @@ -151,7 +151,8 @@ the base MobyServlet to do all the input type checking for you. If you've specified the annotation correctly, you are guaranteed that processRequest will only receive syntactically and semantically valid data. The same annotation is eventually used to publish your service's meta-data to - MOBY Central.

      + MOBY Central. If want to specify secondary parameters for a service, + look here for the syntax

      That's it for the coding. Really! Now compile it (Ant will automatically fetch the MobyServlet.war you are extending), running the following command in the same @@ -224,7 +225,7 @@ If the service fails, a useful error message should be printed to help you diagnose the problem. This would usually be because the data type you return isn't what you declared (this is the first occasion your output is thoroughly checked). - If you get a java.lang.NoClassDefFoundError, please see the notes below. If that doesn't help, + If you get a java.lang.NoClassDefFoundError, please let me know (gordonp @ ucalgary.ca) and I'll try to help you: @@ -323,7 +324,7 @@

      Paul Gordon
      -Last modified: Wed Dec 6 08:39:50 MST 2006 +Last modified: Fri Dec 8 12:49:28 MST 2006 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/index.html,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- /home/repository/moby/moby-live/Java/docs/index.html 2006/12/06 16:25:51 1.29 +++ /home/repository/moby/moby-live/Java/docs/index.html 2006/12/08 21:10:52 1.30 @@ -140,7 +140,9 @@
    • How to develop a BioMoby service, an alternate mechanism for the Extremely Lazy, Complete -Idiots, Dummies, etc. +Idiots, Dummies, etc. (a.k.a. "MobyServlet") +
    • A note on using secondary articles with MobyServlet
    • The org.biomoby.shared.data package "In Anger": creating data instances
    • @@ -190,7 +192,7 @@
      Martin Senger
      -Last modified: Wed Dec 6 09:24:31 MST 2006 +Last modified: Fri Dec 8 14:09:26 MST 2006
      From gordonp at dev.open-bio.org Mon Dec 11 10:59:26 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 10:59:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111559.kBBFxQhh032280@dev.open-bio.org> gordonp Mon Dec 11 10:59:25 EST 2006 Update of /home/repository/moby/jars-archive/current In directory dev.open-bio.org:/tmp/cvs-serv32245 Modified Files: MobyServlet.war Log Message: Better secondary article support, fixed obscure Collection instance naming bug jars-archive/current MobyServlet.war,1.8,1.9 =================================================================== RCS file: /home/repository/moby/jars-archive/current/MobyServlet.war,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 Binary files /home/repository/moby/jars-archive/current/MobyServlet.war 2006/12/06 15:09:02 1.8 and /home/repository/moby/jars-archive/current/MobyServlet.war 2006/12/11 15:59:25 1.9 differ rcsdiff: /home/repository/moby/jars-archive/current/MobyServlet.war: diff failed From gordonp at dev.open-bio.org Mon Dec 11 13:36:07 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 13:36:07 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111836.kBBIa7vu032726@dev.open-bio.org> gordonp Mon Dec 11 13:36:07 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv32687 Modified Files: build.xml mobyService.properties Log Message: Simplified Ant spec. even further moby-live/Java/xmls/servlet build.xml,1.2,1.3 mobyService.properties,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/servlet/build.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/xmls/servlet/build.xml 2006/12/06 17:55:29 1.2 +++ /home/repository/moby/moby-live/Java/xmls/servlet/build.xml 2006/12/11 18:36:07 1.3 @@ -1,6 +1,7 @@ + This is an Ant build file for creating and registering a Moby Service. @@ -17,13 +18,60 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + @@ -33,10 +81,10 @@ - + - + @@ -49,7 +97,7 @@ - + @@ -58,41 +106,42 @@ - + - - - - + + + + - - - - + + + + - - + + + - - + + - - - - + + + + @@ -102,16 +151,16 @@ - + - + - + @@ -132,85 +181,87 @@ - + - + - + - + - + - + - + - + - - + - + - - + - + - - + - + - - + - + - - + + - - + + - - + + @@ -226,11 +277,12 @@ - + + + - =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/06 18:37:51 1.3 +++ /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/11 18:36:07 1.4 @@ -1,24 +1,18 @@ -# Where the project directory is located. -project.dir=/export/home/gordonp/development/service - -# Where the Java source directory is located. -src.dir=${project.dir}/src +# Where the project directory is located, by default it's the same as the Ant working directory: uncomment to change +# project.dir=/export/home/gordonp/development/service +# Where the Java source directory is located (relative to project.dir). +src.dir=src +# Where any and all 3rd party libraries for your code are stored (relative to project.dir). +lib.dir=lib # The package-qualified location of your main class's source code (the one extending MobyServlet). main.class.file=org/biomoby/service/test/ConvertAAtoFASTA_AA.java -# Where all 3rd party libraries for your code are stored. -lib.dir=${project.dir}/lib - # Name of the output WAR archive to be generated (will also be the servlet name). my.servlet.war.file=ConvertAAtoFASTA_AA.war # The location of a test MOBY XML input data file (used as input to test your service). input.data.file=${project.dir}/mobyAASeq.xml -# Java Servlet host URL -servlet.host.url=http://moby.ucalgary.ca - -# Java Servlet port -servlet.port=8089 - +# Your Java Servlet host URL (with port) +servlet.host.url=http://moby.ucalgary.ca:8089 From gordonp at dev.open-bio.org Mon Dec 11 13:36:42 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 13:36:42 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111836.kBBIagV8000301@dev.open-bio.org> gordonp Mon Dec 11 13:36:42 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv32734 Modified Files: deployingServices.html Log Message: Simplified Ant spec. even further moby-live/Java/docs deployingServices.html,1.12,1.13 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/deployingServices.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/12/08 21:10:52 1.12 +++ /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/12/11 18:36:42 1.13 @@ -58,32 +58,24 @@

      Step 1: Configure your build enviroment

      You need to tell Ant where your code and servlet container are located. This is done by modifying the - mobyService.properties file you just downloaded: + mobyService.properties file you just downloaded, customizing it for your site:
      -# Where the project directory is located.
      -project.dir=/home/gordonp/development/fastaConverter
      +# Where the Java source directory is located (relative to project.dir).
      +src.dir=src
      +# Where any and all 3rd party libraries for your code are stored (relative to project.dir).
      +lib.dir=lib
       
      -# Where the Java source directory is located.
      -src.dir=${project.dir}/src
      -
      -# The package-qualified location of your main class (the one extending MobyServlet).
      -# You could have no package, or org/bar/foo, etc. in a real service
      +# The package-qualified location of your main class's source code (the one extending MobyServlet).
       main.class.file=org/biomoby/service/test/ConvertAAtoFASTA_AA.java
       
      -# Where all 3rd party libraries for your code are stored.
      -lib.dir=${project.dir}/lib
      -
       # Name of the output WAR archive to be generated (will also be the servlet name).
       my.servlet.war.file=ConvertAAtoFASTA_AA.war
       
      -# The location of a test MOBY XML input data file (use as input to test your service).
      +# The location of a test MOBY XML input data file (used as input to test your service).
       input.data.file=${project.dir}/mobyAASeq.xml
       
      -# Your Java Servlet host URL
      -servlet.host.url=http://moby.ucalgary.ca
      -
      -# Your Java Servlet port
      -servlet.port=8089
      +# Your Java Servlet host URL (with port)
      +servlet.host.url=http://moby.ucalgary.ca:8089
       

      @@ -324,7 +316,7 @@
      Paul Gordon
      -Last modified: Fri Dec 8 12:49:28 MST 2006 +Last modified: Mon Dec 11 11:28:17 MST 2006 From gordonp at dev.open-bio.org Mon Dec 11 13:37:21 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 13:37:21 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111837.kBBIbLPA000345@dev.open-bio.org> gordonp Mon Dec 11 13:37:21 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv310 Modified Files: Seahawk.html Log Message: Mention possibility to build the servlet war from a jMOBY CVS Ant target moby-live/Java/docs Seahawk.html,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Seahawk.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/docs/Seahawk.html 2006/11/23 03:34:49 1.4 +++ /home/repository/moby/moby-live/Java/docs/Seahawk.html 2006/12/11 18:37:21 1.5 @@ -69,9 +69,10 @@

      The jar (Java archive) file containing all of the required classes (including those from Axis, Jena, Xalan, Xerces, etc.) is available - here. Note that this JAR - is signed by the University of Calgary Bioinformatics Lab. This jar file - can be used as an application with the command: + here, and is + signed by the University of Calgary Bioinformatics Lab. You can also + build your own version of the jar with the jMOBY cvs Ant target "servlet-war". + Either jar file can be used as an application with the command:

      java -jar seahawk.jar
      If there is sufficient demand, I'll make a nice graphical installer for it.

      @@ -121,7 +122,7 @@
      Paul Gordon
      -Last modified: Wed Nov 22 20:32:48 MST 2006 +Last modified: Mon Dec 11 08:49:26 MST 2006 From gordonp at dev.open-bio.org Mon Dec 11 13:58:58 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 13:58:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111858.kBBIww6I000682@dev.open-bio.org> gordonp Mon Dec 11 13:58:58 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv643/src/main/org/biomoby/shared/data Modified Files: MobyDataObjectSetSAI.java MobyContentInstance.java Log Message: Fixed collection instance naming bug moby-live/Java/src/main/org/biomoby/shared/data MobyDataObjectSetSAI.java,1.1,1.2 MobyContentInstance.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSetSAI.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSetSAI.java 2006/07/07 04:12:40 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSetSAI.java 2006/12/11 18:58:58 1.2 @@ -116,7 +116,7 @@ } public int hashCode(){ - return dataInstance.hashCode(); + return dataInstance == null ? super.hashCode() : dataInstance.hashCode(); } public void clear(){ @@ -164,6 +164,13 @@ } public String toXML(){ - return dataInstance.toXML(); + // We have to temporarily rename the data instance, because it's XML + // representation in service mode should include the article name set + // for this object instance, not the data instance + String oldName = dataInstance.getName(); + dataInstance.setName(getName()); + String result = dataInstance.toXML(); + dataInstance.setName(oldName); + return result; } } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/12/06 16:07:10 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/12/11 18:58:58 1.8 @@ -443,7 +443,13 @@ dataObject.toXML()+ ""); } - // Either a collection or a secondary input parameter + else if(dataObject instanceof MobyDataObjectSet){ + String oldName = dataObject.getName(); + dataObject.setName(paramName); + xml.append(dataObject.toXML()); + dataObject.setName(oldName); + } + // a secondary input parameter else{ xml.append(dataObject.toXML()); } From gordonp at dev.open-bio.org Mon Dec 11 13:59:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 13:59:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111859.kBBIxapV000725@dev.open-bio.org> gordonp Mon Dec 11 13:59:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv690/src/main/org/biomoby/shared/data Modified Files: MobyDataObjectSet.java Log Message: Set default mode to match other instance objects (central, not service) moby-live/Java/src/main/org/biomoby/shared/data MobyDataObjectSet.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java 2006/07/07 04:12:40 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java 2006/12/11 18:59:36 1.6 @@ -30,7 +30,7 @@ public class MobyDataObjectSet extends MobyPrimaryDataSet implements MobyDataInstance, Collection{ Vector bag; - private int xmlMode = MobyDataInstance.SERVICE_XML_MODE; + private int xmlMode = MobyDataInstance.CENTRAL_XML_MODE; public MobyDataObjectSet(org.w3c.dom.Element e) throws MobyException{ this(MobyDataObject.getName(e), getChildren(e)); @@ -396,7 +396,7 @@ * Implemented solely because of the general contract that c1.equals(c2) implies that c1.hashCode()==c2.hashCode() */ public int hashCode(){ - return bag.hashCode(); + return bag == null ? super.hashCode() : bag.hashCode(); } /** @@ -504,7 +504,7 @@ public int getXmlMode(){ return xmlMode; } - + /** * Wraps the simple instances' XML in a MOBY Collection tag */ From gordonp at dev.open-bio.org Mon Dec 11 14:00:07 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 14:00:07 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111900.kBBJ07Hr000768@dev.open-bio.org> gordonp Mon Dec 11 14:00:07 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv733/src/main/org/biomoby/shared/data Modified Files: MobyDataJob.java Log Message: Fixed comment typo moby-live/Java/src/main/org/biomoby/shared/data MobyDataJob.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataJob.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataJob.java 2006/07/07 04:12:40 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataJob.java 2006/12/11 19:00:07 1.2 @@ -1,6 +1,6 @@ /** * Groups together the primary and secondary data corresponding to a MOBY XML "mobyData" block, i.e. - * a request for, or response from, a service. Onme or more MobyDataJobs can be put in one MobyContentInstance + * a request for, or response from, a service. One or more MobyDataJobs can be put in one MobyContentInstance * to form a service invocation request/response (they are symmetric in MOBY). It is essentially just a Java Map, * but with some convenience methods for grabbing different types of data. Put data into this object as you * would with any Map. From gordonp at dev.open-bio.org Mon Dec 11 14:02:01 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 14:02:01 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111902.kBBJ21Sp000953@dev.open-bio.org> gordonp Mon Dec 11 14:02:01 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv922/docs Added Files: deployingServicesBasic.html Log Message: Non-ant way to use MobyServlet moby-live/Java/docs deployingServicesBasic.html,NONE,1.1 From gordonp at dev.open-bio.org Wed Dec 13 12:53:58 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 13 Dec 2006 12:53:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612131753.kBDHrwGT010372@dev.open-bio.org> gordonp Wed Dec 13 12:53:57 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv10329/src/main/org/biomoby/shared/data Modified Files: MobyDataComposite.java MobyDataObject.java MobyDataXref.java Log Message: Added support for cross-reference deserialization from XML moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.8,1.9 MobyDataObject.java,1.11,1.12 MobyDataXref.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2006/10/26 00:30:27 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2006/12/13 17:53:57 1.9 @@ -40,16 +40,26 @@ int numSubstructures = substructures.getLength(); for(int i = 0; i < numSubstructures; i++){ org.w3c.dom.Element child = (org.w3c.dom.Element) substructures.item(i); - // If the child element doesn't have a name, this - // will be a problem for member association (i.e. it's an anonymous variable) - String fieldName = getName(child); - if(fieldName == null){ - throw new IllegalArgumentException("The subelement with index " + i + - " does not have an article " + - "name, which is required"); + if(child.getLocalName().equals("CrossReference")){ + addCrossReferences(child); + } + // Not yet implemented +// else if(child.getLocalName().equals("ProvisionInformation")){ +// addProvisionInfo(child); +// } + else{ + // If the child element doesn't have a name, this + // will be a problem for member association (i.e. it's an anonymous variable) + String fieldName = getName(child); + if(fieldName == null || fieldName.length() == 0){ + throw new IllegalArgumentException("The subelement with index " + i + + " does not have an article " + + "name, which is required"); + } + + // TODO, must deal with 1-to-many HAS relationship + children.put(fieldName, (MobyDataObject) createInstanceFromDOM(child)); } - // TODO, must deal with 1-to-many HAS relationship - children.put(fieldName, (MobyDataObject) createInstanceFromDOM(child)); } putAll(children); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2006/10/30 15:54:39 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2006/12/13 17:53:57 1.12 @@ -381,9 +381,39 @@ return "[Object]"; } + public void addCrossReferences(Element e) throws MobyException{ + if(e == null){ + throw new NullPointerException("Cannot add a null cross-reference element to an object"); + } + if(e.getLocalName() == null){ + throw new NullPointerException("Element name is null when trying to add cross-reference element"); + } + if(!e.getLocalName().equals("CrossReference")){ + throw new NullPointerException("Cannot add an element named '"+e.getLocalName()+ + "' as a CrossReference element"); + } + + NodeList substructures = MobyPrefixResolver.getChildElements(e, "*"); //wildcard + int numSubstructures = substructures.getLength(); + for(int i = 0; i < numSubstructures; i++){ + Element child = (Element) substructures.item(i); + String objectClass = child.getLocalName(); + if("Object".equals(objectClass)){ + new MobyDataObject(child); + } + else if("Xref".equals(objectClass)){ + new MobyDataXref(child); + } + else{ + throw new MobyException("Cross-reference block contained an illegal child element ("+objectClass+ + "), only 'Object' and 'Xref' are allowed"); + } + } + } + public void addCrossReference(MobyDataObject mdsi) throws NullPointerException{ if(mdsi == null){ - throw new NullPointerException("Cannot add a null crossreference to an object"); + throw new NullPointerException("Cannot add a null cross-reference to an object"); } // Hasn't been initialized yet? =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java 2006/07/07 04:12:40 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java 2006/12/13 17:53:57 1.6 @@ -65,6 +65,21 @@ getService().setAuthority(authURI); } + public MobyDataXref(Element e) throws MobyException{ + this(getNamespace(e).getName(), + getId(e), + MobyPrefixResolver.getAttr(e, "serviceName"), + MobyPrefixResolver.getAttr(e, "authURI")); + + setEvidenceCode(MobyPrefixResolver.getAttr(e, "evidenceCode")); + setXrefType(MobyPrefixResolver.getAttr(e, "xrefType")); + + String d = e.getTextContent(); + if(d != null && d.length() > 0){ + setDescription(d); + } + } + /** * Build an Xref based on an existing object. * The namespace and id will be kept, everything else ignored as they don't From gordonp at dev.open-bio.org Wed Dec 13 18:15:58 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 13 Dec 2006 18:15:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612132315.kBDNFwir011474@dev.open-bio.org> gordonp Wed Dec 13 18:15:58 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv11431/src/main/org/biomoby/shared/data Modified Files: MobyDataComposite.java MobyDataObject.java MobyProvisionInfo.java Log Message: Use more MobyTags values instead of hardcoding, added ProvisionInformation deserialization support moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.9,1.10 MobyDataObject.java,1.12,1.13 MobyProvisionInfo.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2006/12/13 17:53:57 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2006/12/13 23:15:58 1.10 @@ -15,6 +15,7 @@ import org.biomoby.shared.MobyNamespace; import org.biomoby.shared.MobyPrefixResolver; import org.biomoby.shared.MobyRelationship; +import org.biomoby.shared.parser.MobyTags; /** * This class implements the ConcurrentMap interface to allow for the easy @@ -40,13 +41,12 @@ int numSubstructures = substructures.getLength(); for(int i = 0; i < numSubstructures; i++){ org.w3c.dom.Element child = (org.w3c.dom.Element) substructures.item(i); - if(child.getLocalName().equals("CrossReference")){ + if(child.getLocalName().equals(MobyTags.CROSSREFERENCE)){ addCrossReferences(child); } - // Not yet implemented -// else if(child.getLocalName().equals("ProvisionInformation")){ -// addProvisionInfo(child); -// } + else if(child.getLocalName().equals(MobyTags.PROVISIONINFORMATION)){ + addProvisionInfo(child); + } else{ // If the child element doesn't have a name, this // will be a problem for member association (i.e. it's an anonymous variable) =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2006/12/13 17:53:57 1.12 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2006/12/13 23:15:58 1.13 @@ -17,6 +17,7 @@ import org.w3c.dom.NodeList; import org.biomoby.shared.*; +import org.biomoby.shared.parser.MobyTags; /** * A class representing a MOBY object that has been instantiated. @@ -53,7 +54,7 @@ */ public MobyDataObject(String name){ super(name); - setDataType(MobyDataType.getDataType("Object")); + setDataType(MobyDataType.getDataType(MobyTags.MOBYOBJECT)); } /** @@ -61,7 +62,7 @@ */ public MobyDataObject(String namespace, String id){ super(""); - setDataType(MobyDataType.getDataType("Object")); + setDataType(MobyDataType.getDataType(MobyTags.MOBYOBJECT)); setId(id); MobyNamespace nsObj = MobyNamespace.getNamespace(namespace); @@ -94,22 +95,22 @@ return null; } - if("Object".equals(typeName)){ + if(MobyTags.MOBYOBJECT.equals(typeName)){ return new MobyDataObject("", value); } - else if("Integer".equals(typeName)){ + else if(MobyTags.MOBYINTEGER.equals(typeName)){ return new MobyDataInt("", value); } - else if("Float".equals(typeName)){ + else if(MobyTags.MOBYFLOAT.equals(typeName)){ return new MobyDataFloat("", value); } - else if("String".equals(typeName)){ + else if(MobyTags.MOBYSTRING.equals(typeName)){ return new MobyDataString("", value); } - else if("Boolean".equals(typeName)){ + else if(MobyTags.MOBYBOOLEAN.equals(typeName)){ return new MobyDataBoolean("", value); } - else if("DateTime".equals(typeName)){ + else if(MobyTags.MOBYDATETIME.equals(typeName)){ return new MobyDataDateTime("", value); } else if("text-base64".equals(typeName)){ @@ -139,7 +140,7 @@ } String objectClass = objectTag.getLocalName(); - if("Simple".equals(objectClass)){ + if(MobyTags.SIMPLE.equals(objectClass)){ Element elementChild = MobyPrefixResolver.getChildElement(objectTag, "*"); // A Simple tag is allowed to have exactly one child element if(elementChild == null){ @@ -153,28 +154,28 @@ // There are six types of objects we can populate with data directly // plus Collections and Secondary Parameters. Otherwise it is a composite. - else if("Object".equals(objectClass)){ + else if(MobyTags.MOBYOBJECT.equals(objectClass)){ return new MobyDataObject(objectTag); } - else if("Integer".equals(objectClass)){ + else if(MobyTags.MOBYINTEGER.equals(objectClass)){ return new MobyDataInt(objectTag); } - else if("Float".equals(objectClass)){ + else if(MobyTags.MOBYFLOAT.equals(objectClass)){ return new MobyDataFloat(objectTag); } - else if("String".equals(objectClass)){ + else if(MobyTags.MOBYSTRING.equals(objectClass)){ return new MobyDataString(objectTag); } - else if("Boolean".equals(objectClass)){ + else if(MobyTags.MOBYBOOLEAN.equals(objectClass)){ return new MobyDataBoolean(objectTag); } - else if("DateTime".equals(objectClass)){ + else if(MobyTags.MOBYDATETIME.equals(objectClass)){ return new MobyDataDateTime(objectTag); } else if("text-base64".equals(objectClass)){ return new MobyDataBytes(objectTag); } - else if("Collection".equals(objectClass)){ + else if(MobyTags.COLLECTION.equals(objectClass)){ return new MobyDataObjectSet(objectTag); } else if(MobyDataSecondaryInstance.ELEMENT_NAME.equals(objectClass)){ @@ -223,13 +224,13 @@ Node p = e.getParentNode(); String name = null; // A top level object whose name is in the enclosing simple tag - if(p != null && (p instanceof Element) && ((Element) p).getTagName().equals("Simple")){ - name = MobyPrefixResolver.getAttr((Element) p, "articleName"); + if(p != null && (p instanceof Element) && ((Element) p).getTagName().equals(MobyTags.SIMPLE)){ + name = MobyPrefixResolver.getAttr((Element) p, MobyTags.ARTICLENAME); return name == null ? "" : name; } // Part of a composite, subobject's name is in its own tag else{ - name = MobyPrefixResolver.getAttr(e, "articleName"); + name = MobyPrefixResolver.getAttr(e, MobyTags.ARTICLENAME); return name == null ? "" : name; } } @@ -388,25 +389,24 @@ if(e.getLocalName() == null){ throw new NullPointerException("Element name is null when trying to add cross-reference element"); } - if(!e.getLocalName().equals("CrossReference")){ + if(!e.getLocalName().equals(MobyTags.CROSSREFERENCE)){ throw new NullPointerException("Cannot add an element named '"+e.getLocalName()+ "' as a CrossReference element"); } - NodeList substructures = MobyPrefixResolver.getChildElements(e, "*"); //wildcard int numSubstructures = substructures.getLength(); for(int i = 0; i < numSubstructures; i++){ Element child = (Element) substructures.item(i); String objectClass = child.getLocalName(); - if("Object".equals(objectClass)){ - new MobyDataObject(child); + if(MobyTags.MOBYOBJECT.equals(objectClass)){ + addCrossReference(new MobyDataObject(child)); } - else if("Xref".equals(objectClass)){ - new MobyDataXref(child); + else if(MobyTags.XREF.equals(objectClass)){ + addCrossReference(new MobyDataXref(child)); } else{ throw new MobyException("Cross-reference block contained an illegal child element ("+objectClass+ - "), only 'Object' and 'Xref' are allowed"); + "), only '"+MobyTags.MOBYOBJECT+"' and '"+MobyTags.XREF+"' are allowed"); } } } @@ -451,6 +451,20 @@ return CRIBVector != null && !CRIBVector.isEmpty(); } + public void addProvisionInfo(Element e) throws MobyException{ + if(e == null){ + throw new NullPointerException("Cannot add a null provision information element to an object"); + } + if(e.getLocalName() == null){ + throw new NullPointerException("Element name is null when trying to add provision information element"); + } + if(!e.getLocalName().equals(MobyTags.PROVISIONINFORMATION)){ + throw new NullPointerException("Cannot add an element named '"+e.getLocalName()+ + "' as a ProvisionInformation element"); + } + setProvisionInfo(new MobyProvisionInfo(e)); + } + public void setProvisionInfo(MobyProvisionInfo info){ provisionInfo = info; } @@ -547,7 +561,7 @@ } StringBuffer crib = new StringBuffer(); - crib.append("\n"); + crib.append("<"+MobyTags.CROSSREFERENCE+">\n"); java.util.Iterator iter = CRIBVector.iterator(); while(iter != null && iter.hasNext()){ @@ -564,7 +578,7 @@ crib.append(obj.toXML()+"\n"); } } - crib.append("\n"); + crib.append("\n"); return crib.toString(); } @@ -593,7 +607,7 @@ // If the data type is null, there must be something wrong // with fetching the ontology RDF from MOBY Central. At the very // least, we know the thing must be an Object. - return ""; + return "<"+MobyTags.MOBYOBJECT+" " + getAttrXML() + "/>"; } else{ return "<" + getDataType().getName() +" " + getAttrXML() + "/>"; @@ -604,7 +618,7 @@ // but will cause cache misses for MOBY Central calls since the xml // is used as a key in the call cache. StringBuffer buf = new StringBuffer(); - buf.append ("\n"); + buf.append ("<"+MobyTags.SIMPLE+" articleName=\"not_important\">\n"); buf.append (""); if (getDataType() != null) buf.append (getDataType().getName()); buf.append ("\n"); @@ -618,7 +632,7 @@ } } } - buf.append (""); + buf.append (""); buf.append ("\n"); return buf.toString(); //return super.toXML(); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyProvisionInfo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyProvisionInfo.java 2006/07/07 04:12:40 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyProvisionInfo.java 2006/12/13 23:15:58 1.4 @@ -1,7 +1,9 @@ package org.biomoby.shared.data; +import org.biomoby.shared.MobyPrefixResolver; import org.biomoby.shared.parser.MobyTags; +import org.w3c.dom.Element; /** * Class to hold data corresponginf to the MOBY PIB. @@ -15,7 +17,39 @@ private String dbVersion; private String dbComment; private String serviceComment; + + /** + * Creates a blank provision information object. + */ + public MobyProvisionInfo(){ + } + /** + * Builds a provision information block from an XML fragment + * ("ProvisionInformation", as represented by a DOM node). + */ + public MobyProvisionInfo(Element e){ + Element child = MobyPrefixResolver.getChildElement(e, MobyTags.SERVICESOFTWARE); + // all three child elements are optional. + if(child != null){ + setSoftwareName(MobyPrefixResolver.getAttr(child, MobyTags.SOFTWARENAME)); + setSoftwareVersion(MobyPrefixResolver.getAttr(child, MobyTags.SOFTWAREVERSION)); + setSoftwareComment(MobyPrefixResolver.getAttr(child, MobyTags.SOFTWARECOMMENT)); + } + + child = MobyPrefixResolver.getChildElement(e, MobyTags.SERVICEDATABASE); + // all three child elements are optional. + if(child != null){ + setSoftwareName(MobyPrefixResolver.getAttr(child, MobyTags.DATABASENAME)); + setSoftwareVersion(MobyPrefixResolver.getAttr(child, MobyTags.DATABASEVERSION)); + setSoftwareComment(MobyPrefixResolver.getAttr(child, MobyTags.DATABASECOMMENT)); + } + child = MobyPrefixResolver.getChildElement(e, MobyTags.SERVICECOMMENT); + if(child != null){ + setComment(child.getTextContent()); + } + } + public void setSoftwareName(String name){ softwareName = name; } From mwilkinson at dev.open-bio.org Thu Dec 14 12:57:06 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 14 Dec 2006 12:57:06 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612141757.kBEHv6fl014990@dev.open-bio.org> mwilkinson Thu Dec 14 12:57:05 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv14971/MOBY Modified Files: Central.pm Log Message: making initial code changes to support async potocol moby-live/Perl/MOBY Central.pm,1.265,1.266 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.265 retrieving revision 1.266 diff -u -r1.265 -r1.266 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/08 14:29:55 1.265 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/14 17:57:05 1.266 @@ -1302,7 +1302,7 @@ $error .= "missing Category \n" unless defined $Category; return &_error( "malformed payload $error\n\n", "" ) if ($error); return &_error( - "Category may take the (case sensitive) values 'moby', 'cgi', 'post', 'wsdl'\n", + "Category may take the (case sensitive) values 'moby', 'cgi', 'post', 'wsdl', 'moby-async'\n", "" ) unless ( @@ -1310,10 +1310,11 @@ || ($Category eq "cgi") || ( $Category eq "moby" ) + || ( $Category eq "moby-async" ) || ( $Category eq "post" ) ); - return &_error("Service categories other than 'moby', 'post' are not yet implemented","") - unless ( ( $Category eq "moby" ) || ( $Category eq "post" ) ); + return &_error("Service categories other than 'moby', 'post', 'moby-async' are not yet implemented","") + unless ( ( $Category eq "moby" ) || ( $Category eq "post" )|| ( $Category eq "moby-async" ) ); #test the existence of the service return &_error( "This service already exists", "" ) if (MOBY::service_instance->new( @@ -1411,16 +1412,7 @@ $SVC->DELETE_THYSELF; return &_error("Registration Failed - newly registered service could not be discovered",""); } - #my $services = MOBY::Client::Central::_parseServices( '', '', $si ); - #my $service_instance = shift @{$services}; - # my $storage = new RDF::Core::Storage::Memory; - # my $model = new RDF::Core::Model( Storage => $storage ); - # my $RDF_MODEL = MOBY::RDF::ServiceInstanceRDF->new( - #model => $model, - #service_instance => $service_instance ); - # my $RDF_XML = $RDF_MODEL->serialize; - #my $LSID = $service_instance->LSID; my $RDF = _getServiceInstanceRDF(name=>$serviceName, auth=>$AuthURI, url=>$ENV{MOBY_SERVER}, uri=>$ENV{MOBY_URI}); unless ($RDF) { From mwilkinson at dev.open-bio.org Thu Dec 14 12:57:06 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 14 Dec 2006 12:57:06 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612141757.kBEHv6oq015008@dev.open-bio.org> mwilkinson Thu Dec 14 12:57:06 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv14971/MOBY/Client Modified Files: Central.pm Log Message: making initial code changes to support async potocol moby-live/Perl/MOBY/Client Central.pm,1.136,1.137 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.136 retrieving revision 1.137 diff -u -r1.136 -r1.137 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2006/12/07 16:18:04 1.136 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2006/12/14 17:57:06 1.137 @@ -614,7 +614,7 @@ authURI => $authURI, contactEmail => "your at mail.address", description => $human_readable_description, - category => "moby" | "cgi" | "wsdl" (currently only moby and wsdl supported) + category => "moby" | "post" | "moby-async" URL => $URL_TO_SERVICE (or URL to WSDL document for wsdl-type services) input: listref; (articleName may be undef) @@ -712,9 +712,9 @@ #____________________________________________________________________________________________ return $self->errorRegXML( -"Only 'moby', 'post' and 'wsdl' Service Categories are currently allowed - you gave me $Category" +"Only 'moby', 'post', 'moby-async' and 'wsdl' Service Categories are currently allowed - you gave me $Category" ) - unless ( ( $Category eq 'moby' ) || ( $Category eq 'wsdl' ) || ( $Category eq 'post' )); + unless ( ( $Category eq 'moby' ) || ( $Category eq 'wsdl' )|| ( $Category eq 'moby-async' ) || ( $Category eq 'post' )); return $self->errorRegXML( "All Fields Required: serviceName, serviceType, authURI, contactEmail, URL, description, Category, input, output, secondary" ) @@ -736,7 +736,7 @@ $authURI $email"; - if ( $Category eq "moby" || $Category eq 'soap' || $Category eq 'post') { + if ( $Category eq "moby" || $Category eq 'moby-async' || $Category eq 'post') { my %SEC; if ( $a{'secondary'} && ( ref( $a{'secondary'} ) eq 'HASH' ) ) { %SEC = %{ $a{secondary} }; @@ -861,44 +861,16 @@ $message .= ""; } else { - return $self->errorRegXML("only 'moby', 'post' and 'wsdl' service types are allowed to be registered at this time."); + return $self->errorRegXML("only 'moby', 'post' and 'moby-async' service types are allowed to be registered at this time."); } -#elsif ($Category eq "cgi") { -# my $IN = $a{input}; -# $message .= " -# -# -# -# "; -#} else { -# $message .= " -# "; -#} -#unless ($message =~ /\<\/registerService/){ return MOBY::Registration->new( -# success => "0", -# error_messsage => "missing parameters or other failure leading to incorrectly formatted XML", -# registration_id => "0")}; -# print STDERR $message; + $debug && &_LOG(" message\n\n$message\n\n"); -# my $return = $self->SOAP_connection->call(registerService => ($message))->paramsall; my ($return) = $self->_call( 'default', 'registerService', $message ); -# return ( $self->parseRegXML( $return ) ); #_______call a new version RDFbuilder (by Eddie Kawas) _________________________________________ my $reg = $self->parseRegXML($return); - -# if ($reg->success == 1){ -# require LWP::UserAgent; -# -# my $ua = LWP::UserAgent->new; -# my $url='http://mobycentral.cbr.nrc.ca:8090/servlets/forms/getSignatureResponse?domain='.$authURI.'&serviceName='.$name; -# -# my $response = $ua->get($url); -# my $rdf = $response->content; -# print "$rdf\n"; -#} return $reg; @@ -973,7 +945,7 @@ serviceType => $serviceType, (optional) authURI => $authURI, (optional) authoritative => 1, (optional) - category => "moby" | "cgi" | "soap" (currently only moby supported) (optional) + category => "moby" | "post" | "moby-async" (optional) expandObjects => 1, (optional) expandServices => 1, (optional) URL => $URL_TO_SERVICE (optional) From mwilkinson at dev.open-bio.org Thu Dec 14 13:10:40 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 14 Dec 2006 13:10:40 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612141810.kBEIAeDn015072@dev.open-bio.org> mwilkinson Thu Dec 14 13:10:40 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv15053/MOBY Modified Files: Central.pm Log Message: making initial code changes to support async potocol moby-live/Perl/MOBY Central.pm,1.266,1.267 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.266 retrieving revision 1.267 diff -u -r1.266 -r1.267 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/14 17:57:05 1.266 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/14 18:10:40 1.267 @@ -3195,14 +3195,50 @@ # do substitutions my $serviceType = $SI->category; my $wsdl; - if ($serviceType eq "post"){ - $wsdl = &_doPostWSDLReplacement(@_) + if ($serviceType eq "post"){ + $wsdl = &_doPostWSDLReplacement(@_) } elsif ($serviceType eq "moby"){ - $wsdl = &_doMobyWSDLReplacement(@_) + $wsdl = &_doMobyWSDLReplacement(@_) + } elsif ($serviceType eq "moby-async"){ + $wsdl = &_doAsyncWSDLReplacement(@_) } return $wsdl; } +sub _doAsyncWSDLReplacement { + # this routine does not work at the moment + # we're just waiting for an example of an async + # wsdl document from IMB + my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; + my $wsdl = $WSDL_POST_TEMPLATE; + $wsdl =~ s/^\n//gs; + my $serviceName = $SI->servicename; + my $AuthURI = $SI->authority_uri; + my $desc = $SI->description; + if ( $desc =~ /[^\]]+))\]\]>/ ) { + $desc = $1; + } + $desc =~ s"\<"<"g; # XMl encode now that it is not CDATAd + $desc =~ s"\>">"g; # XML encode now that it is not CDATAd + my $URL = $SI->url; + $URL =~ "(http://[^/]+)(/.*)"; + my $baseURL = $1; + my $relativeURL = $2; + my $IN = "NOT_YET_DEFINED_INPUTS"; + my $OUT = "NOT_YET_DEFINED_OUTPUTS"; + my $INxsd = &_getInputXSD( $InputXML, $SecondaryXML ); + my $OUTxsd = &_getOutputXSD($OutputXML); + $INxsd ||= ""; + $OUTxsd ||= ""; + $wsdl =~ s/MOBY__SERVICE__NAME__/$serviceName/g; # replace all of the goofy portbindingpottype crap + $wsdl =~s/\<\!\-\-\s*MOBY__SERVICE__DESCRIPTION\s*\-\-\>/Authority: $AuthURI - $desc/g; # add a sensible description + $wsdl =~ s/MOBY__SERVICE__URL/$baseURL/g; # the URL to the service + $wsdl =~ s/MOBY__SERVICE__POST/$relativeURL/g; # the URL to the service + $wsdl =~ s/MOBY__SERVICE__NAME/$serviceName/g; # finally replace the actual subroutine call + return $wsdl; +} + + sub _doPostWSDLReplacement { my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; my $wsdl = $WSDL_POST_TEMPLATE; @@ -3233,6 +3269,7 @@ return $wsdl; } + sub _doMobyWSDLReplacement { my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; my $wsdl = $WSDL_TEMPLATE; @@ -3781,6 +3818,131 @@ ## ## +=head2 _getInputXSD + + name : _getInputXSD($InputXML, $SecondaryXML) + function: to get an XSD describing the input to a MOBY Service, + e.g. to use in a WSDL document + args : (see _serviceListResponse code above for full details of XML) + $InputXML - the ... block of a findService + response message + + $SecondaryXML - the ... + fragment of a findService response message + + returns : XSD fragment of XML (should not return an XML header!) + notes : the structure of an Input block is as follows: + + + + + the structure of a secondaryArticle block is as follows: + + + + + +=over + +=item * Simple + + + ObjectOntologyTerm + NamespaceTerm + ... + + +=item * Collection note that articleName of the contained Simple objects is not required, and is ignored. + + + + ...... + ...... + + +=item * Secondary + + + + INT|FLOAT|STRING + ... + ... + ... + ... + ... + + +=back + +=cut + +sub _getInputXSD { + my ( $Input, $Secondary ) = @_; + my $XSD; + return $XSD; +} + +=head2 _getOuputXSD + + name : _getOutputXSD($OutputXML) + function: to get an XSD describing the output from a MOBY Service + e.g. to use in a WSDL document + args : (see _serviceListResponse code above for full details) + $InputXML - the ... block of a findService + response message + + $SecondaryXML - the ... + fragment of a findService response message + + returns : XSD fragment of XML (should not return an XML header!) + notes : the structure of an Output block is as follows: + + + + +=over + +=item * Simple + + + ObjectOntologyTerm + NamespaceTerm + ... + + +=item * Collection note that articleName of the contained Simple objects is not required, and is ignored. + + + + ...... + ...... + + +=back + +=cut + +sub _getOutputXSD { + my ($Output) = @_; + my $XSD; + return $XSD; +} + + + +=head2 WSDL_Templates + +=cut + +#=============================================== +#=============================================== +#=============================================== + +# Standard MOBY WSDL Template $WSDL_TEMPLATE = < @@ -3835,6 +3997,7 @@ END +# MOBY POST service template $WSDL_POST_TEMPLATE = < @@ -3890,119 +4053,62 @@ END2 -=head2 _getInputXSD - - name : _getInputXSD($InputXML, $SecondaryXML) - function: to get an XSD describing the input to a MOBY Service, - e.g. to use in a WSDL document - args : (see _serviceListResponse code above for full details of XML) - $InputXML - the ... block of a findService - response message - - $SecondaryXML - the ... - fragment of a findService response message - - returns : XSD fragment of XML (should not return an XML header!) - notes : the structure of an Input block is as follows: - - - - - the structure of a secondaryArticle block is as follows: - - - - - -=over - -=item * Simple +# for MOBY Asynchronous services. This WSDL is not correct YET! - - ObjectOntologyTerm - NamespaceTerm - ... - - -=item * Collection note that articleName of the contained Simple objects is not required, and is ignored. - - - - ...... - ...... - - -=item * Secondary +$WSDL_ASYNC_TEMPLATE = < + + + + + - - INT|FLOAT|STRING - ... - ... - ... - ... - ... - - -=back - -=cut - -sub _getInputXSD { - my ( $Input, $Secondary ) = @_; - my $XSD; - return $XSD; -} - -=head2 _getOuputXSD - - name : _getOutputXSD($OutputXML) - function: to get an XSD describing the output from a MOBY Service - e.g. to use in a WSDL document - args : (see _serviceListResponse code above for full details) - $InputXML - the ... block of a findService - response message - - $SecondaryXML - the ... - fragment of a findService response message - - returns : XSD fragment of XML (should not return an XML header!) - notes : the structure of an Output block is as follows: - - - - -=over - -=item * Simple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - ObjectOntologyTerm - NamespaceTerm - ... - + -=item * Collection note that articleName of the contained Simple objects is not required, and is ignored. - - - ...... - ...... - +END -=back -=cut -sub _getOutputXSD { - my ($Output) = @_; - my $XSD; - return $XSD; -} 1; From gordonp at dev.open-bio.org Thu Dec 14 14:37:37 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 14:37:37 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612141937.kBEJbbrS015483@dev.open-bio.org> gordonp Thu Dec 14 14:37:37 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Clients In directory dev.open-bio.org:/tmp/cvs-serv15452/src/Clients Added Files: TestClientServiceChain.java Log Message: Example of taking output from one service, and using it as input to another (with secondary articles) moby-live/Java/src/Clients TestClientServiceChain.java,NONE,1.1 From gordonp at dev.open-bio.org Thu Dec 14 14:38:34 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 14:38:34 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612141938.kBEJcY9S015568@dev.open-bio.org> gordonp Thu Dec 14 14:38:34 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources In directory dev.open-bio.org:/tmp/cvs-serv15533/src/main/ca/ucalgary/seahawk/resources Modified Files: mobyBuilderRules.xml Log Message: New rule for genbank flat files moby-live/Java/src/main/ca/ucalgary/seahawk/resources mobyBuilderRules.xml,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/mobyBuilderRules.xml,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/seahawk/resources/mobyBuilderRules.xml 2006/10/25 02:33:22 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/mobyBuilderRules.xml 2006/12/14 19:38:34 1.2 @@ -4,6 +4,15 @@ http://www.bioxml.info/dtd/tigrxml.dtd http://www.bioxml.info/dtd/Bioseq.dtd + + \s*(LOCUS\s+(\S+)(?:.*|\n)+?\n//(?:\n|$)) + + $2 + + + $1 + + (?:GO|go):(\d{7}) From gordonp at dev.open-bio.org Thu Dec 14 17:17:28 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 17:17:28 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612142217.kBEMHSoZ016353@dev.open-bio.org> gordonp Thu Dec 14 17:17:28 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv16318/src/main/org/biomoby/shared/data Modified Files: MobyContentInstance.java Log Message: Made content more robust by escaping apostrohpes in simple parameter names moby-live/Java/src/main/org/biomoby/shared/data MobyContentInstance.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/12/11 18:58:58 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/12/14 22:17:28 1.9 @@ -185,7 +185,7 @@ debugPS = ps; } - protected void parseDataGroup(Element dataGroupTag) throws MobyException{ + public void parseDataGroup(Element dataGroupTag) throws MobyException{ String groupID = null; MobyDataJob job = new MobyDataJob(); @@ -439,7 +439,7 @@ if(dataObject instanceof MobyDataObject){ // This line should be replaced with a named field - xml.append(" "+ + xml.append(" "+ dataObject.toXML()+ ""); } From gordonp at dev.open-bio.org Thu Dec 14 17:18:18 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 17:18:18 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612142218.kBEMIIDA016396@dev.open-bio.org> gordonp Thu Dec 14 17:18:18 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv16361/src/main/org/biomoby/shared/data Modified Files: MobyDataSecondaryInstance.java Log Message: Made deserialization more robust by being flexible on moby namespace presence for Value tag moby-live/Java/src/main/org/biomoby/shared/data MobyDataSecondaryInstance.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2006/12/07 16:37:36 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2006/12/14 22:18:18 1.8 @@ -70,7 +70,7 @@ throw new MobyException("While creating a secondary parameter instance from XML: " + "the passed in element (" +objectClass + ") was not a " + MobyTags.PARAMETER); } - NodeList values = objectTag.getElementsByTagNameNS(MobyPrefixResolver.MOBY_XML_NAMESPACE, MobyTags.VALUE); + NodeList values = MobyPrefixResolver.getChildElements(objectTag, MobyTags.VALUE); if(values.getLength() == 0){ throw new MobyException("While creating a secondary parameter instance from XML: " + "No " + VALUE_NAME + " element in the namespace " + From gordonp at dev.open-bio.org Thu Dec 14 17:20:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 17:20:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612142220.kBEMKA6d016460@dev.open-bio.org> gordonp Thu Dec 14 17:20:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv16425/src/main/ca/ucalgary/seahawk/gui Modified Files: MobyContentPane.java Added Files: FileAndTextTransferHandler.java Log Message: Made Seahawk's content panes 'droppable', i.e. files, URLs, XML fragments and strings dropped onto it from the windowing system are loaded in a new tab moby-live/Java/src/main/ca/ucalgary/seahawk/gui FileAndTextTransferHandler.java,NONE,1.1 MobyContentPane.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.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/seahawk/gui/MobyContentPane.java 2006/11/24 20:57:25 1.2 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java 2006/12/14 22:20:10 1.3 @@ -88,8 +88,11 @@ contentGUI = cGUI; servicesGUI = sGUI; + setTransferHandler(new FileAndTextTransferHandler(cGUI)); + // The following is a non-user editable pane for showing HTML editorPane = new PrintableJEditorPane(); + editorPane.setTransferHandler(getTransferHandler()); //editorPane.setPreferredSize(parentComponent.getPreferredSize()); editorPane.setEditable(false); editorPane.addMouseListener(this); From gordonp at dev.open-bio.org Thu Dec 14 23:39:52 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 23:39:52 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612150439.kBF4dqp5017116@dev.open-bio.org> gordonp Thu Dec 14 23:39:52 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls In directory dev.open-bio.org:/tmp/cvs-serv17081/xmls Modified Files: seahawkBuild.xml Log Message: Added xml error hanlder to includes list for applet moby-live/Java/xmls seahawkBuild.xml,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2006/12/06 16:07:11 1.6 +++ /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2006/12/15 04:39:52 1.7 @@ -70,7 +70,7 @@ - + From gordonp at dev.open-bio.org Thu Dec 14 23:40:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 23:40:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612150440.kBF4ea90017179@dev.open-bio.org> gordonp Thu Dec 14 23:40:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv17144/src/main/ca/ucalgary/seahawk/gui Modified Files: FileAndTextTransferHandler.java Log Message: Added better support for windows URL links moby-live/Java/src/main/ca/ucalgary/seahawk/gui FileAndTextTransferHandler.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.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/seahawk/gui/FileAndTextTransferHandler.java 2006/12/14 22:20:10 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java 2006/12/15 04:40:36 1.2 @@ -46,7 +46,36 @@ if (hasFileFlavor(t.getTransferDataFlavors())) { // Load any dragged file as a URL for (File file: (java.util.List) t.getTransferData(DataFlavor.javaFileListFlavor)) { - gui.loadPaneFromURL(file.toURI().toURL(), true); + String fileString = file.toURI().toURL().toString().toLowerCase(); + + // Windows Web shortcut? + URL u = null; + if(fileString.lastIndexOf(".url") == fileString.length()-4){ + LineNumberReader in = new LineNumberReader( + new InputStreamReader(file.toURI().toURL().openStream())); + for(String line = in.readLine(); line != null; line = in.readLine()){ + int urlIndex = line.indexOf("URL="); + if(line.indexOf("URL=") == 0){ + try{ + u = new URL(line.substring(4)); + } catch(MalformedURLException murle){ + System.err.println("Could not format " +line); + murle.printStackTrace(); + // Not a URL, but really it should have been. + // oh well, move on to normal file loading... + } + break; // done with this file as a URL, no need to execute other loadPaneFromURL + } + } + } + // Was it a shortcut file after all? + if(u != null){ + gui.loadPaneFromURL(u, true); + } + // Any other type of file is loaded as-is + else{ + gui.loadPaneFromURL(file.toURI().toURL(), true); + } } return true; } else if (hasTextFlavor(t.getTransferDataFlavors())) { @@ -61,10 +90,24 @@ // Some readers put funny nulls before each char (8->16 bit char encoding goof) String text = textBuffer.toString().replaceAll("\00", ""); + // Is it an address bar icon dragged from firefox? Strip the surrounding html + String linktext = null; + if(text.indexOf("") == text.length()-11){ + linktext = text.substring(15, text.indexOf("\"",15)); + } + else if(text.indexOf("") == text.length()-4){ //unix + linktext = text.substring(9, text.indexOf("\"",9)); + } + else if(text.indexOf("") != -1){ + int startHref = text.indexOf("((?:.*|\n)*)", "$1"); + int preStart = xmltext.indexOf("")+1); xmltext = xmltext.replaceAll(">", ">"); xmltext = xmltext.replaceAll("<", "<"); xmltext = xmltext.replaceAll("&", "&"); @@ -113,7 +159,6 @@ content.parseDataGroup(data); } else{ - System.err.println("Using object creator for "+data.getLocalName()); // Any other data can be processed by the base object class content = new MobyContentInstance(MobyDataObject.createInstanceFromDOM(data), "Drag 'n' Drop data"); } From deandres at dev.open-bio.org Mon Dec 4 03:25:53 2006 From: deandres at dev.open-bio.org (Enrique de Andres Saiz) Date: Mon, 04 Dec 2006 08:25:53 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200612040825.kB48Pqhm010026@dev.open-bio.org> deandres Mon Dec 4 03:25:52 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Async In directory dev.open-bio.org:/tmp/cvs-serv9992/Async Log Message: Directory /home/repository/moby/moby-live/Perl/MOBY/Async added to the repository moby-live/Perl/MOBY/Async - New directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/Async/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/Async/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/Async/RCS/directory,v: No such file or directory From deandres at dev.open-bio.org Mon Dec 4 03:27:54 2006 From: deandres at dev.open-bio.org (Enrique de Andres Saiz) Date: Mon, 04 Dec 2006 08:27:54 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200612040827.kB48RqeK010090@dev.open-bio.org> deandres Mon Dec 4 03:27:52 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv10059 Added Files: Async.pm Log Message: Extension for asynchronism moby-live/Perl/MOBY Async.pm,NONE,1.1 From deandres at dev.open-bio.org Mon Dec 4 03:27:54 2006 From: deandres at dev.open-bio.org (Enrique de Andres Saiz) Date: Mon, 04 Dec 2006 08:27:54 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200612040827.kB48RqjZ010104@dev.open-bio.org> deandres Mon Dec 4 03:27:52 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Async In directory dev.open-bio.org:/tmp/cvs-serv10059/Async Added Files: LSAE.pm Service.pm SimpleServer.pm WSRF.pm Log Message: Extension for asynchronism moby-live/Perl/MOBY/Async LSAE.pm,NONE,1.1 Service.pm,NONE,1.1 SimpleServer.pm,NONE,1.1 WSRF.pm,NONE,1.1 From gordonp at dev.open-bio.org Mon Dec 4 22:12:13 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 4 Dec 2006 17:12:13 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612042212.kB4MCD6l016671@dev.open-bio.org> gordonp Mon Dec 4 17:12:12 EST 2006 Update of /home/repository/moby/jars-archive/current In directory dev.open-bio.org:/tmp/cvs-serv16636 Modified Files: MobyServlet.war Log Message: First try of new automated MobyServlet WAR construction methodology jars-archive/current MobyServlet.war,1.6,1.7 =================================================================== RCS file: /home/repository/moby/jars-archive/current/MobyServlet.war,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 Binary files /home/repository/moby/jars-archive/current/MobyServlet.war 2006/11/21 19:11:23 1.6 and /home/repository/moby/jars-archive/current/MobyServlet.war 2006/12/04 22:12:12 1.7 differ rcsdiff: /home/repository/moby/jars-archive/current/MobyServlet.war: diff failed From gordonp at dev.open-bio.org Mon Dec 4 22:30:49 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 4 Dec 2006 17:30:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612042230.kB4MUnZE016827@dev.open-bio.org> gordonp Mon Dec 4 17:30:49 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util In directory dev.open-bio.org:/tmp/cvs-serv16792/src/main/ca/ucalgary/seahawk/util Modified Files: MinJarMaker.java Log Message: Added check for extra resources (non-pattern), not just classes moby-live/Java/src/main/ca/ucalgary/seahawk/util MinJarMaker.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MinJarMaker.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/seahawk/util/MinJarMaker.java 2006/11/23 19:28:58 1.3 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MinJarMaker.java 2006/12/04 22:30:49 1.4 @@ -456,9 +456,12 @@ e.printStackTrace(); } if(classBytes == null){ - System.err.println("Could not find the specified extra class: " + - classPathElement); - continue; + URL u = findResource(classPathElement); + if(u == null){ + System.err.println("Could not find the specified extra class: " + + classPathElement); + continue; + } } classes.add(classPathElement); } From gordonp at dev.open-bio.org Mon Dec 4 22:33:50 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 4 Dec 2006 17:33:50 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612042233.kB4MXo76016950@dev.open-bio.org> gordonp Mon Dec 4 17:33:50 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service In directory dev.open-bio.org:/tmp/cvs-serv16919/src/main/org/biomoby/service Added Files: mobyService.java Log Message: Annotation class used in MobyServlet-style service creation moby-live/Java/src/main/org/biomoby/service mobyService.java,NONE,1.1 From senger at dev.open-bio.org Tue Dec 5 17:18:16 2006 From: senger at dev.open-bio.org (Martin Senger) Date: Tue, 5 Dec 2006 12:18:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612051718.kB5HIGP3019480@dev.open-bio.org> senger Tue Dec 5 12:18:15 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv19461/src/Perl/MOSES/MOBY/Cache Modified Files: Registries.pm Log Message: MIPS registry removed moby-live/Java/src/Perl/MOSES/MOBY/Cache Registries.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Registries.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Registries.pm 2006/10/13 21:51:16 1.1 +++ /home/repository/moby/moby-live/Java/src/Perl/MOSES/MOBY/Cache/Registries.pm 2006/12/05 17:18:15 1.2 @@ -37,11 +37,6 @@ public => 'yes', text => 'The MOBY registry at the International Rice Research Institute (IRRI) is intended mostly for Generation Challenge Program (GCP) developers. It allows the registration of experimental moby entities within GCP.', }, - MIPS => { endpoint => 'http://mips.gsf.de/cgi-bin/proj/planet/moby/MOBY-Central.pl', - namespace => 'http://mips.gsf.de/MOBY/Central', - name => 'MIPS, Germany', - contact => 'Dirk Haase (d.haase at gsf.de)', - }, testing => { endpoint => 'http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl', namespace => 'http://bioinfo.icapture.ubc.ca/MOBY/Central', name => 'Testing BioMoby registry', From senger at dev.open-bio.org Tue Dec 5 17:18:16 2006 From: senger at dev.open-bio.org (Martin Senger) Date: Tue, 5 Dec 2006 12:18:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612051718.kB5HIGrt019498@dev.open-bio.org> senger Tue Dec 5 12:18:16 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta In directory dev.open-bio.org:/tmp/cvs-serv19461/src/main/org/biomoby/registry/meta Modified Files: RegistriesList.java Log Message: MIPS registry removed moby-live/Java/src/main/org/biomoby/registry/meta RegistriesList.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta/RegistriesList.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta/RegistriesList.java 2006/10/02 17:57:49 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta/RegistriesList.java 2006/12/05 17:18:16 1.2 @@ -53,15 +53,6 @@ "The MOBY registry at the International Rice Research Institute (IRRI) is intended mostly for Generation Challenge Program (GCP) developers. It allows the registration of experimental moby entities within GCP."), new Registry - ("MIPS", - "http://mips.gsf.de/cgi-bin/proj/planet/moby/MOBY-Central.pl", - "http://mips.gsf.de/MOBY/Central", - "MIPS, Germany", - "Dirk Haase (d.haase at gsf.de)", - true, - ""), - - new Registry ("testing", "http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl", "http://bioinfo.icapture.ubc.ca/MOBY/Central", From gordonp at dev.open-bio.org Wed Dec 6 15:09:04 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 10:09:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061509.kB6F94nv023973@dev.open-bio.org> gordonp Wed Dec 6 10:09:03 EST 2006 Update of /home/repository/moby/jars-archive/current In directory dev.open-bio.org:/tmp/cvs-serv23938 Modified Files: MobyServlet.war Log Message: Updated to use new Java annotation based meta-data specification (now fully working) jars-archive/current MobyServlet.war,1.7,1.8 =================================================================== RCS file: /home/repository/moby/jars-archive/current/MobyServlet.war,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 Binary files /home/repository/moby/jars-archive/current/MobyServlet.war 2006/12/04 22:12:12 1.7 and /home/repository/moby/jars-archive/current/MobyServlet.war 2006/12/06 15:09:02 1.8 differ rcsdiff: /home/repository/moby/jars-archive/current/MobyServlet.war: diff failed From gordonp at dev.open-bio.org Wed Dec 6 15:50:37 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 10:50:37 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061550.kB6Fob71024216@dev.open-bio.org> gordonp Wed Dec 6 10:50:37 EST 2006 Update of /home/repository/moby/moby-live/Java/src/webapps/WEB-INF In directory dev.open-bio.org:/tmp/cvs-serv24182/src/webapps/WEB-INF Log Message: Directory /home/repository/moby/moby-live/Java/src/webapps/WEB-INF added to the repository moby-live/Java/src/webapps/WEB-INF - New directory rcsdiff: /home/repository/moby/moby-live/Java/src/webapps/WEB-INF/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/webapps/WEB-INF/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/src/webapps/WEB-INF/RCS/directory,v: No such file or directory From gordonp at dev.open-bio.org Wed Dec 6 15:51:30 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 10:51:30 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061551.kB6FpUfN024300@dev.open-bio.org> gordonp Wed Dec 6 10:51:29 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv24266/xmls/servlet Log Message: Directory /home/repository/moby/moby-live/Java/xmls/servlet added to the repository moby-live/Java/xmls/servlet - New directory rcsdiff: /home/repository/moby/moby-live/Java/xmls/servlet/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/xmls/servlet/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/xmls/servlet/RCS/directory,v: No such file or directory From gordonp at dev.open-bio.org Wed Dec 6 16:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7AMF024457@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util In directory dev.open-bio.org:/tmp/cvs-serv24370/src/main/ca/ucalgary/seahawk/util Modified Files: MinJarMaker.java Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/src/main/ca/ucalgary/seahawk/util MinJarMaker.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MinJarMaker.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MinJarMaker.java 2006/12/04 22:30:49 1.4 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MinJarMaker.java 2006/12/06 16:07:10 1.5 @@ -617,6 +617,9 @@ if(classname.startsWith("junit")){ //for testing only, we assume continue; } + //if(classname.startsWith("javax.servlet")){ //servlet container will have a version, we assume + // continue; + //} // Haven't noted the inclusion of classes from this package yet for future reference by // secondary jar dumper From gordonp at dev.open-bio.org Wed Dec 6 16:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7Ab2024405@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java In directory dev.open-bio.org:/tmp/cvs-serv24370 Modified Files: build.xml Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java build.xml,1.61,1.62 =================================================================== RCS file: /home/repository/moby/moby-live/Java/build.xml,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- /home/repository/moby/moby-live/Java/build.xml 2006/11/21 13:04:15 1.61 +++ /home/repository/moby/moby-live/Java/build.xml 2006/12/06 16:07:10 1.62 @@ -1,15 +1,15 @@ - - - - - - - - - + + + + + + + + + + ]> @@ -34,6 +34,8 @@ + + @@ -519,10 +521,14 @@ + + + + - + + + + + + + + + + + + + + + + + From gordonp at dev.open-bio.org Wed Dec 6 16:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7AYT024517@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv24370/src/main/org/biomoby/shared/data Modified Files: MobyContentInstance.java Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/src/main/org/biomoby/shared/data MobyContentInstance.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/10/26 01:32:06 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/12/06 16:07:10 1.7 @@ -32,7 +32,7 @@ private int xmlMode = MobyDataInstance.SERVICE_XML_MODE; private HashMap members; private int autoID = 1; // to name members without existing names - private Vector exceptions; + private Vector exceptions; /** * Creates a blank MOBY envelope, to be filled in programatically with data instances. @@ -40,7 +40,7 @@ */ public MobyContentInstance(){ members = new HashMap(); - exceptions = new Vector(); + exceptions = new Vector(); } /** @@ -342,12 +342,42 @@ } /** - * @return the list of exceptions assocaited with this content + * @return the list of exceptions associated with this content */ public ServiceException[] getExceptions(){ return (ServiceException[]) exceptions.toArray(new ServiceException[exceptions.size()]); } + /** + * Indicates whether the moby content has any exception (according to the style of MOBY-S RFC 1863) + * + * @return true if there are exceptions (any severity) in the content + */ + public boolean hasExceptions(){ + return exceptions != null && exceptions.size() > 0; + } + + /** + * Indicates whether the moby content has any exception of the given severity or worse + * (according to the style of MOBY-S RFC 1863). + * + * @param severity the minimum severity of exception (info < warning < error) to report + * + * @return true if there are exceptions (of the specified severity or greater) in the content + */ + public boolean hasExceptions(int severity){ + if(exceptions == null || exceptions.size() == 0){ + return false; + } + + for(ServiceException se: exceptions){ + if(se.getSeverity() <= severity){ + return true; + } + } + return false; + } + public void setXmlMode(int mode) throws IllegalArgumentException{ if(mode != MobyDataInstance.CENTRAL_XML_MODE && mode != MobyDataInstance.SERVICE_XML_MODE){ throw new IllegalArgumentException("Value passed to setXmlMode was neither " + From gordonp at dev.open-bio.org Wed Dec 6 16:07:11 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7BpN024557@dev.open-bio.org> gordonp Wed Dec 6 11:07:11 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls In directory dev.open-bio.org:/tmp/cvs-serv24370/xmls Modified Files: seahawkBuild.xml Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/xmls seahawkBuild.xml,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2006/11/24 21:10:39 1.5 +++ /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2006/12/06 16:07:11 1.6 @@ -1,12 +1,13 @@ - + + - + @@ -19,6 +20,11 @@ + + + + + @@ -37,9 +43,6 @@ - - - @@ -55,6 +58,7 @@ + @@ -76,6 +80,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + +
      +
      +
      + + + + + +
      + From gordonp at dev.open-bio.org Wed Dec 6 16:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7Ad6024477@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service In directory dev.open-bio.org:/tmp/cvs-serv24370/src/main/org/biomoby/service Modified Files: MobyServlet.java Added Files: Asynchronous.java Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/src/main/org/biomoby/service Asynchronous.java,NONE,1.1 MobyServlet.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java 2006/11/22 22:23:55 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java 2006/12/06 16:07:10 1.3 @@ -7,6 +7,9 @@ * the documentation on
      how to use this servlet. */ +import org.biomoby.service.test.TestServletConfig; +import org.biomoby.service.test.TestServletContext; + import org.biomoby.shared.*; import org.biomoby.shared.data.*; import org.biomoby.shared.parser.*; @@ -29,6 +32,13 @@ import java.util.StringTokenizer; import java.util.Vector; + at mobyService(name="MobyServlet", + type="Testing", + provider="moby.ucalgary.ca", + author="gordonp at ucalgary.ca", + in={}, + out={}, + description={"No-operation base service implementation"}) public class MobyServlet extends HttpServlet implements Remote{ public static final String MOBY_CENTRAL_URL_PARAM = "mobyCentralURL"; @@ -37,6 +47,7 @@ public static final String MOBY_SERVICE_DESC_PARAM = "mobyServiceDescription"; public static final String MOBY_PROVIDER_URI_PARAM = "mobyProviderURI"; public static final String MOBY_SERVICETYPE_PARAM = "mobyServiceType"; + public static final String MOBY_SERVICENAME_PARAM = "mobyServiceName"; public static final String MOBY_INPUT_PARAM = "mobyInput"; public static final String MOBY_SECONDARY_PARAM = "mobySecondaryInput"; public static final String MOBY_OUTPUT_PARAM = "mobyOutput"; @@ -45,8 +56,9 @@ public static final String ADMIN_MODE = "admin"; public static final int INIT_OUTPUT_BUFFER_SIZE = 100000; + private static boolean shouldExit = true; + protected static MobyRequest mobyRequest; - protected static MobyService thisService; protected static DocumentBuilder docBuilder; // Members used to wrap the response in SOAP @@ -57,18 +69,20 @@ protected final static String stringEncAttrValue = "xsd:string"; protected static Name faultName; + protected MobyService thisService; protected MobyContentInstance currentContent = null; protected boolean isInitialized = false; /** Changing this value makes logging more or less verbose */ protected boolean isDebug = false; - protected void doGet(HttpServletRequest request, + public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException{ if(thisService == null){ try{ thisService = createServiceFromConfig(request); } catch(Exception e){ + log("While attempting to configure service on first run:", e); throw new ServletException("While attempting to configure service on first run: " + e); } } @@ -183,10 +197,11 @@ */ protected boolean validSOAPEndPoint(HttpServletRequest request, HttpServletResponse response){ - String methodName = "http://biomoby.org/#"+getServletName(); + String methodName = "http://biomoby.org/#"+getServiceName(); String qMethodName = "\""+methodName+"\""; String requestedActionName = null; boolean endPointMatches = false; + // TODO: This is where we should add code to deal with asynchronous calls for(java.util.Enumeration actionsCalled = request.getHeaders("SOAPAction"); actionsCalled.hasMoreElements();){ @@ -223,7 +238,7 @@ return false; } catch(Exception e){ - log("While writing SOAP fault response to client for " + getServletName(), e); + log("While writing SOAP fault response to client for " + getServiceName(), e); return false; } } @@ -377,7 +392,6 @@ // The SOAP envelope (headerless) consists of a body with one string element inside it if(soapMessageFactory == null){ soapMessageFactory = MessageFactory.newInstance(); - log("SOAP Message Factory (when writeResponse is called) is " + soapMessageFactory); } SOAPMessage message = soapMessageFactory.createMessage(); message.getSOAPHeader().detachNode(); @@ -394,7 +408,7 @@ out.write(outBuffer.toByteArray()); } catch(Exception e){ - log("While writing SOAP response to client for " + getServletName(), e); + log("While writing SOAP response to client for " + getServiceName(), e); return; } @@ -407,10 +421,10 @@ if(currentContent != null){ currentContent.addException(se); if(isInitialized){ - log("While executing Moby Service " + getServletName(), se); + log("While executing Moby Service (initialized) " + getServiceName(), se); } - else{ - System.err.println("While executing Moby Service " + getClass().getName()); + else if(thisService != null){ + System.err.println("While executing Moby Service (uninitialized) " + getClass().getName()); se.printStackTrace(); } } @@ -437,10 +451,10 @@ ex.toString())); } if(isInitialized){ - log("While executing Moby Service " + getServletName(), ex); + log("While executing Moby Service (initialized) " + getServiceName(), ex); } - else{ - System.err.println("While executing Moby Service " + getClass().getName()); + else if(thisService != null){ + System.err.println("While executing Moby Service (uninitialized) " + getClass().getName()); ex.printStackTrace(); } } @@ -461,10 +475,10 @@ ex.toString())); } if(isInitialized){ - log("While executing Moby Service " + getServletName() + ", job '" + job.getID()+"'", ex); + log("While executing Moby Service (initialized) " + getServiceName() + ", job '" + job.getID()+"'", ex); } - else{ - System.err.println("While executing Moby Service " + getClass().getName() + ", job '" + job.getID()+"'"); + else if(thisService != null){ + System.err.println("While executing Moby Service (uninitialized) " + getClass().getName() + ", job '" + job.getID()+"'"); ex.printStackTrace(); } } @@ -492,17 +506,17 @@ "org.apache.axis.soap.MessageFactoryImpl"); } soapMessageFactory = MessageFactory.newInstance(); // Should find Axis by default - log("SOAP Message Factory (when init is called) is " + soapMessageFactory); + //log("SOAP Message Factory (when init is called) is " + soapMessageFactory); - if(System.getProperty("javax.xml.soap.MessageFactory") == null){ + if(System.getProperty("javax.xml.soap.SOAPFactory") == null){ System.setProperty("javax.xml.soap.SOAPFactory", "org.apache.axis.soap.SOAPFactoryImpl"); } SOAPFactory soapFactory = SOAPFactory.newInstance(); - bodyContentsName = soapFactory.createName(getServletName()+"Return", + bodyContentsName = soapFactory.createName(getServiceName()+"Return", MobyPrefixResolver.MOBY_TRANSPORT_PREFIX, MobyPrefixResolver.MOBY_TRANSPORT_NAMESPACE); - bodyName = soapFactory.createName(getServletName()+"Response", + bodyName = soapFactory.createName(getServiceName()+"Response", MobyPrefixResolver.MOBY_TRANSPORT_PREFIX, MobyPrefixResolver.MOBY_TRANSPORT_NAMESPACE); stringEncAttrName = soapFactory.createName("type", @@ -531,46 +545,60 @@ isInitialized = true; } - private synchronized MobyService createServiceFromConfig(HttpServletRequest request) throws Exception{ - MobyService service = new MobyService(getServletName()); + public synchronized MobyService createServiceFromConfig(HttpServletRequest request) throws Exception{ + MobyService service = new MobyService(getServiceName()); Vector inputTypes = new Vector(); Vector outputTypes = new Vector(); - javax.servlet.ServletContext context = getServletContext(); + mobyService ann = + this.getClass().getAnnotation(mobyService.class); + if(ann == null){ + throw new Exception("The servlet does not have a @mobyService() class annotation as required, " + + "cannot configure the service"); + } + else{ + //log("Reading service meta-data from Java class annotation for "+ann.name()); + } + + javax.servlet.ServletConfig config = getServletConfig(); - java.util.Enumeration paramNamesEnum = context.getInitParameterNames(); String paramNames = ""; - if(paramNamesEnum.hasMoreElements()){ - paramNames = paramNamesEnum.nextElement().toString(); - } - while(paramNamesEnum.hasMoreElements()){ - paramNames += ", "+paramNamesEnum.nextElement(); + if(config != null){ + java.util.Enumeration paramNamesEnum = config.getInitParameterNames(); + if(paramNamesEnum.hasMoreElements()){ + paramNames = paramNamesEnum.nextElement().toString(); + } + while(paramNamesEnum.hasMoreElements()){ + paramNames += ", "+paramNamesEnum.nextElement(); + } } // Inputs and outputs and service type must be defined - String ins = context.getInitParameter(MOBY_INPUT_PARAM); + String[] ins = ann.in(); + if(config != null && config.getInitParameter(MOBY_INPUT_PARAM) != null){ + ins = config.getInitParameter(MOBY_INPUT_PARAM).split(","); + } if(ins == null){ throw new Exception("Could not find required " + MOBY_INPUT_PARAM + - " parameter in servlet context, available parameters were: " + paramNames); + " parameter in servlet config, available parameters were: " + paramNames); } - StringTokenizer st = new StringTokenizer(ins, ","); - while(st.hasMoreTokens()){ - String value = st.nextToken(); + for(int i = 0; i < ins.length; i++){ // non-void param - inputTypes.add(stringToPrimaryDataTemplate(value)); + inputTypes.add(stringToPrimaryDataTemplate(ins[i])); } - String outs = context.getInitParameter(MOBY_OUTPUT_PARAM); + String[] outs = ann.out(); + if(config != null && config.getInitParameter(MOBY_OUTPUT_PARAM) != null){ + outs = config.getInitParameter(MOBY_OUTPUT_PARAM).split(","); + } if(outs == null){ throw new Exception("Could not find required " + MOBY_OUTPUT_PARAM + - " parameter in servlet context "); + " parameter in servlet config "); } - st = new StringTokenizer(outs, ","); - while(st.hasMoreTokens()){ - String value = st.nextToken(); - if(value.length() > 0){// non-void param - outputTypes.add(stringToPrimaryDataTemplate(value)); + for(int i = 0; i < outs.length; i++){ + if(outs[i] != null && outs[i].length() > 0){// non-void param + outputTypes.add(stringToPrimaryDataTemplate(outs[i])); } } @@ -578,14 +606,18 @@ service.setOutputs(outputTypes.toArray(new MobyData[outputTypes.size()])); // A description and provider URI must be available too - String param = context.getInitParameter(MOBY_SERVICETYPE_PARAM); + String param = ann.type(); + // Did we override the service type in the web.xml? + if(config != null && config.getInitParameter(MOBY_SERVICETYPE_PARAM) != null){ + param = config.getInitParameter(MOBY_SERVICETYPE_PARAM); + } if(param == null){ throw new Exception("Could not find required " + MOBY_SERVICETYPE_PARAM + - " parameter in servlet context "); + " parameter in servlet config "); } if(param.length() == 0){ throw new Exception("Required " + MOBY_SERVICETYPE_PARAM + - " parameter in servlet context cannot be blank"); + " parameter in servlet config cannot be blank"); } MobyServiceType serviceType = MobyServiceType.getServiceType(param); if(serviceType == null){ @@ -594,80 +626,126 @@ } service.setServiceType(serviceType); - param = context.getInitParameter(MOBY_SERVICE_DESC_PARAM); - if(param == null){ + String[] desc = ann.description(); + // Did we override the service type in the web.xml? + if(config != null && config.getInitParameter(MOBY_SERVICETYPE_PARAM) != null){ + desc = new String[1]; + desc[0] = config.getInitParameter(MOBY_SERVICETYPE_PARAM); + } + if(desc == null){ throw new Exception("Could not find required " + MOBY_SERVICE_DESC_PARAM + - " parameter in servlet context "); + " parameter in servlet config "); } - if(param.length() == 0){ + if(desc.length == 0){ throw new Exception("Required " + MOBY_SERVICE_DESC_PARAM + - " parameter in servlet context cannot be blank"); + " parameter in servlet config cannot be blank"); + } + StringBuffer descBuffer = new StringBuffer(); + for(int i = 0; i < desc.length; i++){ + descBuffer.append(desc[i]); + } + service.setDescription(descBuffer.toString()); + + param = ann.provider(); + // Did we override the provider info in web.xml? + if(config != null && config.getInitParameter(MOBY_PROVIDER_URI_PARAM) != null){ + param = config.getInitParameter(MOBY_PROVIDER_URI_PARAM); } - service.setDescription(param); - - param = context.getInitParameter(MOBY_PROVIDER_URI_PARAM); if(param == null){ throw new Exception("Could not find required " + MOBY_PROVIDER_URI_PARAM + - " parameter in servlet context "); + " parameter in servlet config "); } if(param.length() == 0){ throw new Exception("Required " + MOBY_PROVIDER_URI_PARAM + - " parameter in servlet context cannot be blank"); + " parameter in servlet config cannot be blank"); } service.setAuthority(param); + // Now we have all the info we need to create the LSID for the service String time = MobyDataDateTime.getString( new java.util.GregorianCalendar( java.util.TimeZone.getTimeZone("Zulu"))).replaceAll(":", "-"); - service.setLSID("urn:lsid:biomoby.org:serviceinstance:"+param+","+getServletName()+":"+time); + service.setLSID("urn:lsid:biomoby.org:serviceinstance:"+param+","+getServiceName()+":"+time); - param = context.getInitParameter(MOBY_CONTACT_PARAM); + param = ann.author(); + // Did we override the contact info in web.xml? + if(config != null && config.getInitParameter(MOBY_CONTACT_PARAM) != null){ + param = config.getInitParameter(MOBY_CONTACT_PARAM); + } if(param == null){ throw new Exception("Could not find required " + MOBY_CONTACT_PARAM + - " parameter in servlet context "); + " parameter in servlet config "); } if(param.length() == 0){ throw new Exception("Required " + MOBY_CONTACT_PARAM + - " parameter in servlet context cannot be blank " + + " parameter in servlet config cannot be blank " + "(must have form name at mail.domain)"); } if(param.indexOf("@") < 2 || param.indexOf("@") > param.length()-2 || param.indexOf(".") < 2 || param.indexOf(".") > param.length()-2 || param.lastIndexOf("@") > param.lastIndexOf(".")){ throw new Exception("Required " + MOBY_CONTACT_PARAM + - " parameter in servlet context did not have the form \"name at mail.domain\")"); + " parameter in servlet config did not have the form \"name at mail.domain\")"); } service.setEmailContact(param); // From the request, determine the URL used to access this service - String endPointURL = HttpUtils.getRequestURL(request).toString(); + String endPointURL = request == null ? "" : request.getRequestURL().toString(); // When we POST this URL, the service is executed service.setURL(endPointURL); // When we GET this URL, the RDF is returned service.setSignatureURL(endPointURL+"?"+MODE_HTTP_PARAM+"="+RDF_MODE); // Other fields (authoritative and contact info) are highly recommended, but optional - param = context.getInitParameter(MOBY_AUTHORITATIVE_PARAM); - if(param != null){ - if("YES".equals(param.toUpperCase()) || "Y".equals(param.toUpperCase()) || "1".equals(param)){ - service.setAuthoritative(true); + if(config != null){ + param = config.getInitParameter(MOBY_AUTHORITATIVE_PARAM); + if(param != null){ + if("YES".equals(param.toUpperCase()) || "Y".equals(param.toUpperCase()) || "1".equals(param)){ + service.setAuthoritative(true); + } + else{ + log("Interpreting config parameter '" + param + "' as NO for authoritative property of the service"); + service.setAuthoritative(false); + } } else{ - log("Interpreting config parameter '" + param + "' as NO for authoritative property of the service"); - service.setAuthoritative(false); + service.setAuthoritative(ann.authoritative()); } } else{ - service.setAuthoritative(false); + service.setAuthoritative(ann.authoritative()); } - mobyRequest.setService(service); return service; } /** + * Reads the service name from the mobyService annotation. + */ + public String getServiceName(){ + mobyService ann = + this.getClass().getAnnotation(mobyService.class); + + javax.servlet.ServletConfig config = getServletConfig(); + String param = null; + // Did we override the service type in the web.xml? + if(config != null && config.getInitParameter(MOBY_SERVICENAME_PARAM) != null){ + param = config.getInitParameter(MOBY_SERVICENAME_PARAM); + if(param != null && param.length() != 0){ + return param; + } + } + + if(ann == null){ + return "AnonymousService"; // this should never happen unless the class files are out of sync... + } + + return ann.name(); + } + + /** * Strings have the form name:objectType:namespace, with ":namespace" optional * If the input is expected to be a Collection, then the syntax is name:Collection(objectType):namespace */ @@ -694,10 +772,12 @@ MobyPrimaryData dataTemplate = null; + boolean isCollection = false; if(objectType.indexOf("Collection(") == 0 && objectType.lastIndexOf(")") == objectType.length()-1){ objectType = objectType.substring(11, objectType.length()-1); dataTemplate = new MobyPrimaryDataSet(name); + isCollection = true; } else{ dataTemplate = new MobyPrimaryDataSimple(name); @@ -712,6 +792,12 @@ System.exit(1); } dataTemplate.setDataType(type); + if(isCollection){ + // Example data element in set needed for RDF creator to recognize the data type + MobyPrimaryDataSimple exampleData = new MobyPrimaryDataSimple(name); + exampleData.setDataType(type); + ((MobyPrimaryDataSet) dataTemplate).addElement(exampleData); + } // namespace is optional if(st.hasMoreTokens()){ @@ -763,7 +849,13 @@ // Should happen, unless main() was called validateArguments(currentRequest, thisService, "While executing service"); } - processRequest(currentRequest, resultContents.get(jobName)); + MobyDataJob currentResult = resultContents.get(jobName); + if(currentResult == null){ + currentResult = new MobyDataJob(); + currentResult.setID(jobName); + resultContents.put(jobName, currentResult); + } + processRequest(currentRequest, currentResult); }catch(Throwable e){ addException(resultContents, requestContents.get(jobName), e); } @@ -787,6 +879,15 @@ } /** + * Determines whether call to main() that terminate on error should call System.exit() + * or not. This is the default behaviour, and should generally be switched only for unit testing + * purposes. + */ + public static void setMainTerminationExit(boolean b){ + shouldExit = b; + } + + /** * Expects one argument, an example MOBY XML input file or URL. * processRequest() is then called for every job in the input data, * and the results are printed to the screen. @@ -794,9 +895,10 @@ public static void main(String[] args) throws Exception{ if(args.length != 2){ - System.err.println("MobyServlet is ignoring the main method, executing the subclass's main method."); + System.err.println("MobyServlet is ignoring the main method (called with " + args.length + " args) " + + ", executing the subclass's main method."); System.err.println("If you wish to run the Servlet test, the usage is: "); - System.err.println("java ServletName ServetName "); + System.err.println("java ServletName SerlvetName "); return; } @@ -837,30 +939,45 @@ } catch(Exception e){ System.err.println("The test data was invalid:"); e.printStackTrace(); - System.exit(2); + if(shouldExit) + System.exit(2); + else + throw e; } // TO DO: Should we validate the input somehow? // They'll find out when they run the servlet tests later, but the earlier the better... MobyContentInstance testResults = new MobyContentInstance(); - // Create as many output slots (blank) as there were input slots - // According to the MOBY spec, there must be a 1:1 relationship here - for(String jobName : testData.keySet()){ - MobyDataJob result = new MobyDataJob(); - result.setID(jobName); - testResults.put(jobName, result); - } - + // Configure the service, minimally, to check the input data + servlet.init(new TestServletConfig(args[0], new TestServletContext())); + servlet.thisService = servlet.createServiceFromConfig(null); + // It should populate the testResults try{ servlet.processRequests(testData, testResults); } catch(Exception e){ System.err.println("An error occured while testing your code's processRequest method:"); e.printStackTrace(); - } + if(shouldExit){ + System.exit(2); + } + else{ + throw e; + } + } - System.out.println(testResults.toString()); - System.exit(0); //so that subclasses's main methods don;t executed if the test was run + if(testResults.hasExceptions(ServiceException.WARNING)){ + for(ServiceException se: testResults.getExceptions()){ + se.printStackTrace(); + } + throw new Exception("Executing service " + args[0] + " cause exceptions"); + } + else{ + System.out.println(testResults.toString()); + } + if(shouldExit){ + System.exit(0); //so that subclasses's main methods don't executed if the test was run + } } } From gordonp at dev.open-bio.org Wed Dec 6 16:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7AsS024435@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv24370/docs Modified Files: ConvertAAtoFASTA_AA.java deployingServices.html tomcatInstall.html Removed Files: mobyAASeq.xml web.xml Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/docs ConvertAAtoFASTA_AA.java,1.1,1.2 deployingServices.html,1.10,1.11 tomcatInstall.html,1.2,1.3 mobyAASeq.xml,1.1,NONE web.xml,1.1,NONE =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ConvertAAtoFASTA_AA.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/docs/ConvertAAtoFASTA_AA.java 2006/08/01 15:20:53 1.1 +++ /home/repository/moby/moby-live/Java/docs/ConvertAAtoFASTA_AA.java 2006/12/06 16:07:10 1.2 @@ -1,6 +1,11 @@ import org.biomoby.shared.MobyDataType; import org.biomoby.shared.data.*; + at mobyService(type="FormatConversion", + provider="moby.ucalgary.ca", + author="gordonp at ucalgary.ca", + in={"inseq:AminoAcidSequence"}, + out={"outseq:FASTA_AA"}) public class ConvertAAtoFASTA_AA extends org.biomoby.client.MobyServlet{ public void processRequest(MobyDataJob request, MobyDataJob result) throws Exception{ =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/deployingServices.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/11/21 21:02:05 1.10 +++ /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/12/06 16:07:10 1.11 @@ -15,10 +15,11 @@ provider of a MOBY service. It should take you less than 30 minutes. The approach is based on extending a base jMOBY Servlet, but does not require you to have any knowledge of Servlets, SOAP, XML, RDF or any of the other technologies underlying its implementation. - You do not need to checkout the jMOBY CVS, or install Axis or even Ant. + You do not need to checkout the jMOBY CVS, or install Apache Axis. Alternatively, + you can do this tutorial without Apache Ant too.

      - If on the other hand you are planning on directly hacking the jMOBY classes, the proper approach + If, on the other hand, you are planning on directly hacking the jMOBY classes, the other approach to developing services (using a code generator and the full jMOBY CVS) can be found in this document.

      @@ -27,10 +28,11 @@

      @@ -41,26 +43,59 @@
      1. A Java Development Kit version 5.0+
      2. +
      3. The Apache Ant build tool. If you have an aversion to Ant for some reason, you can follow these instructions instead, which give you the required java command lines.
      4. A Java Servlet container, such as Apache Tomcat. If you don't have one setup, here's a very quick guide.
      5. -
      6. Also download -
      + +

      Step 1: Configure your build enviroment

      +

      You need to tell Ant where your code and servlet container are located. This is done by modifying the + mobyService.properties file you just downloaded: +
      +# Where the project directory is located.
      +project.dir=/home/gordonp/development/fastaConverter
      +
      +# Where the Java source directory is located.
      +src.dir=${project.dir}/src
      +
      +# The package-qualified location of your main class (the one extending MobyServlet).
      +# You could have no package, or org/bar/foo, etc. in a real service
      +main.class.file=org/biomoby/service/test/ConvertAAtoFASTA_AA.java
      +
      +# Where all 3rd party libraries for your code are stored.
      +lib.dir=${project.dir}/lib
      +
      +# Name of the output WAR archive to be generated (will also be the servlet name).
      +my.servlet.war.file=ConvertAAtoFASTA_AA.war
      +
      +# The location of a test MOBY XML input data file (use as input to test your service).
      +input.data.file=${project.dir}/mobyAASeq.xml
      +
      +# Your Java Servlet host URL
      +servlet.host.url=http://moby.ucalgary.ca
      +
      +# Your Java Servlet port
      +servlet.port=8089
      +
      + +

      + -

      Step 1: Write the function

      +

      Step 2: Write the function

      MobyServlet takes care of all of the protocol issues for you, all you need to do is override the business logic method: processRequest

      -

      For example, the following service consumes a +

      For example, the following service consumes a MOBY AminoAcidSequence object called "inseq", and returns it reformatted into a @@ -68,10 +103,22 @@ FASTA_AA object called "outseq":
      +package org.biomoby.service.test; // This could be any package you want in real life...
      +
       import org.biomoby.shared.MobyDataType;
       import org.biomoby.shared.data.*;
      +import org.biomoby.service.*;
      +
      + at mobyService(name="ConvertAAtoFASTA_AA",
      +             type="FormatConversion", 
      +	     provider="moby.ucalgary.ca", 
      +	     author="gordonp at ucalgary.ca",
      +	     in={"inseq:AminoAcidSequence"},
      +	     out={"outseq:FASTA_AA"},
      +	     description={"Converts amino acid objects into FastA formatted records, ", 
      +			  "primarily to increase inter-service compatibility"})
       
      -public class ConvertAAtoFASTA_AA extends org.biomoby.service.MobyServlet{
      +public class ConvertAAtoFASTA_AA extends MobyServlet{
       
           public void processRequest(MobyDataJob request, MobyDataJob result) throws Exception{
                // The input parameter for this method is registered as "inseq"
      @@ -94,115 +141,54 @@
                // Set the result that will be passed back to the client
                result.put("outseq", fastaObject);
           }
      -}
      -      
      +} + +

      Save a file with the code above in a file called + ${src.dir}/org/biomoby/service/test/ConvertAAtoFASTA_AA.java

      -

      That's it for the coding. Really! Now compile it (remember: Java 1.5), including the MobyServlet.war - you downloaded in the class path, e.g.:

      +

      Notice the @mobyService line. This is a Java + annotation used by + the base MobyServlet to do all the input type checking for you. If you've specified the annotation + correctly, you are guaranteed that processRequest will only receive syntactically + and semantically valid data. The same annotation is eventually used to publish your service's meta-data to + MOBY Central.

      + +

      That's it for the coding. Really! Now compile it (Ant will automatically fetch the + MobyServlet.war you are extending), running the following command in the same + directory where you saved the build.xml file:

      -
      javac -cp MobyServlet.war:. ConvertAAtoFASTA_AA.java
      +
      ant compile

      When you go to write your own services with different data types, a quick tutorial on the data API can be found here. All of the datatypes, service types and namespaces you use must be registered - in the MOBY Ontologies.

      + in the MOBY Ontologies. Also, + when you go to create your own services, you'll put the Java code in a directory that matches a package name of your + own choosing (e.g. ${src.dir}/org/foo/bar.java, or just ${src.dir}/foo.java for no-package code)

      You should probably test that your business logic works! The base servlet has a built-in application test, so just type: -

      java -cp MobyServlet.war:. ConvertAAtoFASTA_AA ConvertAAtoFASTA_AA mobyAASeq.xml
      +
      ant test
      and make sure the output is as you expected. - Note that the class name is given twice, - once to the JVM, and once as an argument to the application itself.

      +

      -

      Step 2: Package the code

      - +

      Step 3: Package the code

      The default MobyServlet.war business logic is to just return blank MOBY messages. - You've got to customize it for your service with the following:

      -
        -
      1. Copy MobyServlet.war to ConvertAAtoFASTA_AA.war
      2. -
      3. Edit the WAR's WEB-INF/web.xml to tell it about your class - (a WAR is just a JAR with a particular directory structure): -
        -# Extract the existing web.xml from the WAR
        -jar xvf ConvertAAtoFASTA_AA.war WEB-INF/web.xml
        -# Edit the file with your favorite editor (see the table below)
        -vi WEB-INF/web.xml
        -
      4. -
      + You've got to customize it as your new WAR file with the following:

      -

      For our example converter, it should minimally look like this, with the required changes to the default web.xml shown in bold: -
      -
      -<?xml version="1.0" encoding="ISO-8859-1"?>
      -<!DOCTYPE web-app 
      -    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
      -    "http://java.sun.com/dtd/web-app_2_3.dtd">
      -
      -<web-app>
      -    <display-name>BioMOBY Web Service: Convert AA -> FASTA_AA</display-name>
      -    <servlet>
      -      <servlet-name>ConvertAAtoFASTA_AA</servlet-name>
      -      <servlet-class>ConvertAAtoFASTA_AA</servlet-class>
      -
      -    </servlet>
      -    <servlet-mapping>
      -      <servlet-name>ConvertAAtoFASTA_AA</servlet-name>
      -      <url-pattern>/</url-pattern>
      -    </servlet-mapping>
      -
      -    <context-param>
      -      <param-name>mobyServiceDescription</param-name>
      -      <param-value>Converts amino acid objects into FastA formatted records, 
      -                   primarily to increase inter-service compatibility</param-value>
      -    </context-param>
      -
      -    <context-param>
      -      <param-name>mobyInput</param-name>
      -      <param-value>inseq:AminoAcidSequence</param-value>
      -    </context-param>
      -
      -    <context-param>
      -      <param-name>mobyOutput</param-name>
      -      <param-value>outseq:FASTA_AA</param-value>
      -    </context-param>
      -
      -    <context-param>
      -      <param-name>mobyServiceType</param-name>
      -      <param-value>FormatConversion</param-value>
      -    </context-param>
      -
      -    <context-param>
      -      <param-name>mobyProviderURI</param-name>
      -      <param-value>your.domain.name</param-value>
      -    </context-param>
      -
      -    <context-param>
      -      <param-name>mobyAuthorContact</param-name>
      -      <param-value>yourname at email.com</param-value>
      -    </context-param>
      -
      -</web-app>
      - -

    • Put your new class and the updated web.xml in the WAR file: -
      -mkdir WEB-INF/classes
      -cp ConvertAAtoFASTA_AA.class WEB-INF/classes
      -jar uvf ConvertAAtoFASTA_AA.war WEB-INF
      -	  
    • - -

      The web.xml file is used by the Servlet container (e.g. Tomcat), and by the base MobyServlet -to do all the input type checking for you. If you've specified this file correctly, you are guaranteed that -processRequest will only receive syntactically valid data.

      +
      ant war
      + +

      The resulting ConvertAAtoFASTA_AA.war is in the build directory you specified in Step 1. -

      Step 3: Deploy the servlet

      +

      Step 4: Deploy the servlet

      -

      ConvertAAtoFASTA_AA.war now contains your Web Service, and is ready to be deployed +

      ConvertAAtoFASTA_AA.war now contains your MOBY-S Web Service, and is ready to be deployed in the Servlet container. How you do this depends on the container. For Tomcat, the easiest way is to use the management Web interface (e.g. http://your.servlet.host:8080/manager/html, but change 8080 appropriately if you had to follow Step 0) and upload the WAR. @@ -228,14 +214,15 @@

      -

      Step 4: Register the service

      +

      Step 5: Register the service

      You should test your service to make sure it works in the servlet environment. - A testing client program is automagically included in your WAR, so type (with - the fully qualified host name, and change 8080 appropriately if you had follow - Step 0): -

      java -jar ConvertAAtoFASTA_AA.war http://your.servlet.host:8080/ConvertAAtoFASTA_AA mobyAASeq.xml
      + A testing client program is automagically included in your WAR, so type: + +
      ant testService
      + +

      If the service fails, a useful error message should be printed to help you diagnose the problem. - This would usually be an incorrect web.xml, or the data type you return isn't what you declared + This would usually be because the data type you return isn't what you declared (this is the first occasion your output is thoroughly checked). If you get a java.lang.NoClassDefFoundError, please see the notes below. If that doesn't help, let me know (gordonp -Last modified: Tue Nov 21 13:16:31 MST 2006 +Last modified: Wed Dec 6 08:39:50 MST 2006 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/tomcatInstall.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/docs/tomcatInstall.html 2006/11/21 21:02:26 1.2 +++ /home/repository/moby/moby-live/Java/docs/tomcatInstall.html 2006/12/06 16:07:10 1.3 @@ -61,7 +61,7 @@ </tomcat-users> -

    • Windows: in step 2 you created the admin account.
    • +
    • Windows: in step 2 you created the admin account.
    • Step 4: Start the servlet container. @@ -84,7 +84,7 @@
      Paul Gordon
      -Last modified: Tue Nov 21 13:17:49 MST 2006 +Last modified: Tue Dec 5 09:23:31 MST 2006 rcsdiff: /home/repository/moby/moby-live/Java/docs/RCS/mobyAASeq.xml,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Java/docs/RCS/web.xml,v: No such file or directory From gordonp at dev.open-bio.org Wed Dec 6 16:07:11 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7Bf2024531@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/webapps/WEB-INF In directory dev.open-bio.org:/tmp/cvs-serv24370/src/webapps/WEB-INF Added Files: web.xml Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/src/webapps/WEB-INF web.xml,NONE,1.1 From gordonp at dev.open-bio.org Wed Dec 6 16:07:11 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:11 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7BIT024571@dev.open-bio.org> gordonp Wed Dec 6 11:07:11 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv24370/xmls/servlet Added Files: build.xml mobyService.properties Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/xmls/servlet build.xml,NONE,1.1 mobyService.properties,NONE,1.1 From gordonp at dev.open-bio.org Wed Dec 6 16:07:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:07:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061607.kB6G7Ab9024495@dev.open-bio.org> gordonp Wed Dec 6 11:07:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test In directory dev.open-bio.org:/tmp/cvs-serv24370/src/main/org/biomoby/service/test Added Files: ConvertAAtoFASTA_AA.java FromFastaToDNASequence.java MobyServletTestCase.java ServletTester.java StringBufferServletOutputStream.java TestHttpServletRequest.java TestHttpServletResponse.java TestServletConfig.java TestServletContext.java mobyAASeq.xml Log Message: Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification moby-live/Java/src/main/org/biomoby/service/test ConvertAAtoFASTA_AA.java,NONE,1.1 FromFastaToDNASequence.java,NONE,1.1 MobyServletTestCase.java,NONE,1.1 ServletTester.java,NONE,1.1 StringBufferServletOutputStream.java,NONE,1.1 TestHttpServletRequest.java,NONE,1.1 TestHttpServletResponse.java,NONE,1.1 TestServletConfig.java,NONE,1.1 TestServletContext.java,NONE,1.1 mobyAASeq.xml,NONE,1.1 From gordonp at dev.open-bio.org Wed Dec 6 16:25:51 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 11:25:51 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061625.kB6GPpsJ024665@dev.open-bio.org> gordonp Wed Dec 6 11:25:51 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv24630 Modified Files: index.html Log Message: Doc updates for today's commit moby-live/Java/docs index.html,1.28,1.29 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/index.html,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- /home/repository/moby/moby-live/Java/docs/index.html 2006/09/07 09:22:08 1.28 +++ /home/repository/moby/moby-live/Java/docs/index.html 2006/12/06 16:25:51 1.29 @@ -109,7 +109,7 @@
    • Using general methods
        -
      • Seahawk: An extensible, user-oriented MOBY client
      • How to @@ -137,12 +137,11 @@
      • Using general methods @@ -191,7 +190,7 @@
        Martin Senger
        -Last modified: 07 Sep 2006, 11:21:06 +Last modified: Wed Dec 6 09:24:31 MST 2006
        From gordonp at dev.open-bio.org Wed Dec 6 17:55:29 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 12:55:29 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061755.kB6HtTvf025098@dev.open-bio.org> gordonp Wed Dec 6 12:55:29 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv25063/xmls/servlet Modified Files: build.xml Log Message: Made log4j properties file optional moby-live/Java/xmls/servlet build.xml,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/servlet/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/xmls/servlet/build.xml 2006/12/06 16:07:11 1.1 +++ /home/repository/moby/moby-live/Java/xmls/servlet/build.xml 2006/12/06 17:55:29 1.2 @@ -102,7 +102,7 @@ - + From gordonp at dev.open-bio.org Wed Dec 6 18:19:05 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 13:19:05 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061819.kB6IJ5li025441@dev.open-bio.org> gordonp Wed Dec 6 13:19:05 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv25406/xmls/servlet Modified Files: mobyService.properties Log Message: Modified to work nicely with the tutorial moby-live/Java/xmls/servlet mobyService.properties,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/06 16:07:11 1.1 +++ /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/06 18:19:05 1.2 @@ -1,20 +1,20 @@ # Where the project directory is located. -project.dir=/export/home/qtrinh/DEPLOYMENT/codonUsageTable +project.dir=/export/home/gordonp/development/service # Where the Java source directory is located. src.dir=${project.dir}/src # The package-qualified location of your main class (the one extending MobyServlet). -main.class.file=ca/ucalgary/codonUsage/CodonUsageTable.java +main.class.file=org/biomoby/service/test/ConvertAAtoFASTA_AA.java # Where all 3rd party libraries for your code are stored. lib.dir=${project.dir}/lib # Name of the output WAR archive to be generated (will also be the servlet name). -my.servlet.war.file=GenerateCodonUsageTable.war +my.servlet.war.file=ConvertAAtoFASTA_AA.war # The location of a test MOBY XML input data file (use as input to test your service). -input.data.file=${project.dir}/mobyDNASeqs.xml +input.data.file=${project.dir}/mobyAASeq.xml # Java Servlet host URL servlet.host.url=http://moby.ucalgary.ca From gordonp at dev.open-bio.org Wed Dec 6 18:37:51 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 6 Dec 2006 13:37:51 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612061837.kB6IbpPu025771@dev.open-bio.org> gordonp Wed Dec 6 13:37:51 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv25736/xmls/servlet Modified Files: mobyService.properties Log Message: Modified to work nicely with the tutorial moby-live/Java/xmls/servlet mobyService.properties,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/06 18:19:05 1.2 +++ /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/06 18:37:51 1.3 @@ -4,7 +4,7 @@ # Where the Java source directory is located. src.dir=${project.dir}/src -# The package-qualified location of your main class (the one extending MobyServlet). +# The package-qualified location of your main class's source code (the one extending MobyServlet). main.class.file=org/biomoby/service/test/ConvertAAtoFASTA_AA.java # Where all 3rd party libraries for your code are stored. @@ -13,7 +13,7 @@ # Name of the output WAR archive to be generated (will also be the servlet name). my.servlet.war.file=ConvertAAtoFASTA_AA.war -# The location of a test MOBY XML input data file (use as input to test your service). +# The location of a test MOBY XML input data file (used as input to test your service). input.data.file=${project.dir}/mobyAASeq.xml # Java Servlet host URL From mwilkinson at dev.open-bio.org Thu Dec 7 16:18:04 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 7 Dec 2006 11:18:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071618.kB7GI4Km029581@dev.open-bio.org> mwilkinson Thu Dec 7 11:18:04 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv29562/MOBY Modified Files: Central.pm Log Message: proving that I am working in Germany :-) Heiko and I are making MOBY POST, as an alternative to MOBY SOAP. Will also help with message chunking, since you can process the message as it is streaming in. moby-live/Perl/MOBY Central.pm,1.262,1.263 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.262 retrieving revision 1.263 diff -u -r1.262 -r1.263 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/10/17 14:00:53 1.262 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/07 16:18:04 1.263 @@ -1302,18 +1302,18 @@ $error .= "missing Category \n" unless defined $Category; return &_error( "malformed payload $error\n\n", "" ) if ($error); return &_error( - "Category may take the (case sensitive) values 'moby', 'cgi', 'soap'\n", + "Category may take the (case sensitive) values 'moby', 'cgi', 'post', 'wsdl'\n", "" ) unless ( ( $Category eq "wsdl" ) - # || ($Category eq "cgi") + || ($Category eq "cgi") || ( $Category eq "moby" ) + || ( $Category eq "post" ) ); - $debug && &_LOG("Entering switch with $Category method\n"); - return &_error("Service categories other than 'moby' and 'wsdl' are not yet implemented","") - unless ( ( $Category eq "moby" ) || ( $Category eq "wsdl" ) ); + return &_error("Service categories other than 'moby', 'post' are not yet implemented","") + unless ( ( $Category eq "moby" ) || ( $Category eq "post" ) ); #test the existence of the service return &_error( "This service already exists", "" ) if (MOBY::service_instance->new( From mwilkinson at dev.open-bio.org Thu Dec 7 16:18:04 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 7 Dec 2006 11:18:04 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071618.kB7GI4fS029599@dev.open-bio.org> mwilkinson Thu Dec 7 11:18:04 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv29562/MOBY/Client Modified Files: Central.pm Log Message: proving that I am working in Germany :-) Heiko and I are making MOBY POST, as an alternative to MOBY SOAP. Will also help with message chunking, since you can process the message as it is streaming in. moby-live/Perl/MOBY/Client Central.pm,1.135,1.136 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.135 retrieving revision 1.136 diff -u -r1.135 -r1.136 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2006/05/04 19:33:08 1.135 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2006/12/07 16:18:04 1.136 @@ -712,9 +712,9 @@ #____________________________________________________________________________________________ return $self->errorRegXML( -"Only 'moby' and 'wsdl' Service Categories are currently allowed - you gave me $Category" +"Only 'moby', 'post' and 'wsdl' Service Categories are currently allowed - you gave me $Category" ) - unless ( ( $Category eq 'moby' ) || ( $Category eq 'wsdl' ) ); + unless ( ( $Category eq 'moby' ) || ( $Category eq 'wsdl' ) || ( $Category eq 'post' )); return $self->errorRegXML( "All Fields Required: serviceName, serviceType, authURI, contactEmail, URL, description, Category, input, output, secondary" ) @@ -736,7 +736,7 @@ $authURI $email"; - if ( $Category eq "moby" || $Category eq 'soap' ) { + if ( $Category eq "moby" || $Category eq 'soap' || $Category eq 'post') { my %SEC; if ( $a{'secondary'} && ( ref( $a{'secondary'} ) eq 'HASH' ) ) { %SEC = %{ $a{secondary} }; @@ -861,9 +861,7 @@ $message .= ""; } else { - return $self->errorRegXML( -"only 'moby' and 'wsdl' service types are allowed to be registered at this time." - ); + return $self->errorRegXML("only 'moby', 'post' and 'wsdl' service types are allowed to be registered at this time."); } #elsif ($Category eq "cgi") { From gordonp at dev.open-bio.org Thu Dec 7 16:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7Gbavw029758@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/shared/data Modified Files: MobyDataSecondaryInstance.java Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/shared/data MobyDataSecondaryInstance.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2006/07/07 04:12:40 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2006/12/07 16:37:36 1.7 @@ -4,6 +4,8 @@ import org.biomoby.shared.*; import org.biomoby.shared.parser.MobyTags; import org.w3c.dom.*; +import java.math.*; +import java.util.GregorianCalendar; // with apologies to the Julians among us... /** * A class that holds and displays secondary input data to a service. @@ -26,7 +28,11 @@ public MobyDataSecondaryInstance(MobySecondaryData type){ super(type.getName()); setId(type.getId()); - setDataType(type.getDataType()); + try{ + setDataType(type.getDataType()); + }catch(Exception e){ + e.printStackTrace(); + } setAllowedValues(type.getAllowedValues()); setDefaultValue(type.getDefaultValue()); setMinimumValue(type.getMinimumValue()); @@ -49,7 +55,11 @@ if(getName().length() == 0){ throw new MobyException("Secondary parameters with blank articleNames are not allowed, input was: " + objectTag); } - setDataType("String"); + try{ + setDataType(MobySecondaryData.STRING_TYPE); + } catch(Exception e){ + e.printStackTrace(); + } if(objectTag == null){ return; @@ -75,6 +85,38 @@ setValue(MobyDataObject.getTextContents((Element) values.item(0))); } + public boolean asBoolean(){ + return dataValue.equalsIgnoreCase("true") || dataValue.equals("1") || dataValue.equalsIgnoreCase("T"); + } + + public BigDecimal asFloat(){ + try{ + return new BigDecimal(dataValue); + } catch(Exception e){ + return null; + } + } + + public BigInteger asInteger(){ + try{ + return new BigInteger(dataValue); + } catch(Exception e){ + return null; + } + } + + public String asString(){ + return dataValue; + } + + public GregorianCalendar asDateTime(){ + try{ + return MobyDataDateTime.parseISO8601(dataValue); + } catch(Exception e){ + return null; + } + } + /** * For now, all secondary parameters are treated as strings. */ From gordonp at dev.open-bio.org Thu Dec 7 16:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7GbaPN029664@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/ca/ucalgary/seahawk/gui Modified Files: MobySecondaryInputGUI.java Log Message: Updates to secondary article handling moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobySecondaryInputGUI.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobySecondaryInputGUI.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/seahawk/gui/MobySecondaryInputGUI.java 2006/10/25 02:33:22 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobySecondaryInputGUI.java 2006/12/07 16:37:36 1.2 @@ -2,6 +2,7 @@ package ca.ucalgary.seahawk.gui; import org.biomoby.shared.data.MobyDataSecondaryInstance; +import org.biomoby.shared.MobySecondaryData; import java.awt.*; import javax.swing.*; import javax.swing.text.JTextComponent; @@ -177,18 +178,21 @@ return makeEnumWidget(msdi); } // Otherwise build a widget based on the data type - else if("Integer".equals(dataType)){ + else if(MobySecondaryData.INTEGER_TYPE.equals(dataType)){ return makeIntWidget(msdi); } - else if("Float".equals(dataType)){ + else if(MobySecondaryData.FLOAT_TYPE.equals(dataType)){ return makeFloatWidget(msdi); } - else if("String".equals(dataType)){ + else if(MobySecondaryData.STRING_TYPE.equals(dataType)){ return makeStringWidget(msdi); } - else if("DateTime".equals(dataType)){ + else if(MobySecondaryData.DATETIME_TYPE.equals(dataType)){ return makeDateTimeWidget(msdi); } + else if(MobySecondaryData.BOOLEAN_TYPE.equals(dataType)){ + return makeBooleanWidget(msdi); + } else{ logger.warn("Unrecognized secondary input data type (" + dataType + ") in " + getClass()); return null; @@ -219,6 +223,24 @@ return widget; } + public Component makeBooleanWidget(MobyDataSecondaryInstance msdi){ + String defaultValue = msdi.getDefaultValue(); + if(defaultValue == null){ + defaultValue = "false"; + } + + JPanel widget = new JPanel(); + widget.add(makeJLabel(msdi)); + JCheckBox checkbox = new JCheckBox(); + checkbox.setSelected(defaultValue.toLowerCase().equals("true") || + defaultValue.equals("1") || + defaultValue.equals("T")); + data2widget.put(msdi, checkbox); + widget.add(checkbox); + + return widget; + } + public Component makeStringWidget(MobyDataSecondaryInstance msdi){ String defaultValue = msdi.getDefaultValue(); if(defaultValue == null){ @@ -378,6 +400,7 @@ } public Component makeDateTimeWidget(MobyDataSecondaryInstance msdi){ + //TODO return null; } From gordonp at dev.open-bio.org Thu Dec 7 16:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7GbaYi029682@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool Modified Files: MobyInputOutputData.java Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool MobyInputOutputData.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool/MobyInputOutputData.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool/MobyInputOutputData.java 2005/07/19 15:44:10 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/applets/serviceInstanceCreationTool/MobyInputOutputData.java 2006/12/07 16:37:36 1.3 @@ -173,7 +173,11 @@ else data = new MobySecondaryData("un-named"); - data.setDataType(dataTypeName); + try{ + data.setDataType(dataTypeName); + } catch(Exception e){ + e.printStackTrace(); // will default to string if unrecognized + } if (dataDefault != null && !dataDefault.equals("")) data.setDefaultValue(dataDefault); if (min != null && !min.equals("")) From gordonp at dev.open-bio.org Thu Dec 7 16:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7Gba92029740@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/shared Modified Files: MobySecondaryData.java Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/shared MobySecondaryData.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java 2006/11/11 23:04:34 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java 2006/12/07 16:37:36 1.10 @@ -23,8 +23,13 @@ public class MobySecondaryData extends MobyData { + public static final String INTEGER_TYPE = "Integer"; + public static final String FLOAT_TYPE = "Float"; + public static final String STRING_TYPE = "String"; + public static final String DATETIME_TYPE = "DateTime"; + public static final String BOOLEAN_TYPE = "Boolean"; - protected String dataType = "String"; + protected String dataType = STRING_TYPE; protected String defaultValue = ""; protected String minimumValue = ""; protected String maximumValue = ""; @@ -54,14 +59,18 @@ * </Parameter> * *************************************************************************/ - public MobySecondaryData (Element elem) { + public MobySecondaryData (Element elem){ super (elem.getAttribute ("articleName")); NodeList children = elem.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { String childName = children.item (i).getNodeName(); if (childName.equals ("datatype")) { if (children.item (i).getFirstChild() != null) - setDataType (children.item (i).getFirstChild().getNodeValue()); + try{ + setDataType (children.item (i).getFirstChild().getNodeValue()); + } catch(Exception e){ + e.printStackTrace(); + } } else if (childName.equals ("description")) { if (children.item (i).getFirstChild() != null) setDescription (children.item (i).getFirstChild().getNodeValue()); @@ -84,8 +93,29 @@ public String getDataType() { return dataType; } - public void setDataType (String value) { - dataType = (value == null ? "" : value); + + public void setDataType (String value) throws Exception{ + if(value.equalsIgnoreCase(INTEGER_TYPE)){ + dataType = INTEGER_TYPE; + } + else if(value.equalsIgnoreCase(FLOAT_TYPE)){ + dataType = FLOAT_TYPE; + } + else if(value.equalsIgnoreCase(STRING_TYPE)){ + dataType = STRING_TYPE; + } + else if(value.equalsIgnoreCase(DATETIME_TYPE)){ + dataType = DATETIME_TYPE; + } + else if(value.equalsIgnoreCase(BOOLEAN_TYPE)){ + dataType = BOOLEAN_TYPE; + } + else{ + throw new Exception("Data type for secondary parameter '" + getName() + + "' was not valid (\"" + value + "\"), must be one of " + + INTEGER_TYPE + ", " + FLOAT_TYPE + ", " + STRING_TYPE + ", " + + DATETIME_TYPE + ", " + BOOLEAN_TYPE); + } } public String getDefaultValue() { From gordonp at dev.open-bio.org Thu Dec 7 16:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7GbacV029722@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/service/test Modified Files: MobyServletTestCase.java mobyAASeq.xml Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/service/test MobyServletTestCase.java,1.1,1.2 mobyAASeq.xml,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java 2006/12/06 16:07:10 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/MobyServletTestCase.java 2006/12/07 16:37:36 1.2 @@ -218,12 +218,10 @@ } public void testAsync(){ + // TODO } - public void testRegister(){ - } - - public void testUnregister(){ + public void testSecondaryParams(){ } /** @@ -235,6 +233,7 @@ suite.addTest(new MobyServletTestCase("testRDF")); suite.addTest(new MobyServletTestCase("testRequestChain")); suite.addTest(new MobyServletTestCase("testMain")); + suite.addTest(new MobyServletTestCase("testSecondaryParams")); suite.addTest(new MobyServletTestCase("testServletTester")); return suite; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/mobyAASeq.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/mobyAASeq.xml 2006/12/06 16:07:10 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/test/mobyAASeq.xml 2006/12/07 16:37:36 1.2 @@ -8,6 +8,11 @@ 499 + true + 100 + nr + 1.0e-5 + 2005-08-13 From gordonp at dev.open-bio.org Thu Dec 7 16:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7Gbadk029776@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/shared/extended Modified Files: ServiceInstanceParser.java Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/shared/extended ServiceInstanceParser.java,1.19,1.20 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/10/26 00:28:58 1.19 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/extended/ServiceInstanceParser.java 2006/12/07 16:37:36 1.20 @@ -561,7 +561,11 @@ // create the datatype MobySecondaryData secondary = new MobySecondaryData(articlename); - secondary.setDataType(datatype); + try{ + secondary.setDataType(datatype); + } catch(Exception e){ + e.printStackTrace(); // will default to String if unrecognized + } if (parameter.hasProperty(FetaVocabulary.hasDefaultValue)) { secondary.setDefaultValue(parameter.getProperty( From gordonp at dev.open-bio.org Thu Dec 7 16:37:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 11:37:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071637.kB7GbaGp029700@dev.open-bio.org> gordonp Thu Dec 7 11:37:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service In directory dev.open-bio.org:/tmp/cvs-serv29629/src/main/org/biomoby/service Modified Files: MobyServlet.java Log Message: Updates to secondary article handling moby-live/Java/src/main/org/biomoby/service MobyServlet.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java 2006/12/06 16:07:10 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/MobyServlet.java 2006/12/07 16:37:36 1.4 @@ -31,6 +31,7 @@ import javax.xml.soap.*; import java.util.StringTokenizer; import java.util.Vector; +import java.math.*; @mobyService(name="MobyServlet", type="Testing", @@ -49,7 +50,7 @@ public static final String MOBY_SERVICETYPE_PARAM = "mobyServiceType"; public static final String MOBY_SERVICENAME_PARAM = "mobyServiceName"; public static final String MOBY_INPUT_PARAM = "mobyInput"; - public static final String MOBY_SECONDARY_PARAM = "mobySecondaryInput"; + public static final String MOBY_SECONDARYINPUT_PARAM = "mobySecondaryInput"; public static final String MOBY_OUTPUT_PARAM = "mobyOutput"; public static final String MODE_HTTP_PARAM = "mode"; public static final String RDF_MODE = "rdf"; @@ -279,7 +280,9 @@ return mobyRequestContents; } - // throws an exception if the data is not as expected + /** + * Throws an exception if the data in the job does not match the input spec of the service + */ public static void validateArguments(MobyDataJob job, MobyService service, String errMessagePrefix) throws Exception{ @@ -362,6 +365,98 @@ " does not have one of the required namespaces"); } } + + // Check for secondary parameters, and fill in missing ones with the default values + MobySecondaryData[] template2 = service.getSecondaryInputs(); + MobyDataSecondaryInstance[] values2 = job.getSecondaryData(); + + for(MobySecondaryData param: template2){ + MobyDataSecondaryInstance matchingValue = null; + for(MobyDataSecondaryInstance value: values2){ + if(value.getName().equals(param.getName())){ + matchingValue = value; + break; + } + } + + if(matchingValue != null){ + String dataType = param.getDataType(); + // This is the first point at which we have enough info to assign + // a data type to the secondary parameter in the job (it is string by default + // when parsing the XML). + try{ + matchingValue.setDataType(dataType); + } catch(Exception e){ + e.printStackTrace(); // will default to String if unrecognized + } + // Check that the value given is valid + if(dataType.equals(MobySecondaryData.INTEGER_TYPE)){ + BigInteger val = matchingValue.asInteger(); + if(param.getMinValue() != null && param.getMinValue().length() > 0){ + BigInteger min = new BigInteger(param.getMinValue()); + if(min.compareTo(val) > 0){ + // Out of range (too small), reset the value + matchingValue.setValue(min.toString()); + } + } + if(param.getMaxValue() != null && param.getMaxValue().length() > 0){ + BigInteger max = new BigInteger(param.getMaxValue()); + if(max.compareTo(val) < 0){ + // Out of range (too big), reset the value + matchingValue.setValue(max.toString()); + } + } + } + else if(dataType.equals(MobySecondaryData.FLOAT_TYPE)){ + BigDecimal val = matchingValue.asFloat(); + if(param.getMinValue() != null && param.getMinValue().length() > 0){ + BigDecimal min = new BigDecimal(param.getMinValue()); + if(min.compareTo(val) > 0){ + // Out of range (too small), reset the value + matchingValue.setValue(min.toString()); + } + } + if(param.getMaxValue() != null && param.getMaxValue().length() > 0){ + BigDecimal max = new BigDecimal(param.getMaxValue()); + if(max.compareTo(val) < 0){ + // Out of range (too big), reset the value + matchingValue.setValue(max.toString()); + } + } + } + else if(dataType.equals(MobySecondaryData.STRING_TYPE)){ + // Enumerated? + String val = matchingValue.asString(); + String[] allowedVals = param.getAllowedValues(); + if(allowedVals != null && allowedVals.length > 0){ + boolean isInList = false; + for(String allowedVal: allowedVals){ + if(allowedVal != null && allowedVal.equals(val)){ + isInList = true; + break; + } + } + if(!isInList){ + // Illegal value given, use the default instead + matchingValue.setValue(param.getDefaultValue()); + } + } + } + else if(dataType.equals(MobySecondaryData.DATETIME_TYPE)){ + // TODO + } + else if(dataType.equals(MobySecondaryData.BOOLEAN_TYPE)){ + // no issues here... + } + else{ + // what type is this ??? + } + } + else{ + // Missing value, fill it in with the default + job.put(param.getName(), new MobyDataSecondaryInstance(param, param.getDefaultValue())); + } + } } private void writeResponse(HttpServletResponse response, MobyContentInstance mobyResults){ @@ -548,7 +643,7 @@ public synchronized MobyService createServiceFromConfig(HttpServletRequest request) throws Exception{ MobyService service = new MobyService(getServiceName()); - Vector inputTypes = new Vector(); + Vector inputTypes = new Vector(); Vector outputTypes = new Vector(); mobyService ann = @@ -602,6 +697,16 @@ } } + String[] secondaries = ann.secondaryParams(); + if(config != null && config.getInitParameter(MOBY_SECONDARYINPUT_PARAM) != null){ + secondaries = config.getInitParameter(MOBY_SECONDARYINPUT_PARAM).split(","); + } + if(secondaries != null && secondaries.length > 0){ + for(String secondary: secondaries){ + inputTypes.add(stringToSecondaryDataTemplate(secondary)); + } + } + service.setInputs(inputTypes.toArray(new MobyData[inputTypes.size()])); service.setOutputs(outputTypes.toArray(new MobyData[outputTypes.size()])); @@ -746,6 +851,144 @@ } /** + * Strings have the form name:paramType:default:spec where spec depends on the parameter type. + * Currently, these are the valid paramTypes and their specs: + * + *
        • Integer: blank or [,max] or [min,] or [min,max]
        • + *
        • Float: blank or [,max] or [min,] or [min,max]
        • + *
        • String: blank or [choice1,choice2,...]
        • + *
        • DateTime: blank or [,max] or [min,] or [min,max]
        • + *
        • Boolean: blank
        + * + * e.g. db:String:nr:[nr,nt,est,swissprot] + * + * e.g. filter:Boolean:true + * + * e.g. hits:Integer:100:[0,] + */ + public static MobySecondaryData stringToSecondaryDataTemplate(String template) throws Exception{ + String[] fields = template.split(":"); + if(fields.length < 3){ + throw new Exception("The parameter specification (" + + template + ") must have the minimal form " + + "\"name:paramType:defaultValue\", aborting!"); + } + if(fields[0].length() < 1){ + throw new Exception("The parameter specification (" + + template + ") has a blank parameter name, this is not allowed"); + } + if(fields[1].length() < 1){ + throw new Exception("The parameter specification (" + + template + ") has a blank parameter type, this is not allowed"); + } + MobySecondaryData dataTemplate = new MobySecondaryData(fields[0]); + String dataType = fields[1]; + try{ + dataTemplate.setDataType(dataType); // should throw an exception if invalid param type + } catch(Exception e){ + e.printStackTrace(); + throw new Exception("Error in parameter type (" + dataType + "') of secondary " + + "parameters specification '" + template + "': " + e); + } + + String defaultValue = fields[2]; + dataTemplate.setDefaultValue(defaultValue); + + String spec = ""; + int i = 3; + for(; i < fields.length-1; i++){ + spec = spec + fields[i] + ":"; + } + if(i == fields.length-1){ + spec = spec + fields[i]; + } + + // Ensure the [] are there, and strip them + if(spec.length() > 0){ + if(spec.indexOf('[') != 1 || spec.lastIndexOf(']') != spec.length()){ + throw new Exception("Parameter options specification (4th field of '" + + template + "') " + + "does not have the required form '[...]', but rather: " + spec); + } + spec = spec.substring(1, spec.length()); + } + String[] specValues = new String[0]; + if(spec.length() > 0){ + specValues = spec.split(","); + } + + if(dataType.equals(MobySecondaryData.INTEGER_TYPE) || + dataType.equals(MobySecondaryData.FLOAT_TYPE)){ + if(specValues.length > 0){ + if(specValues.length != 2){ + throw new Exception("Numeric parameter options specification (4th field of " + + template + "') " + + "does not have on of the required forms [min,] or [,max] or [min,max]"); + } + BigDecimal min = null; + BigDecimal max = null; + if(specValues[0].length() != 0){ + min = new BigDecimal(specValues[0]); // will throw exception if not a number + } + if(specValues[1].length() != 0){ + max = new BigDecimal(specValues[1]); // will throw exception if not a number + } + // We will actually accept [,] as an unlimited range + if(min != null && max != null && min.compareTo(max) > 0){ + throw new Exception("Numeric parameter range (4th field of " + template + "') " + + "has a minimum value greater than the maximum value"); + } + BigDecimal defaultNumber = new BigDecimal(defaultValue); // will throw exception if not a number + if(min != null){ + if(min.compareTo(defaultNumber) > 0){ + throw new Exception("Numeric parameter default (3rd field of " + template + "') " + + "is less than the minimum value specified"); + } + } + if(min != null){ + if(max.compareTo(defaultNumber) < 0){ + throw new Exception("Numeric parameter default (3rd field of " + template + "') " + + "is greater than the maximum value specified"); + } + } + } + } + else if(dataType.equals(MobySecondaryData.STRING_TYPE)){ + if(specValues.length > 0){ // an enumeration + boolean defaultListed = false; + for(String value: specValues){ + if(defaultValue.equals(value)){ + defaultListed = true; + break; + } + } + if(!defaultListed){ + throw new Exception("The default value (" + defaultValue + + ") was not listed in the enumeration (" + + spec + ")"); + } + + dataTemplate.setAllowedValues(specValues); + } + // otherwise it's a freeform string + } + else if(dataType.equals(MobySecondaryData.BOOLEAN_TYPE)){ + if(specValues.length > 0){ + throw new Exception("Boolean secondary parameter specification provided " + + "superfluous fields (only 3 needed): " + spec); + } + } + else if(dataType.equals(MobySecondaryData.DATETIME_TYPE)){ + // TODO + } + else{ + throw new Exception("Unrecognized secondary data type encountered: " + dataType); + } + + return dataTemplate; + } + + /** * Strings have the form name:objectType:namespace, with ":namespace" optional * If the input is expected to be a Collection, then the syntax is name:Collection(objectType):namespace */ @@ -753,21 +996,18 @@ StringTokenizer st = new StringTokenizer(spec, ":"); String name = st.nextToken(); if(name == null || name.length() == 0){ - System.err.println("Anonymous parameters are not allowed in service calls (" + - spec + "), aborting!"); - System.exit(1); + throw new Exception("Anonymous parameters are not allowed in service calls (" + + spec + "), aborting!"); } if(!st.hasMoreTokens()){ - System.err.println("The parameter specification (" + - spec + ") must have the minimal form " + - "\"name:objectType\", aborting!"); - System.exit(1); + throw new Exception("The parameter specification (" + + spec + ") must have the minimal form " + + "\"name:objectType\", aborting!"); } String objectType = st.nextToken(); if(objectType == null || objectType.length() == 0){ - System.err.println("The parameter specification (" + + throw new Exception("The parameter specification (" + spec + ") has a blank object type, aborting!"); - System.exit(1); } MobyPrimaryData dataTemplate = null; @@ -785,11 +1025,10 @@ MobyDataType type = MobyDataType.getDataType(objectType); if(type == null){ - System.err.println("The parameter specification (" + - spec + ") has a data type not found in the " + - "MOBY registry, aborting! (Either correct the type," + - " or register it as a new type in MOBY Central"); - System.exit(1); + throw new Exception("The parameter specification (" + + spec + ") has a data type not found in the " + + "MOBY registry, aborting! (Either correct the type," + + " or register it as a new type in MOBY Central"); } dataTemplate.setDataType(type); if(isCollection){ From mwilkinson at dev.open-bio.org Thu Dec 7 17:23:41 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 7 Dec 2006 12:23:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071723.kB7HNfTT030030@dev.open-bio.org> mwilkinson Thu Dec 7 12:23:41 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv29991/MOBY/Client Modified Files: Service.pm Log Message: untested. It should now handle POST services and create valid POST WSDL. not tested. moby-live/Perl/MOBY/Client Service.pm,1.25,1.26 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/07/07 22:25:12 1.25 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/07 17:23:41 1.26 @@ -67,7 +67,8 @@ uri => [ undef, 'read/write' ], serviceName => [ undef, 'read/write' ], _soapService => [ undef, 'read/write' ], - smessageVersion => ['0.87', 'read' ], + smessageVersion => ['0.88', 'read' ], + category => [undef, 'read/write'], ); #_____________________________________________________________ @@ -118,9 +119,11 @@ #print OUT $self->service; #close OUT; # ________________________________________ - my $wsdl = - URI::Escape::uri_escape( $self->service ); # this seems to fix the bug + my $wsdl = URI::Escape::uri_escape( $self->service ); # this seems to fix the bug return undef unless $wsdl; + if ($wsdl =~ //){ + $self->category('post'); + } my $soap = SOAP::Lite->service( "data:,$wsdl" ); if ( $self->uri ) { $soap->uri( $self->uri ) } $self->serviceName( &_getServiceName( $soap ) ); @@ -284,9 +287,17 @@ my $METHOD = $self->serviceName; &_LOG( %args, $METHOD ); my $response; - eval { ( $response ) = $self->_soapService->$METHOD( $data ) }; - if ($@) { die "Service execution failed: $@"} - else {return $response;} # the service execution failed then pass back "" + + if ($self->category eq 'post'){ + my $d = SOAP::Data->name('data' => $data); + eval { ( $response ) = $self->_soapService->$METHOD($d) }; + if ($@) { die "Service execution failed: $@"} + else {return $response;} # the service execution failed then pass back "" + } elsif ($self->category eq 'moby'){ + eval { ( $response ) = $self->_soapService->$METHOD( $data ) }; + if ($@) { die "Service execution failed: $@"} + else {return $response;} # the service execution failed then pass back "" + } } =head2 serviceName From mwilkinson at dev.open-bio.org Thu Dec 7 17:23:41 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 7 Dec 2006 12:23:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071723.kB7HNfNa030012@dev.open-bio.org> mwilkinson Thu Dec 7 12:23:41 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv29991/MOBY Modified Files: Central.pm Log Message: untested. It should now handle POST services and create valid POST WSDL. not tested. moby-live/Perl/MOBY Central.pm,1.263,1.264 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.263 retrieving revision 1.264 diff -u -r1.263 -r1.264 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/07 16:18:04 1.263 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/07 17:23:41 1.264 @@ -9,7 +9,7 @@ package MOBY::Central; use strict; use Carp; -use vars qw($AUTOLOAD $WSDL_TEMPLATE); +use vars qw($AUTOLOAD $WSDL_TEMPLATE $WSDL_POST_TEMPLATE); use XML::LibXML; use MOBY::OntologyServer; use MOBY::service_type; @@ -3201,11 +3201,52 @@ # the lines below causes no end of grief. It is now in a variable. #open (WSDL, "./MOBY/Central_WSDL_SandR.wsdl") || die "can't open WSDL file for search and replace\n"; #my $wsdl = join "", (); - my $wsdl = $WSDL_TEMPLATE; - $wsdl =~ s/^\n//gs; #close WSDL; # do substitutions + my $serviceType = $SI->category; + my $wsdl; + if ($serviceType eq "post"){ + $wsdl = &_doPostWSDLReplacement(@_) + } elsif ($serviceType eq "moby"){ + $wsdl = &_doMobyWSDLReplacement(@_) + } + return $wsdl; +} + +sub _doPostWSDLReplacement { + my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; + my $wsdl = $WSDL_POST_TEMPLATE; + $wsdl =~ s/^\n//gs; + my $serviceName = $SI->servicename; + my $AuthURI = $SI->authority_uri; + my $desc = $SI->description; + if ( $desc =~ /[^\]]+))\]\]>/ ) { + $desc = $1; + } + $desc =~ s"\<"<"g; # XMl encode now that it is not CDATAd + $desc =~ s"\>">"g; # XML encode now that it is not CDATAd + my $URL = $SI->url; + $URL =~ "http://(^/+)/(.*)"; + my $baseURL = $1; + my $relativeURL = $2; + my $IN = "NOT_YET_DEFINED_INPUTS"; + my $OUT = "NOT_YET_DEFINED_OUTPUTS"; + my $INxsd = &_getInputXSD( $InputXML, $SecondaryXML ); + my $OUTxsd = &_getOutputXSD($OutputXML); + $INxsd ||= ""; + $OUTxsd ||= ""; + $wsdl =~ s/MOBY__SERVICE__NAME__/$serviceName/g; # replace all of the goofy portbindingpottype crap + $wsdl =~s/\<\!\-\-\s*MOBY__SERVICE__DESCRIPTION\s*\-\-\>/Authority: $AuthURI - $desc/g; # add a sensible description + $wsdl =~ s/MOBY__SERVICE__URL/$baseURL/g; # the URL to the service + $wsdl =~ s/MOBY__SERVICE__POST/$relativeURL/g; # the URL to the service + $wsdl =~ s/MOBY__SERVICE__NAME/$serviceName/g; # finally replace the actual subroutine call +} + +sub _doMobyWSDLReplacement { + my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; + my $wsdl = $WSDL_TEMPLATE; + $wsdl =~ s/^\n//gs; my $serviceName = $SI->servicename; my $AuthURI = $SI->authority_uri; my $desc = $SI->description; @@ -3224,16 +3265,11 @@ $wsdl =~ s/MOBY__SERVICE__NAME__/$serviceName/g; # replace all of the goofy portbindingpottype crap $wsdl =~s/\<\!\-\-\s*MOBY__SERVICE__DESCRIPTION\s*\-\-\>/Authority: $AuthURI - $desc/g; # add a sensible description $wsdl =~ s/MOBY__SERVICE__URL/$URL/g; # the URL to the service - #if (scalar @in){my ($IN, $INxsd) = @{shift @in}}; - #if (scalar @out){my ($OUT, $OUTxsd) = @{shift @out}}; -# $wsdl =~ s/MOBY__INPUT__OBJECT__NAME/$IN/g; # SINGLE input object (for now) -# $wsdl =~ s/MOBY__OUTPUT__OBJECT__NAME/$OUT/g; # SINGLE output object (for now) -# $wsdl =~ s/\<\!\-\-\s*MOBY__INPUT__OBJECT__XSD\s*\-\-\>/$INxsd/g; # XSD stright from the database -# $wsdl =~ s/\<\!\-\-\s*MOBY__OUTPUT__OBJECT__XSD\s*\-\-\>/$OUTxsd/g; # XSD straight from the database - $wsdl =~ s/MOBY__SERVICE__NAME/$serviceName/g; # finally replace the actual subroutine call - return $wsdl; + $wsdl =~ s/MOBY__SERVICE__NAME/$serviceName/g; # finally replace the actual subroutine call + return $wsdl } + #sub _getCGIService { # my ( $dbh, $sth_hash, $id, $serviceName, $AuthURI, $URL, $desc, $category ) # = @_; @@ -3808,6 +3844,61 @@ END + + +$WSDL_POST_TEMPLATE = < + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +END + + =head2 _getInputXSD name : _getInputXSD($InputXML, $SecondaryXML) From gordonp at dev.open-bio.org Thu Dec 7 18:41:00 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 7 Dec 2006 13:41:00 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612071841.kB7If08J030510@dev.open-bio.org> gordonp Thu Dec 7 13:41:00 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Clients In directory dev.open-bio.org:/tmp/cvs-serv30475/src/Clients Modified Files: TestingCentral.java Log Message: Updates for secondary param data type checking moby-live/Java/src/Clients TestingCentral.java,1.9,1.10 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/Clients/TestingCentral.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/Clients/TestingCentral.java 2005/10/27 04:15:23 1.9 +++ /home/repository/moby/moby-live/Java/src/Clients/TestingCentral.java 2006/12/07 18:41:00 1.10 @@ -87,7 +87,11 @@ *************************************************************************/ protected MobySecondaryData createSecondaryData (String objectName, String type) { MobySecondaryData data = new MobySecondaryData (objectName); - data.setDataType (type); + try{ + data.setDataType (type); + } catch(Exception e){ + e.printStackTrace(); // will default to String if unrecognized + } if (type.equalsIgnoreCase ("Integer")) { data.setDefaultValue ("123"); data.setMaximumValue (234); From mwilkinson at dev.open-bio.org Fri Dec 8 14:29:55 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 8 Dec 2006 09:29:55 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612081429.kB8ETt5q000878@dev.open-bio.org> mwilkinson Fri Dec 8 09:29:55 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv841/MOBY/Client Modified Files: Service.pm Log Message: this code is ALMOST CERTAINLY BROKEN so please don't check out the registry right now. I just need to get it on to Heiko's machine so we can test it further moby-live/Perl/MOBY/Client Service.pm,1.26,1.27 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/07 17:23:41 1.26 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 14:29:55 1.27 @@ -120,6 +120,8 @@ #close OUT; # ________________________________________ my $wsdl = URI::Escape::uri_escape( $self->service ); # this seems to fix the bug +# my $wsdl = $self->service; + return undef unless $wsdl; if ($wsdl =~ //){ $self->category('post'); From mwilkinson at dev.open-bio.org Fri Dec 8 15:15:05 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 8 Dec 2006 10:15:05 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612081515.kB8FF5hS001027@dev.open-bio.org> mwilkinson Fri Dec 8 10:15:05 EST 2006 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API In directory dev.open-bio.org:/tmp/cvs-serv1008/MOBY-S_API Modified Files: MobyCentralObjects.html Log Message: documentation error Protocol should be Category moby-live/Docs/MOBY-S_API MobyCentralObjects.html,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2006/11/21 23:04:27 1.7 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/MobyCentralObjects.html 2006/12/08 15:15:05 1.8 @@ -167,7 +167,7 @@ </Output> </outputObjects> <serviceType>ServiceTypeTerm</serviceType> - <Protocol>moby</Protocol> + <Category>moby</Category> <authURI>desired.service.provider</authURI> <signatureURL>http://location.to/service/description</signatureURL> <serviceName>MyServiceName</serviceName>; From mwilkinson at dev.open-bio.org Fri Dec 8 15:46:44 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 8 Dec 2006 10:46:44 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612081546.kB8FkiIa001306@dev.open-bio.org> mwilkinson Fri Dec 8 10:46:44 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv1287/MOBY/Client Modified Files: Service.pm Log Message: okay, fixed now. It should work moby-live/Perl/MOBY/Client Service.pm,1.27,1.28 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 14:29:55 1.27 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 15:46:44 1.28 @@ -68,7 +68,7 @@ serviceName => [ undef, 'read/write' ], _soapService => [ undef, 'read/write' ], smessageVersion => ['0.88', 'read' ], - category => [undef, 'read/write'], + category => ['moby', 'read/write'], ); #_____________________________________________________________ From mwilkinson at dev.open-bio.org Fri Dec 8 16:16:41 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Fri, 8 Dec 2006 11:16:41 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612081616.kB8GGfs7001561@dev.open-bio.org> mwilkinson Fri Dec 8 11:16:41 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv1542/MOBY/Client Modified Files: Service.pm Log Message: MOBY can now execute HTTP POST services. register as category 'post'. prepare your service to accept a single named POST parameter called 'data'. the content of 'data' is a full block of MOBY XML, including the xml header and moby:MOBY etc elements moby-live/Perl/MOBY/Client Service.pm,1.28,1.29 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 15:46:44 1.28 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Service.pm 2006/12/08 16:16:41 1.29 @@ -110,6 +110,10 @@ $self->{$attrname} = $self->_default_for( $attrname ); } } + my $wsdl = $self->service; + if ($wsdl =~ //){ + $self->category('post'); + } #my $dir = cwd; # seems to be a bug in SOAP::Lite that the WSDL document @@ -119,13 +123,9 @@ #print OUT $self->service; #close OUT; # ________________________________________ - my $wsdl = URI::Escape::uri_escape( $self->service ); # this seems to fix the bug -# my $wsdl = $self->service; + $wsdl = URI::Escape::uri_escape( $self->service ); # this seems to fix the bug return undef unless $wsdl; - if ($wsdl =~ //){ - $self->category('post'); - } my $soap = SOAP::Lite->service( "data:,$wsdl" ); if ( $self->uri ) { $soap->uri( $self->uri ) } $self->serviceName( &_getServiceName( $soap ) ); @@ -290,18 +290,52 @@ &_LOG( %args, $METHOD ); my $response; - if ($self->category eq 'post'){ - my $d = SOAP::Data->name('data' => $data); - eval { ( $response ) = $self->_soapService->$METHOD($d) }; - if ($@) { die "Service execution failed: $@"} - else {return $response;} # the service execution failed then pass back "" - } elsif ($self->category eq 'moby'){ + if ($self->category eq 'moby'){ eval { ( $response ) = $self->_soapService->$METHOD( $data ) }; if ($@) { die "Service execution failed: $@"} else {return $response;} # the service execution failed then pass back "" + } elsif ($self->category eq 'post'){ + my $response = $self->_executePOSTService(data => $data, method => $METHOD); + # currently SOAP::Lite does not execute POST WSDL, so we need to + # use LWP or something like that in the executePOSTService method + #eval { ( $response ) = $self->_soapService->$METHOD( $data ) }; + unless ($response){ die "Service execution failed: $@"} + else {return $response;} # the service execution failed then pass back "" } } +sub _executePOSTService { + my ($self, %args) = @_; + my $serviceName = $args{method}; + my $data = $args{data}; + my $wsdl = $self->service; + $wsdl =~ /address\slocation=['"]([^'"]+)/s; + my $location = $1; + $wsdl =~/operation\slocation=['"]([^'"]+)/s; + my $path = $1; + use LWP::UserAgent; + my $ua = LWP::UserAgent->new; + + # Create a request + my $req = HTTP::Request->new(POST => "$location/$path"); + $req->content_type('application/x-www-form-urlencoded'); + $req->content('data=$data'); + + # Pass request to the user agent and get a response back + my $res = $ua->request($req); + my $result; + # Check the outcome of the response + if ($res->is_success) { + $result = $res->content; + } + else { + $result = ""; + } + return $result; +} + + + =head2 serviceName Usage : $name = $Service->serviceName() From gordonp at dev.open-bio.org Fri Dec 8 21:10:52 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Fri, 8 Dec 2006 16:10:52 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612082110.kB8LAqtf002012@dev.open-bio.org> gordonp Fri Dec 8 16:10:52 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv1971 Modified Files: deployingServices.html index.html Added Files: servletSecondaries.html Log Message: Updated secondary article docs moby-live/Java/docs servletSecondaries.html,NONE,1.1 deployingServices.html,1.11,1.12 index.html,1.29,1.30 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/deployingServices.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/12/06 16:07:10 1.11 +++ /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/12/08 21:10:52 1.12 @@ -3,11 +3,11 @@ - Ridiculously Easy MOBY Service Creation + Super-Easy MOBY Service Creation -

        Ridiculously Easy MOBY Service Creation

        +

        Super-Easy MOBY Service Creation

        What is this?

        @@ -151,7 +151,8 @@ the base MobyServlet to do all the input type checking for you. If you've specified the annotation correctly, you are guaranteed that processRequest will only receive syntactically and semantically valid data. The same annotation is eventually used to publish your service's meta-data to - MOBY Central.

        + MOBY Central. If want to specify secondary parameters for a service, + look here for the syntax

        That's it for the coding. Really! Now compile it (Ant will automatically fetch the MobyServlet.war you are extending), running the following command in the same @@ -224,7 +225,7 @@ If the service fails, a useful error message should be printed to help you diagnose the problem. This would usually be because the data type you return isn't what you declared (this is the first occasion your output is thoroughly checked). - If you get a java.lang.NoClassDefFoundError, please see the notes below. If that doesn't help, + If you get a java.lang.NoClassDefFoundError, please let me know (gordonp @ ucalgary.ca) and I'll try to help you: @@ -323,7 +324,7 @@

        Paul Gordon
        -Last modified: Wed Dec 6 08:39:50 MST 2006 +Last modified: Fri Dec 8 12:49:28 MST 2006 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/index.html,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- /home/repository/moby/moby-live/Java/docs/index.html 2006/12/06 16:25:51 1.29 +++ /home/repository/moby/moby-live/Java/docs/index.html 2006/12/08 21:10:52 1.30 @@ -140,7 +140,9 @@
      • How to develop a BioMoby service, an alternate mechanism for the Extremely Lazy, Complete -Idiots, Dummies, etc. +Idiots, Dummies, etc. (a.k.a. "MobyServlet") +
      • A note on using secondary articles with MobyServlet
      • The org.biomoby.shared.data package "In Anger": creating data instances
      • @@ -190,7 +192,7 @@
        Martin Senger
        -Last modified: Wed Dec 6 09:24:31 MST 2006 +Last modified: Fri Dec 8 14:09:26 MST 2006
        From gordonp at dev.open-bio.org Mon Dec 11 15:59:26 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 10:59:26 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111559.kBBFxQhh032280@dev.open-bio.org> gordonp Mon Dec 11 10:59:25 EST 2006 Update of /home/repository/moby/jars-archive/current In directory dev.open-bio.org:/tmp/cvs-serv32245 Modified Files: MobyServlet.war Log Message: Better secondary article support, fixed obscure Collection instance naming bug jars-archive/current MobyServlet.war,1.8,1.9 =================================================================== RCS file: /home/repository/moby/jars-archive/current/MobyServlet.war,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 Binary files /home/repository/moby/jars-archive/current/MobyServlet.war 2006/12/06 15:09:02 1.8 and /home/repository/moby/jars-archive/current/MobyServlet.war 2006/12/11 15:59:25 1.9 differ rcsdiff: /home/repository/moby/jars-archive/current/MobyServlet.war: diff failed From gordonp at dev.open-bio.org Mon Dec 11 18:36:07 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 13:36:07 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111836.kBBIa7vu032726@dev.open-bio.org> gordonp Mon Dec 11 13:36:07 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls/servlet In directory dev.open-bio.org:/tmp/cvs-serv32687 Modified Files: build.xml mobyService.properties Log Message: Simplified Ant spec. even further moby-live/Java/xmls/servlet build.xml,1.2,1.3 mobyService.properties,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/servlet/build.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/xmls/servlet/build.xml 2006/12/06 17:55:29 1.2 +++ /home/repository/moby/moby-live/Java/xmls/servlet/build.xml 2006/12/11 18:36:07 1.3 @@ -1,6 +1,7 @@ + This is an Ant build file for creating and registering a Moby Service. @@ -17,13 +18,60 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + @@ -33,10 +81,10 @@ - + - + @@ -49,7 +97,7 @@ - + @@ -58,41 +106,42 @@ - + - - - - + + + + - - - - + + + + - - + + + - - + + - - - - + + + + @@ -102,16 +151,16 @@ - + - + - + @@ -132,85 +181,87 @@ - + - + - + - + - + - + - + - + - - + - + - - + - + - - + - + - - + - + - - + + - - + + - - + + @@ -226,11 +277,12 @@ - + + + - =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/06 18:37:51 1.3 +++ /home/repository/moby/moby-live/Java/xmls/servlet/mobyService.properties 2006/12/11 18:36:07 1.4 @@ -1,24 +1,18 @@ -# Where the project directory is located. -project.dir=/export/home/gordonp/development/service - -# Where the Java source directory is located. -src.dir=${project.dir}/src +# Where the project directory is located, by default it's the same as the Ant working directory: uncomment to change +# project.dir=/export/home/gordonp/development/service +# Where the Java source directory is located (relative to project.dir). +src.dir=src +# Where any and all 3rd party libraries for your code are stored (relative to project.dir). +lib.dir=lib # The package-qualified location of your main class's source code (the one extending MobyServlet). main.class.file=org/biomoby/service/test/ConvertAAtoFASTA_AA.java -# Where all 3rd party libraries for your code are stored. -lib.dir=${project.dir}/lib - # Name of the output WAR archive to be generated (will also be the servlet name). my.servlet.war.file=ConvertAAtoFASTA_AA.war # The location of a test MOBY XML input data file (used as input to test your service). input.data.file=${project.dir}/mobyAASeq.xml -# Java Servlet host URL -servlet.host.url=http://moby.ucalgary.ca - -# Java Servlet port -servlet.port=8089 - +# Your Java Servlet host URL (with port) +servlet.host.url=http://moby.ucalgary.ca:8089 From gordonp at dev.open-bio.org Mon Dec 11 18:36:42 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 13:36:42 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111836.kBBIagV8000301@dev.open-bio.org> gordonp Mon Dec 11 13:36:42 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv32734 Modified Files: deployingServices.html Log Message: Simplified Ant spec. even further moby-live/Java/docs deployingServices.html,1.12,1.13 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/deployingServices.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/12/08 21:10:52 1.12 +++ /home/repository/moby/moby-live/Java/docs/deployingServices.html 2006/12/11 18:36:42 1.13 @@ -58,32 +58,24 @@

        Step 1: Configure your build enviroment

        You need to tell Ant where your code and servlet container are located. This is done by modifying the - mobyService.properties file you just downloaded: + mobyService.properties file you just downloaded, customizing it for your site:
        -# Where the project directory is located.
        -project.dir=/home/gordonp/development/fastaConverter
        +# Where the Java source directory is located (relative to project.dir).
        +src.dir=src
        +# Where any and all 3rd party libraries for your code are stored (relative to project.dir).
        +lib.dir=lib
         
        -# Where the Java source directory is located.
        -src.dir=${project.dir}/src
        -
        -# The package-qualified location of your main class (the one extending MobyServlet).
        -# You could have no package, or org/bar/foo, etc. in a real service
        +# The package-qualified location of your main class's source code (the one extending MobyServlet).
         main.class.file=org/biomoby/service/test/ConvertAAtoFASTA_AA.java
         
        -# Where all 3rd party libraries for your code are stored.
        -lib.dir=${project.dir}/lib
        -
         # Name of the output WAR archive to be generated (will also be the servlet name).
         my.servlet.war.file=ConvertAAtoFASTA_AA.war
         
        -# The location of a test MOBY XML input data file (use as input to test your service).
        +# The location of a test MOBY XML input data file (used as input to test your service).
         input.data.file=${project.dir}/mobyAASeq.xml
         
        -# Your Java Servlet host URL
        -servlet.host.url=http://moby.ucalgary.ca
        -
        -# Your Java Servlet port
        -servlet.port=8089
        +# Your Java Servlet host URL (with port)
        +servlet.host.url=http://moby.ucalgary.ca:8089
         

        @@ -324,7 +316,7 @@
        Paul Gordon
        -Last modified: Fri Dec 8 12:49:28 MST 2006 +Last modified: Mon Dec 11 11:28:17 MST 2006 From gordonp at dev.open-bio.org Mon Dec 11 18:37:21 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 13:37:21 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111837.kBBIbLPA000345@dev.open-bio.org> gordonp Mon Dec 11 13:37:21 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv310 Modified Files: Seahawk.html Log Message: Mention possibility to build the servlet war from a jMOBY CVS Ant target moby-live/Java/docs Seahawk.html,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/Seahawk.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/docs/Seahawk.html 2006/11/23 03:34:49 1.4 +++ /home/repository/moby/moby-live/Java/docs/Seahawk.html 2006/12/11 18:37:21 1.5 @@ -69,9 +69,10 @@

        The jar (Java archive) file containing all of the required classes (including those from Axis, Jena, Xalan, Xerces, etc.) is available - here. Note that this JAR - is signed by the University of Calgary Bioinformatics Lab. This jar file - can be used as an application with the command: + here, and is + signed by the University of Calgary Bioinformatics Lab. You can also + build your own version of the jar with the jMOBY cvs Ant target "servlet-war". + Either jar file can be used as an application with the command:

        java -jar seahawk.jar
        If there is sufficient demand, I'll make a nice graphical installer for it.

        @@ -121,7 +122,7 @@
        Paul Gordon
        -Last modified: Wed Nov 22 20:32:48 MST 2006 +Last modified: Mon Dec 11 08:49:26 MST 2006 From gordonp at dev.open-bio.org Mon Dec 11 18:58:58 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 13:58:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111858.kBBIww6I000682@dev.open-bio.org> gordonp Mon Dec 11 13:58:58 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv643/src/main/org/biomoby/shared/data Modified Files: MobyDataObjectSetSAI.java MobyContentInstance.java Log Message: Fixed collection instance naming bug moby-live/Java/src/main/org/biomoby/shared/data MobyDataObjectSetSAI.java,1.1,1.2 MobyContentInstance.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSetSAI.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSetSAI.java 2006/07/07 04:12:40 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSetSAI.java 2006/12/11 18:58:58 1.2 @@ -116,7 +116,7 @@ } public int hashCode(){ - return dataInstance.hashCode(); + return dataInstance == null ? super.hashCode() : dataInstance.hashCode(); } public void clear(){ @@ -164,6 +164,13 @@ } public String toXML(){ - return dataInstance.toXML(); + // We have to temporarily rename the data instance, because it's XML + // representation in service mode should include the article name set + // for this object instance, not the data instance + String oldName = dataInstance.getName(); + dataInstance.setName(getName()); + String result = dataInstance.toXML(); + dataInstance.setName(oldName); + return result; } } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/12/06 16:07:10 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/12/11 18:58:58 1.8 @@ -443,7 +443,13 @@ dataObject.toXML()+ ""); } - // Either a collection or a secondary input parameter + else if(dataObject instanceof MobyDataObjectSet){ + String oldName = dataObject.getName(); + dataObject.setName(paramName); + xml.append(dataObject.toXML()); + dataObject.setName(oldName); + } + // a secondary input parameter else{ xml.append(dataObject.toXML()); } From gordonp at dev.open-bio.org Mon Dec 11 18:59:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 13:59:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111859.kBBIxapV000725@dev.open-bio.org> gordonp Mon Dec 11 13:59:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv690/src/main/org/biomoby/shared/data Modified Files: MobyDataObjectSet.java Log Message: Set default mode to match other instance objects (central, not service) moby-live/Java/src/main/org/biomoby/shared/data MobyDataObjectSet.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java 2006/07/07 04:12:40 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSet.java 2006/12/11 18:59:36 1.6 @@ -30,7 +30,7 @@ public class MobyDataObjectSet extends MobyPrimaryDataSet implements MobyDataInstance, Collection{ Vector bag; - private int xmlMode = MobyDataInstance.SERVICE_XML_MODE; + private int xmlMode = MobyDataInstance.CENTRAL_XML_MODE; public MobyDataObjectSet(org.w3c.dom.Element e) throws MobyException{ this(MobyDataObject.getName(e), getChildren(e)); @@ -396,7 +396,7 @@ * Implemented solely because of the general contract that c1.equals(c2) implies that c1.hashCode()==c2.hashCode() */ public int hashCode(){ - return bag.hashCode(); + return bag == null ? super.hashCode() : bag.hashCode(); } /** @@ -504,7 +504,7 @@ public int getXmlMode(){ return xmlMode; } - + /** * Wraps the simple instances' XML in a MOBY Collection tag */ From gordonp at dev.open-bio.org Mon Dec 11 19:00:07 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 14:00:07 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111900.kBBJ07Hr000768@dev.open-bio.org> gordonp Mon Dec 11 14:00:07 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv733/src/main/org/biomoby/shared/data Modified Files: MobyDataJob.java Log Message: Fixed comment typo moby-live/Java/src/main/org/biomoby/shared/data MobyDataJob.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataJob.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataJob.java 2006/07/07 04:12:40 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataJob.java 2006/12/11 19:00:07 1.2 @@ -1,6 +1,6 @@ /** * Groups together the primary and secondary data corresponding to a MOBY XML "mobyData" block, i.e. - * a request for, or response from, a service. Onme or more MobyDataJobs can be put in one MobyContentInstance + * a request for, or response from, a service. One or more MobyDataJobs can be put in one MobyContentInstance * to form a service invocation request/response (they are symmetric in MOBY). It is essentially just a Java Map, * but with some convenience methods for grabbing different types of data. Put data into this object as you * would with any Map. From gordonp at dev.open-bio.org Mon Dec 11 19:02:01 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Mon, 11 Dec 2006 14:02:01 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612111902.kBBJ21Sp000953@dev.open-bio.org> gordonp Mon Dec 11 14:02:01 EST 2006 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv922/docs Added Files: deployingServicesBasic.html Log Message: Non-ant way to use MobyServlet moby-live/Java/docs deployingServicesBasic.html,NONE,1.1 From gordonp at dev.open-bio.org Wed Dec 13 17:53:58 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 13 Dec 2006 12:53:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612131753.kBDHrwGT010372@dev.open-bio.org> gordonp Wed Dec 13 12:53:57 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv10329/src/main/org/biomoby/shared/data Modified Files: MobyDataComposite.java MobyDataObject.java MobyDataXref.java Log Message: Added support for cross-reference deserialization from XML moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.8,1.9 MobyDataObject.java,1.11,1.12 MobyDataXref.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2006/10/26 00:30:27 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2006/12/13 17:53:57 1.9 @@ -40,16 +40,26 @@ int numSubstructures = substructures.getLength(); for(int i = 0; i < numSubstructures; i++){ org.w3c.dom.Element child = (org.w3c.dom.Element) substructures.item(i); - // If the child element doesn't have a name, this - // will be a problem for member association (i.e. it's an anonymous variable) - String fieldName = getName(child); - if(fieldName == null){ - throw new IllegalArgumentException("The subelement with index " + i + - " does not have an article " + - "name, which is required"); + if(child.getLocalName().equals("CrossReference")){ + addCrossReferences(child); + } + // Not yet implemented +// else if(child.getLocalName().equals("ProvisionInformation")){ +// addProvisionInfo(child); +// } + else{ + // If the child element doesn't have a name, this + // will be a problem for member association (i.e. it's an anonymous variable) + String fieldName = getName(child); + if(fieldName == null || fieldName.length() == 0){ + throw new IllegalArgumentException("The subelement with index " + i + + " does not have an article " + + "name, which is required"); + } + + // TODO, must deal with 1-to-many HAS relationship + children.put(fieldName, (MobyDataObject) createInstanceFromDOM(child)); } - // TODO, must deal with 1-to-many HAS relationship - children.put(fieldName, (MobyDataObject) createInstanceFromDOM(child)); } putAll(children); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2006/10/30 15:54:39 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2006/12/13 17:53:57 1.12 @@ -381,9 +381,39 @@ return "[Object]"; } + public void addCrossReferences(Element e) throws MobyException{ + if(e == null){ + throw new NullPointerException("Cannot add a null cross-reference element to an object"); + } + if(e.getLocalName() == null){ + throw new NullPointerException("Element name is null when trying to add cross-reference element"); + } + if(!e.getLocalName().equals("CrossReference")){ + throw new NullPointerException("Cannot add an element named '"+e.getLocalName()+ + "' as a CrossReference element"); + } + + NodeList substructures = MobyPrefixResolver.getChildElements(e, "*"); //wildcard + int numSubstructures = substructures.getLength(); + for(int i = 0; i < numSubstructures; i++){ + Element child = (Element) substructures.item(i); + String objectClass = child.getLocalName(); + if("Object".equals(objectClass)){ + new MobyDataObject(child); + } + else if("Xref".equals(objectClass)){ + new MobyDataXref(child); + } + else{ + throw new MobyException("Cross-reference block contained an illegal child element ("+objectClass+ + "), only 'Object' and 'Xref' are allowed"); + } + } + } + public void addCrossReference(MobyDataObject mdsi) throws NullPointerException{ if(mdsi == null){ - throw new NullPointerException("Cannot add a null crossreference to an object"); + throw new NullPointerException("Cannot add a null cross-reference to an object"); } // Hasn't been initialized yet? =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java 2006/07/07 04:12:40 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java 2006/12/13 17:53:57 1.6 @@ -65,6 +65,21 @@ getService().setAuthority(authURI); } + public MobyDataXref(Element e) throws MobyException{ + this(getNamespace(e).getName(), + getId(e), + MobyPrefixResolver.getAttr(e, "serviceName"), + MobyPrefixResolver.getAttr(e, "authURI")); + + setEvidenceCode(MobyPrefixResolver.getAttr(e, "evidenceCode")); + setXrefType(MobyPrefixResolver.getAttr(e, "xrefType")); + + String d = e.getTextContent(); + if(d != null && d.length() > 0){ + setDescription(d); + } + } + /** * Build an Xref based on an existing object. * The namespace and id will be kept, everything else ignored as they don't From gordonp at dev.open-bio.org Wed Dec 13 23:15:58 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 13 Dec 2006 18:15:58 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612132315.kBDNFwir011474@dev.open-bio.org> gordonp Wed Dec 13 18:15:58 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv11431/src/main/org/biomoby/shared/data Modified Files: MobyDataComposite.java MobyDataObject.java MobyProvisionInfo.java Log Message: Use more MobyTags values instead of hardcoding, added ProvisionInformation deserialization support moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.9,1.10 MobyDataObject.java,1.12,1.13 MobyProvisionInfo.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2006/12/13 17:53:57 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java 2006/12/13 23:15:58 1.10 @@ -15,6 +15,7 @@ import org.biomoby.shared.MobyNamespace; import org.biomoby.shared.MobyPrefixResolver; import org.biomoby.shared.MobyRelationship; +import org.biomoby.shared.parser.MobyTags; /** * This class implements the ConcurrentMap interface to allow for the easy @@ -40,13 +41,12 @@ int numSubstructures = substructures.getLength(); for(int i = 0; i < numSubstructures; i++){ org.w3c.dom.Element child = (org.w3c.dom.Element) substructures.item(i); - if(child.getLocalName().equals("CrossReference")){ + if(child.getLocalName().equals(MobyTags.CROSSREFERENCE)){ addCrossReferences(child); } - // Not yet implemented -// else if(child.getLocalName().equals("ProvisionInformation")){ -// addProvisionInfo(child); -// } + else if(child.getLocalName().equals(MobyTags.PROVISIONINFORMATION)){ + addProvisionInfo(child); + } else{ // If the child element doesn't have a name, this // will be a problem for member association (i.e. it's an anonymous variable) =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2006/12/13 17:53:57 1.12 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java 2006/12/13 23:15:58 1.13 @@ -17,6 +17,7 @@ import org.w3c.dom.NodeList; import org.biomoby.shared.*; +import org.biomoby.shared.parser.MobyTags; /** * A class representing a MOBY object that has been instantiated. @@ -53,7 +54,7 @@ */ public MobyDataObject(String name){ super(name); - setDataType(MobyDataType.getDataType("Object")); + setDataType(MobyDataType.getDataType(MobyTags.MOBYOBJECT)); } /** @@ -61,7 +62,7 @@ */ public MobyDataObject(String namespace, String id){ super(""); - setDataType(MobyDataType.getDataType("Object")); + setDataType(MobyDataType.getDataType(MobyTags.MOBYOBJECT)); setId(id); MobyNamespace nsObj = MobyNamespace.getNamespace(namespace); @@ -94,22 +95,22 @@ return null; } - if("Object".equals(typeName)){ + if(MobyTags.MOBYOBJECT.equals(typeName)){ return new MobyDataObject("", value); } - else if("Integer".equals(typeName)){ + else if(MobyTags.MOBYINTEGER.equals(typeName)){ return new MobyDataInt("", value); } - else if("Float".equals(typeName)){ + else if(MobyTags.MOBYFLOAT.equals(typeName)){ return new MobyDataFloat("", value); } - else if("String".equals(typeName)){ + else if(MobyTags.MOBYSTRING.equals(typeName)){ return new MobyDataString("", value); } - else if("Boolean".equals(typeName)){ + else if(MobyTags.MOBYBOOLEAN.equals(typeName)){ return new MobyDataBoolean("", value); } - else if("DateTime".equals(typeName)){ + else if(MobyTags.MOBYDATETIME.equals(typeName)){ return new MobyDataDateTime("", value); } else if("text-base64".equals(typeName)){ @@ -139,7 +140,7 @@ } String objectClass = objectTag.getLocalName(); - if("Simple".equals(objectClass)){ + if(MobyTags.SIMPLE.equals(objectClass)){ Element elementChild = MobyPrefixResolver.getChildElement(objectTag, "*"); // A Simple tag is allowed to have exactly one child element if(elementChild == null){ @@ -153,28 +154,28 @@ // There are six types of objects we can populate with data directly // plus Collections and Secondary Parameters. Otherwise it is a composite. - else if("Object".equals(objectClass)){ + else if(MobyTags.MOBYOBJECT.equals(objectClass)){ return new MobyDataObject(objectTag); } - else if("Integer".equals(objectClass)){ + else if(MobyTags.MOBYINTEGER.equals(objectClass)){ return new MobyDataInt(objectTag); } - else if("Float".equals(objectClass)){ + else if(MobyTags.MOBYFLOAT.equals(objectClass)){ return new MobyDataFloat(objectTag); } - else if("String".equals(objectClass)){ + else if(MobyTags.MOBYSTRING.equals(objectClass)){ return new MobyDataString(objectTag); } - else if("Boolean".equals(objectClass)){ + else if(MobyTags.MOBYBOOLEAN.equals(objectClass)){ return new MobyDataBoolean(objectTag); } - else if("DateTime".equals(objectClass)){ + else if(MobyTags.MOBYDATETIME.equals(objectClass)){ return new MobyDataDateTime(objectTag); } else if("text-base64".equals(objectClass)){ return new MobyDataBytes(objectTag); } - else if("Collection".equals(objectClass)){ + else if(MobyTags.COLLECTION.equals(objectClass)){ return new MobyDataObjectSet(objectTag); } else if(MobyDataSecondaryInstance.ELEMENT_NAME.equals(objectClass)){ @@ -223,13 +224,13 @@ Node p = e.getParentNode(); String name = null; // A top level object whose name is in the enclosing simple tag - if(p != null && (p instanceof Element) && ((Element) p).getTagName().equals("Simple")){ - name = MobyPrefixResolver.getAttr((Element) p, "articleName"); + if(p != null && (p instanceof Element) && ((Element) p).getTagName().equals(MobyTags.SIMPLE)){ + name = MobyPrefixResolver.getAttr((Element) p, MobyTags.ARTICLENAME); return name == null ? "" : name; } // Part of a composite, subobject's name is in its own tag else{ - name = MobyPrefixResolver.getAttr(e, "articleName"); + name = MobyPrefixResolver.getAttr(e, MobyTags.ARTICLENAME); return name == null ? "" : name; } } @@ -388,25 +389,24 @@ if(e.getLocalName() == null){ throw new NullPointerException("Element name is null when trying to add cross-reference element"); } - if(!e.getLocalName().equals("CrossReference")){ + if(!e.getLocalName().equals(MobyTags.CROSSREFERENCE)){ throw new NullPointerException("Cannot add an element named '"+e.getLocalName()+ "' as a CrossReference element"); } - NodeList substructures = MobyPrefixResolver.getChildElements(e, "*"); //wildcard int numSubstructures = substructures.getLength(); for(int i = 0; i < numSubstructures; i++){ Element child = (Element) substructures.item(i); String objectClass = child.getLocalName(); - if("Object".equals(objectClass)){ - new MobyDataObject(child); + if(MobyTags.MOBYOBJECT.equals(objectClass)){ + addCrossReference(new MobyDataObject(child)); } - else if("Xref".equals(objectClass)){ - new MobyDataXref(child); + else if(MobyTags.XREF.equals(objectClass)){ + addCrossReference(new MobyDataXref(child)); } else{ throw new MobyException("Cross-reference block contained an illegal child element ("+objectClass+ - "), only 'Object' and 'Xref' are allowed"); + "), only '"+MobyTags.MOBYOBJECT+"' and '"+MobyTags.XREF+"' are allowed"); } } } @@ -451,6 +451,20 @@ return CRIBVector != null && !CRIBVector.isEmpty(); } + public void addProvisionInfo(Element e) throws MobyException{ + if(e == null){ + throw new NullPointerException("Cannot add a null provision information element to an object"); + } + if(e.getLocalName() == null){ + throw new NullPointerException("Element name is null when trying to add provision information element"); + } + if(!e.getLocalName().equals(MobyTags.PROVISIONINFORMATION)){ + throw new NullPointerException("Cannot add an element named '"+e.getLocalName()+ + "' as a ProvisionInformation element"); + } + setProvisionInfo(new MobyProvisionInfo(e)); + } + public void setProvisionInfo(MobyProvisionInfo info){ provisionInfo = info; } @@ -547,7 +561,7 @@ } StringBuffer crib = new StringBuffer(); - crib.append("\n"); + crib.append("<"+MobyTags.CROSSREFERENCE+">\n"); java.util.Iterator iter = CRIBVector.iterator(); while(iter != null && iter.hasNext()){ @@ -564,7 +578,7 @@ crib.append(obj.toXML()+"\n"); } } - crib.append("\n"); + crib.append("\n"); return crib.toString(); } @@ -593,7 +607,7 @@ // If the data type is null, there must be something wrong // with fetching the ontology RDF from MOBY Central. At the very // least, we know the thing must be an Object. - return ""; + return "<"+MobyTags.MOBYOBJECT+" " + getAttrXML() + "/>"; } else{ return "<" + getDataType().getName() +" " + getAttrXML() + "/>"; @@ -604,7 +618,7 @@ // but will cause cache misses for MOBY Central calls since the xml // is used as a key in the call cache. StringBuffer buf = new StringBuffer(); - buf.append ("\n"); + buf.append ("<"+MobyTags.SIMPLE+" articleName=\"not_important\">\n"); buf.append (""); if (getDataType() != null) buf.append (getDataType().getName()); buf.append ("\n"); @@ -618,7 +632,7 @@ } } } - buf.append (""); + buf.append (""); buf.append ("\n"); return buf.toString(); //return super.toXML(); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyProvisionInfo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyProvisionInfo.java 2006/07/07 04:12:40 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyProvisionInfo.java 2006/12/13 23:15:58 1.4 @@ -1,7 +1,9 @@ package org.biomoby.shared.data; +import org.biomoby.shared.MobyPrefixResolver; import org.biomoby.shared.parser.MobyTags; +import org.w3c.dom.Element; /** * Class to hold data corresponginf to the MOBY PIB. @@ -15,7 +17,39 @@ private String dbVersion; private String dbComment; private String serviceComment; + + /** + * Creates a blank provision information object. + */ + public MobyProvisionInfo(){ + } + /** + * Builds a provision information block from an XML fragment + * ("ProvisionInformation", as represented by a DOM node). + */ + public MobyProvisionInfo(Element e){ + Element child = MobyPrefixResolver.getChildElement(e, MobyTags.SERVICESOFTWARE); + // all three child elements are optional. + if(child != null){ + setSoftwareName(MobyPrefixResolver.getAttr(child, MobyTags.SOFTWARENAME)); + setSoftwareVersion(MobyPrefixResolver.getAttr(child, MobyTags.SOFTWAREVERSION)); + setSoftwareComment(MobyPrefixResolver.getAttr(child, MobyTags.SOFTWARECOMMENT)); + } + + child = MobyPrefixResolver.getChildElement(e, MobyTags.SERVICEDATABASE); + // all three child elements are optional. + if(child != null){ + setSoftwareName(MobyPrefixResolver.getAttr(child, MobyTags.DATABASENAME)); + setSoftwareVersion(MobyPrefixResolver.getAttr(child, MobyTags.DATABASEVERSION)); + setSoftwareComment(MobyPrefixResolver.getAttr(child, MobyTags.DATABASECOMMENT)); + } + child = MobyPrefixResolver.getChildElement(e, MobyTags.SERVICECOMMENT); + if(child != null){ + setComment(child.getTextContent()); + } + } + public void setSoftwareName(String name){ softwareName = name; } From mwilkinson at dev.open-bio.org Thu Dec 14 17:57:06 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 14 Dec 2006 12:57:06 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612141757.kBEHv6fl014990@dev.open-bio.org> mwilkinson Thu Dec 14 12:57:05 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv14971/MOBY Modified Files: Central.pm Log Message: making initial code changes to support async potocol moby-live/Perl/MOBY Central.pm,1.265,1.266 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.265 retrieving revision 1.266 diff -u -r1.265 -r1.266 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/08 14:29:55 1.265 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/14 17:57:05 1.266 @@ -1302,7 +1302,7 @@ $error .= "missing Category \n" unless defined $Category; return &_error( "malformed payload $error\n\n", "" ) if ($error); return &_error( - "Category may take the (case sensitive) values 'moby', 'cgi', 'post', 'wsdl'\n", + "Category may take the (case sensitive) values 'moby', 'cgi', 'post', 'wsdl', 'moby-async'\n", "" ) unless ( @@ -1310,10 +1310,11 @@ || ($Category eq "cgi") || ( $Category eq "moby" ) + || ( $Category eq "moby-async" ) || ( $Category eq "post" ) ); - return &_error("Service categories other than 'moby', 'post' are not yet implemented","") - unless ( ( $Category eq "moby" ) || ( $Category eq "post" ) ); + return &_error("Service categories other than 'moby', 'post', 'moby-async' are not yet implemented","") + unless ( ( $Category eq "moby" ) || ( $Category eq "post" )|| ( $Category eq "moby-async" ) ); #test the existence of the service return &_error( "This service already exists", "" ) if (MOBY::service_instance->new( @@ -1411,16 +1412,7 @@ $SVC->DELETE_THYSELF; return &_error("Registration Failed - newly registered service could not be discovered",""); } - #my $services = MOBY::Client::Central::_parseServices( '', '', $si ); - #my $service_instance = shift @{$services}; - # my $storage = new RDF::Core::Storage::Memory; - # my $model = new RDF::Core::Model( Storage => $storage ); - # my $RDF_MODEL = MOBY::RDF::ServiceInstanceRDF->new( - #model => $model, - #service_instance => $service_instance ); - # my $RDF_XML = $RDF_MODEL->serialize; - #my $LSID = $service_instance->LSID; my $RDF = _getServiceInstanceRDF(name=>$serviceName, auth=>$AuthURI, url=>$ENV{MOBY_SERVER}, uri=>$ENV{MOBY_URI}); unless ($RDF) { From mwilkinson at dev.open-bio.org Thu Dec 14 17:57:06 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 14 Dec 2006 12:57:06 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612141757.kBEHv6oq015008@dev.open-bio.org> mwilkinson Thu Dec 14 12:57:06 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv14971/MOBY/Client Modified Files: Central.pm Log Message: making initial code changes to support async potocol moby-live/Perl/MOBY/Client Central.pm,1.136,1.137 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.136 retrieving revision 1.137 diff -u -r1.136 -r1.137 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2006/12/07 16:18:04 1.136 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2006/12/14 17:57:06 1.137 @@ -614,7 +614,7 @@ authURI => $authURI, contactEmail => "your at mail.address", description => $human_readable_description, - category => "moby" | "cgi" | "wsdl" (currently only moby and wsdl supported) + category => "moby" | "post" | "moby-async" URL => $URL_TO_SERVICE (or URL to WSDL document for wsdl-type services) input: listref; (articleName may be undef) @@ -712,9 +712,9 @@ #____________________________________________________________________________________________ return $self->errorRegXML( -"Only 'moby', 'post' and 'wsdl' Service Categories are currently allowed - you gave me $Category" +"Only 'moby', 'post', 'moby-async' and 'wsdl' Service Categories are currently allowed - you gave me $Category" ) - unless ( ( $Category eq 'moby' ) || ( $Category eq 'wsdl' ) || ( $Category eq 'post' )); + unless ( ( $Category eq 'moby' ) || ( $Category eq 'wsdl' )|| ( $Category eq 'moby-async' ) || ( $Category eq 'post' )); return $self->errorRegXML( "All Fields Required: serviceName, serviceType, authURI, contactEmail, URL, description, Category, input, output, secondary" ) @@ -736,7 +736,7 @@ $authURI $email"; - if ( $Category eq "moby" || $Category eq 'soap' || $Category eq 'post') { + if ( $Category eq "moby" || $Category eq 'moby-async' || $Category eq 'post') { my %SEC; if ( $a{'secondary'} && ( ref( $a{'secondary'} ) eq 'HASH' ) ) { %SEC = %{ $a{secondary} }; @@ -861,44 +861,16 @@ $message .= ""; } else { - return $self->errorRegXML("only 'moby', 'post' and 'wsdl' service types are allowed to be registered at this time."); + return $self->errorRegXML("only 'moby', 'post' and 'moby-async' service types are allowed to be registered at this time."); } -#elsif ($Category eq "cgi") { -# my $IN = $a{input}; -# $message .= " -# -# -# -# "; -#} else { -# $message .= " -# "; -#} -#unless ($message =~ /\<\/registerService/){ return MOBY::Registration->new( -# success => "0", -# error_messsage => "missing parameters or other failure leading to incorrectly formatted XML", -# registration_id => "0")}; -# print STDERR $message; + $debug && &_LOG(" message\n\n$message\n\n"); -# my $return = $self->SOAP_connection->call(registerService => ($message))->paramsall; my ($return) = $self->_call( 'default', 'registerService', $message ); -# return ( $self->parseRegXML( $return ) ); #_______call a new version RDFbuilder (by Eddie Kawas) _________________________________________ my $reg = $self->parseRegXML($return); - -# if ($reg->success == 1){ -# require LWP::UserAgent; -# -# my $ua = LWP::UserAgent->new; -# my $url='http://mobycentral.cbr.nrc.ca:8090/servlets/forms/getSignatureResponse?domain='.$authURI.'&serviceName='.$name; -# -# my $response = $ua->get($url); -# my $rdf = $response->content; -# print "$rdf\n"; -#} return $reg; @@ -973,7 +945,7 @@ serviceType => $serviceType, (optional) authURI => $authURI, (optional) authoritative => 1, (optional) - category => "moby" | "cgi" | "soap" (currently only moby supported) (optional) + category => "moby" | "post" | "moby-async" (optional) expandObjects => 1, (optional) expandServices => 1, (optional) URL => $URL_TO_SERVICE (optional) From mwilkinson at dev.open-bio.org Thu Dec 14 18:10:40 2006 From: mwilkinson at dev.open-bio.org (Mark Wilkinson) Date: Thu, 14 Dec 2006 13:10:40 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612141810.kBEIAeDn015072@dev.open-bio.org> mwilkinson Thu Dec 14 13:10:40 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv15053/MOBY Modified Files: Central.pm Log Message: making initial code changes to support async potocol moby-live/Perl/MOBY Central.pm,1.266,1.267 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.266 retrieving revision 1.267 diff -u -r1.266 -r1.267 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/14 17:57:05 1.266 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2006/12/14 18:10:40 1.267 @@ -3195,14 +3195,50 @@ # do substitutions my $serviceType = $SI->category; my $wsdl; - if ($serviceType eq "post"){ - $wsdl = &_doPostWSDLReplacement(@_) + if ($serviceType eq "post"){ + $wsdl = &_doPostWSDLReplacement(@_) } elsif ($serviceType eq "moby"){ - $wsdl = &_doMobyWSDLReplacement(@_) + $wsdl = &_doMobyWSDLReplacement(@_) + } elsif ($serviceType eq "moby-async"){ + $wsdl = &_doAsyncWSDLReplacement(@_) } return $wsdl; } +sub _doAsyncWSDLReplacement { + # this routine does not work at the moment + # we're just waiting for an example of an async + # wsdl document from IMB + my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; + my $wsdl = $WSDL_POST_TEMPLATE; + $wsdl =~ s/^\n//gs; + my $serviceName = $SI->servicename; + my $AuthURI = $SI->authority_uri; + my $desc = $SI->description; + if ( $desc =~ /[^\]]+))\]\]>/ ) { + $desc = $1; + } + $desc =~ s"\<"<"g; # XMl encode now that it is not CDATAd + $desc =~ s"\>">"g; # XML encode now that it is not CDATAd + my $URL = $SI->url; + $URL =~ "(http://[^/]+)(/.*)"; + my $baseURL = $1; + my $relativeURL = $2; + my $IN = "NOT_YET_DEFINED_INPUTS"; + my $OUT = "NOT_YET_DEFINED_OUTPUTS"; + my $INxsd = &_getInputXSD( $InputXML, $SecondaryXML ); + my $OUTxsd = &_getOutputXSD($OutputXML); + $INxsd ||= ""; + $OUTxsd ||= ""; + $wsdl =~ s/MOBY__SERVICE__NAME__/$serviceName/g; # replace all of the goofy portbindingpottype crap + $wsdl =~s/\<\!\-\-\s*MOBY__SERVICE__DESCRIPTION\s*\-\-\>/Authority: $AuthURI - $desc/g; # add a sensible description + $wsdl =~ s/MOBY__SERVICE__URL/$baseURL/g; # the URL to the service + $wsdl =~ s/MOBY__SERVICE__POST/$relativeURL/g; # the URL to the service + $wsdl =~ s/MOBY__SERVICE__NAME/$serviceName/g; # finally replace the actual subroutine call + return $wsdl; +} + + sub _doPostWSDLReplacement { my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; my $wsdl = $WSDL_POST_TEMPLATE; @@ -3233,6 +3269,7 @@ return $wsdl; } + sub _doMobyWSDLReplacement { my ( $SI, $InputXML, $OutputXML, $SecondaryXML ) = @_; my $wsdl = $WSDL_TEMPLATE; @@ -3781,6 +3818,131 @@ ## ## +=head2 _getInputXSD + + name : _getInputXSD($InputXML, $SecondaryXML) + function: to get an XSD describing the input to a MOBY Service, + e.g. to use in a WSDL document + args : (see _serviceListResponse code above for full details of XML) + $InputXML - the ... block of a findService + response message + + $SecondaryXML - the ... + fragment of a findService response message + + returns : XSD fragment of XML (should not return an XML header!) + notes : the structure of an Input block is as follows: + + + + + the structure of a secondaryArticle block is as follows: + + + + + +=over + +=item * Simple + + + ObjectOntologyTerm + NamespaceTerm + ... + + +=item * Collection note that articleName of the contained Simple objects is not required, and is ignored. + + + + ...... + ...... + + +=item * Secondary + + + + INT|FLOAT|STRING + ... + ... + ... + ... + ... + + +=back + +=cut + +sub _getInputXSD { + my ( $Input, $Secondary ) = @_; + my $XSD; + return $XSD; +} + +=head2 _getOuputXSD + + name : _getOutputXSD($OutputXML) + function: to get an XSD describing the output from a MOBY Service + e.g. to use in a WSDL document + args : (see _serviceListResponse code above for full details) + $InputXML - the ... block of a findService + response message + + $SecondaryXML - the ... + fragment of a findService response message + + returns : XSD fragment of XML (should not return an XML header!) + notes : the structure of an Output block is as follows: + + + + +=over + +=item * Simple + + + ObjectOntologyTerm + NamespaceTerm + ... + + +=item * Collection note that articleName of the contained Simple objects is not required, and is ignored. + + + + ...... + ...... + + +=back + +=cut + +sub _getOutputXSD { + my ($Output) = @_; + my $XSD; + return $XSD; +} + + + +=head2 WSDL_Templates + +=cut + +#=============================================== +#=============================================== +#=============================================== + +# Standard MOBY WSDL Template $WSDL_TEMPLATE = < @@ -3835,6 +3997,7 @@ END +# MOBY POST service template $WSDL_POST_TEMPLATE = < @@ -3890,119 +4053,62 @@ END2 -=head2 _getInputXSD - - name : _getInputXSD($InputXML, $SecondaryXML) - function: to get an XSD describing the input to a MOBY Service, - e.g. to use in a WSDL document - args : (see _serviceListResponse code above for full details of XML) - $InputXML - the ... block of a findService - response message - - $SecondaryXML - the ... - fragment of a findService response message - - returns : XSD fragment of XML (should not return an XML header!) - notes : the structure of an Input block is as follows: - - - - - the structure of a secondaryArticle block is as follows: - - - - - -=over - -=item * Simple +# for MOBY Asynchronous services. This WSDL is not correct YET! - - ObjectOntologyTerm - NamespaceTerm - ... - - -=item * Collection note that articleName of the contained Simple objects is not required, and is ignored. - - - - ...... - ...... - - -=item * Secondary +$WSDL_ASYNC_TEMPLATE = < + + + + + - - INT|FLOAT|STRING - ... - ... - ... - ... - ... - - -=back - -=cut - -sub _getInputXSD { - my ( $Input, $Secondary ) = @_; - my $XSD; - return $XSD; -} - -=head2 _getOuputXSD - - name : _getOutputXSD($OutputXML) - function: to get an XSD describing the output from a MOBY Service - e.g. to use in a WSDL document - args : (see _serviceListResponse code above for full details) - $InputXML - the ... block of a findService - response message - - $SecondaryXML - the ... - fragment of a findService response message - - returns : XSD fragment of XML (should not return an XML header!) - notes : the structure of an Output block is as follows: - - - - -=over - -=item * Simple + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - ObjectOntologyTerm - NamespaceTerm - ... - + -=item * Collection note that articleName of the contained Simple objects is not required, and is ignored. - - - ...... - ...... - +END -=back -=cut -sub _getOutputXSD { - my ($Output) = @_; - my $XSD; - return $XSD; -} 1; From gordonp at dev.open-bio.org Thu Dec 14 19:37:37 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 14:37:37 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612141937.kBEJbbrS015483@dev.open-bio.org> gordonp Thu Dec 14 14:37:37 EST 2006 Update of /home/repository/moby/moby-live/Java/src/Clients In directory dev.open-bio.org:/tmp/cvs-serv15452/src/Clients Added Files: TestClientServiceChain.java Log Message: Example of taking output from one service, and using it as input to another (with secondary articles) moby-live/Java/src/Clients TestClientServiceChain.java,NONE,1.1 From gordonp at dev.open-bio.org Thu Dec 14 19:38:34 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 14:38:34 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612141938.kBEJcY9S015568@dev.open-bio.org> gordonp Thu Dec 14 14:38:34 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources In directory dev.open-bio.org:/tmp/cvs-serv15533/src/main/ca/ucalgary/seahawk/resources Modified Files: mobyBuilderRules.xml Log Message: New rule for genbank flat files moby-live/Java/src/main/ca/ucalgary/seahawk/resources mobyBuilderRules.xml,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/mobyBuilderRules.xml,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/seahawk/resources/mobyBuilderRules.xml 2006/10/25 02:33:22 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/resources/mobyBuilderRules.xml 2006/12/14 19:38:34 1.2 @@ -4,6 +4,15 @@ http://www.bioxml.info/dtd/tigrxml.dtd http://www.bioxml.info/dtd/Bioseq.dtd + + \s*(LOCUS\s+(\S+)(?:.*|\n)+?\n//(?:\n|$)) + + $2 + + + $1 + + (?:GO|go):(\d{7}) From gordonp at dev.open-bio.org Thu Dec 14 22:17:28 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 17:17:28 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612142217.kBEMHSoZ016353@dev.open-bio.org> gordonp Thu Dec 14 17:17:28 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv16318/src/main/org/biomoby/shared/data Modified Files: MobyContentInstance.java Log Message: Made content more robust by escaping apostrohpes in simple parameter names moby-live/Java/src/main/org/biomoby/shared/data MobyContentInstance.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/12/11 18:58:58 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java 2006/12/14 22:17:28 1.9 @@ -185,7 +185,7 @@ debugPS = ps; } - protected void parseDataGroup(Element dataGroupTag) throws MobyException{ + public void parseDataGroup(Element dataGroupTag) throws MobyException{ String groupID = null; MobyDataJob job = new MobyDataJob(); @@ -439,7 +439,7 @@ if(dataObject instanceof MobyDataObject){ // This line should be replaced with a named field - xml.append(" "+ + xml.append(" "+ dataObject.toXML()+ ""); } From gordonp at dev.open-bio.org Thu Dec 14 22:18:18 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 17:18:18 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612142218.kBEMIIDA016396@dev.open-bio.org> gordonp Thu Dec 14 17:18:18 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data In directory dev.open-bio.org:/tmp/cvs-serv16361/src/main/org/biomoby/shared/data Modified Files: MobyDataSecondaryInstance.java Log Message: Made deserialization more robust by being flexible on moby namespace presence for Value tag moby-live/Java/src/main/org/biomoby/shared/data MobyDataSecondaryInstance.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2006/12/07 16:37:36 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataSecondaryInstance.java 2006/12/14 22:18:18 1.8 @@ -70,7 +70,7 @@ throw new MobyException("While creating a secondary parameter instance from XML: " + "the passed in element (" +objectClass + ") was not a " + MobyTags.PARAMETER); } - NodeList values = objectTag.getElementsByTagNameNS(MobyPrefixResolver.MOBY_XML_NAMESPACE, MobyTags.VALUE); + NodeList values = MobyPrefixResolver.getChildElements(objectTag, MobyTags.VALUE); if(values.getLength() == 0){ throw new MobyException("While creating a secondary parameter instance from XML: " + "No " + VALUE_NAME + " element in the namespace " + From gordonp at dev.open-bio.org Thu Dec 14 22:20:10 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 17:20:10 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612142220.kBEMKA6d016460@dev.open-bio.org> gordonp Thu Dec 14 17:20:10 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv16425/src/main/ca/ucalgary/seahawk/gui Modified Files: MobyContentPane.java Added Files: FileAndTextTransferHandler.java Log Message: Made Seahawk's content panes 'droppable', i.e. files, URLs, XML fragments and strings dropped onto it from the windowing system are loaded in a new tab moby-live/Java/src/main/ca/ucalgary/seahawk/gui FileAndTextTransferHandler.java,NONE,1.1 MobyContentPane.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.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/seahawk/gui/MobyContentPane.java 2006/11/24 20:57:25 1.2 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java 2006/12/14 22:20:10 1.3 @@ -88,8 +88,11 @@ contentGUI = cGUI; servicesGUI = sGUI; + setTransferHandler(new FileAndTextTransferHandler(cGUI)); + // The following is a non-user editable pane for showing HTML editorPane = new PrintableJEditorPane(); + editorPane.setTransferHandler(getTransferHandler()); //editorPane.setPreferredSize(parentComponent.getPreferredSize()); editorPane.setEditable(false); editorPane.addMouseListener(this); From gordonp at dev.open-bio.org Fri Dec 15 04:39:52 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 23:39:52 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612150439.kBF4dqp5017116@dev.open-bio.org> gordonp Thu Dec 14 23:39:52 EST 2006 Update of /home/repository/moby/moby-live/Java/xmls In directory dev.open-bio.org:/tmp/cvs-serv17081/xmls Modified Files: seahawkBuild.xml Log Message: Added xml error hanlder to includes list for applet moby-live/Java/xmls seahawkBuild.xml,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2006/12/06 16:07:11 1.6 +++ /home/repository/moby/moby-live/Java/xmls/seahawkBuild.xml 2006/12/15 04:39:52 1.7 @@ -70,7 +70,7 @@ - + From gordonp at dev.open-bio.org Fri Dec 15 04:40:36 2006 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Thu, 14 Dec 2006 23:40:36 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200612150440.kBF4ea90017179@dev.open-bio.org> gordonp Thu Dec 14 23:40:36 EST 2006 Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui In directory dev.open-bio.org:/tmp/cvs-serv17144/src/main/ca/ucalgary/seahawk/gui Modified Files: FileAndTextTransferHandler.java Log Message: Added better support for windows URL links moby-live/Java/src/main/ca/ucalgary/seahawk/gui FileAndTextTransferHandler.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.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/seahawk/gui/FileAndTextTransferHandler.java 2006/12/14 22:20:10 1.1 +++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/FileAndTextTransferHandler.java 2006/12/15 04:40:36 1.2 @@ -46,7 +46,36 @@ if (hasFileFlavor(t.getTransferDataFlavors())) { // Load any dragged file as a URL for (File file: (java.util.List) t.getTransferData(DataFlavor.javaFileListFlavor)) { - gui.loadPaneFromURL(file.toURI().toURL(), true); + String fileString = file.toURI().toURL().toString().toLowerCase(); + + // Windows Web shortcut? + URL u = null; + if(fileString.lastIndexOf(".url") == fileString.length()-4){ + LineNumberReader in = new LineNumberReader( + new InputStreamReader(file.toURI().toURL().openStream())); + for(String line = in.readLine(); line != null; line = in.readLine()){ + int urlIndex = line.indexOf("URL="); + if(line.indexOf("URL=") == 0){ + try{ + u = new URL(line.substring(4)); + } catch(MalformedURLException murle){ + System.err.println("Could not format " +line); + murle.printStackTrace(); + // Not a URL, but really it should have been. + // oh well, move on to normal file loading... + } + break; // done with this file as a URL, no need to execute other loadPaneFromURL + } + } + } + // Was it a shortcut file after all? + if(u != null){ + gui.loadPaneFromURL(u, true); + } + // Any other type of file is loaded as-is + else{ + gui.loadPaneFromURL(file.toURI().toURL(), true); + } } return true; } else if (hasTextFlavor(t.getTransferDataFlavors())) { @@ -61,10 +90,24 @@ // Some readers put funny nulls before each char (8->16 bit char encoding goof) String text = textBuffer.toString().replaceAll("\00", ""); + // Is it an address bar icon dragged from firefox? Strip the surrounding html + String linktext = null; + if(text.indexOf("") == text.length()-11){ + linktext = text.substring(15, text.indexOf("\"",15)); + } + else if(text.indexOf("") == text.length()-4){ //unix + linktext = text.substring(9, text.indexOf("\"",9)); + } + else if(text.indexOf("") != -1){ + int startHref = text.indexOf("((?:.*|\n)*)", "$1"); + int preStart = xmltext.indexOf("")+1); xmltext = xmltext.replaceAll(">", ">"); xmltext = xmltext.replaceAll("<", "<"); xmltext = xmltext.replaceAll("&", "&"); @@ -113,7 +159,6 @@ content.parseDataGroup(data); } else{ - System.err.println("Using object creator for "+data.getLocalName()); // Any other data can be processed by the base object class content = new MobyContentInstance(MobyDataObject.createInstanceFromDOM(data), "Drag 'n' Drop data"); } From deandres at dev.open-bio.org Mon Dec 4 08:25:53 2006 From: deandres at dev.open-bio.org (Enrique de Andres Saiz) Date: Mon, 04 Dec 2006 08:25:53 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200612040825.kB48Pqhm010026@dev.open-bio.org> deandres Mon Dec 4 03:25:52 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Async In directory dev.open-bio.org:/tmp/cvs-serv9992/Async Log Message: Directory /home/repository/moby/moby-live/Perl/MOBY/Async added to the repository moby-live/Perl/MOBY/Async - New directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/Async/RCS/-,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/Async/RCS/New,v: No such file or directory rcsdiff: /home/repository/moby/moby-live/Perl/MOBY/Async/RCS/directory,v: No such file or directory From deandres at dev.open-bio.org Mon Dec 4 08:27:54 2006 From: deandres at dev.open-bio.org (Enrique de Andres Saiz) Date: Mon, 04 Dec 2006 08:27:54 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200612040827.kB48RqeK010090@dev.open-bio.org> deandres Mon Dec 4 03:27:52 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY In directory dev.open-bio.org:/tmp/cvs-serv10059 Added Files: Async.pm Log Message: Extension for asynchronism moby-live/Perl/MOBY Async.pm,NONE,1.1 From deandres at dev.open-bio.org Mon Dec 4 08:27:54 2006 From: deandres at dev.open-bio.org (Enrique de Andres Saiz) Date: Mon, 04 Dec 2006 08:27:54 -0000 Subject: [MOBY-guts] biomoby commit Message-ID: <200612040827.kB48RqjZ010104@dev.open-bio.org> deandres Mon Dec 4 03:27:52 EST 2006 Update of /home/repository/moby/moby-live/Perl/MOBY/Async In directory dev.open-bio.org:/tmp/cvs-serv10059/Async Added Files: LSAE.pm Service.pm SimpleServer.pm WSRF.pm Log Message: Extension for asynchronism moby-live/Perl/MOBY/Async LSAE.pm,NONE,1.1 Service.pm,NONE,1.1 SimpleServer.pm,NONE,1.1 WSRF.pm,NONE,1.1