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 @@
- A Java Development Kit version 5.0+
+ - 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.
- A Java Servlet container, such as
Apache Tomcat.
If you don't have one setup, here's a very quick guide.
- - Also download
-
- the MobyServlet Web Archive (WAR) you will be
- extending (right-click, "Save Target As...").
- - the example MOBY XML file that you'll use
+
- Also download:
+
Save them in your code development directory, so they will be convenient to access.
+
+ 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:
-
- - Copy
MobyServlet.war
to ConvertAAtoFASTA_AA.war
- - 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
-
-
+ 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