[MOBY-guts] biomoby commit

Gary Schlitz gss at pub.open-bio.org
Sat Mar 27 01:14:23 UTC 2004


gss
Fri Mar 26 20:14:22 EST 2004
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/core/org/smoby/tools/server/servlet
In directory pub.open-bio.org:/tmp/cvs-serv2417/org/smoby/tools/server/servlet

Modified Files:
	AbstractMobyServlet.java 
Log Message:
More reorganization

moby-live/S-MOBY/ref-impl/core/org/smoby/tools/server/servlet AbstractMobyServlet.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/org/smoby/tools/server/servlet/AbstractMobyServlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/org/smoby/tools/server/servlet/AbstractMobyServlet.java	2004/03/20 00:29:15	1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/org/smoby/tools/server/servlet/AbstractMobyServlet.java	2004/03/27 01:14:22	1.3
@@ -8,6 +8,7 @@
 
 import org.apache.commons.httpclient.util.DateParseException;
 import org.apache.commons.httpclient.util.DateParser;
+import org.smoby.tools.common.graph.MOBYGraph;
 import org.smoby.tools.common.vocabulary.MOBY;
 
 /**
@@ -51,6 +52,15 @@
 	 * describes this provider. The graph should be in RDF/XML format.
 	 */
 	protected abstract BufferedReader getDescriptionGraphReader();
+    
+    /**
+     * Handle a request to engage a provider, and return a response
+     * graph.
+     * @param requestGraph the graph, with some blank nodes filled
+     * in, that serves as "input" to the provider.
+     * @return a graph containing the work product of the provider.
+     */
+    protected abstract void handleRequest(MOBYGraph requestGraph);
 	
 	/**
 	 * A utility method for getting a buffered reader (as returned by
@@ -89,5 +99,29 @@
     public void doPost(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
     {
+        PrintStream out = new PrintStream(response.getOutputStream());
+        
+        try
+        {
+            // Read the invocation graph from the "query-graph" parameter
+            // and parse it into a MOBYGraph object
+            //
+            String graphString = ParamReader.getParameter("query-graph", request);
+        	MOBYGraph graph = MOBYGraph.fromString(graphString, false);
+            
+            // Invoke the abstract handleRequest() method in order for the
+            // provider servlet to do whatever it does to the graph.
+            //
+            handleRequest(graph);
+            
+            // Send the graph back in response
+            //
+            graph.getModel().write(out, "RDF/XML-ABBREV");
+        }
+        catch (Throwable t)
+        {
+        }
+        out.flush();
+        out.close();
     }
 }
\ No newline at end of file




More information about the MOBY-guts mailing list