[MOBY-guts] biomoby commit

Gary Schlitz gss at pub.open-bio.org
Sat Mar 20 00:29:16 UTC 2004


gss
Fri Mar 19 19:29:15 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-serv14175/org/smoby/tools/server/servlet

Modified Files:
	AbstractMobyServlet.java 
Log Message:
Misc

moby-live/S-MOBY/ref-impl/core/org/smoby/tools/server/servlet AbstractMobyServlet.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/org/smoby/tools/server/servlet/AbstractMobyServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/org/smoby/tools/server/servlet/AbstractMobyServlet.java	2004/03/12 17:48:33	1.1
+++ /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
@@ -1,93 +1,93 @@
-package org.smoby.tools.server.servlet;
-
-import java.io.*;
-import java.util.*;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-import org.apache.commons.httpclient.util.DateParseException;
-import org.apache.commons.httpclient.util.DateParser;
-import org.smoby.tools.common.vocabulary.MOBY;
-
-/**
- * This abstract class serves as a base class for MOBY servlets.
- */
-public abstract class AbstractMobyServlet extends HttpServlet
-{
-	/**
-	 * By MOBY convention, an HTTP GET equates to a request for the
-	 * canonical OWL description graph for a provider.
-	 */
-	public void doGet(HttpServletRequest request, HttpServletResponse response)
-		throws ServletException, IOException
-	{
-        // Get a reader for reading the description graph. If a subclass
-        // returns null, then report a 404 Not Found; otherwise, stream
-        // the graph to the writer.
-        //
-        BufferedReader reader = getDescriptionGraphReader();
-        
-        if (reader == null)
-        {
-            response.sendError(HttpServletResponse.SC_NOT_FOUND);
-        }
-        else
-        {    
-            // Write everything from the reader to the writer
-            //
-            PrintWriter writer = response.getWriter();
-            String line;
-            while ((line = reader.readLine()) != null) {
-                writer.println(line);
-            }
-            reader.close();
-            writer.close();
-        }
-    }
-    
-    /**
-	 * Return a reader for reading the canonical OWL description graph that
-	 * describes this provider. The graph should be in RDF/XML format.
-	 */
-	protected abstract BufferedReader getDescriptionGraphReader();
-	
-	/**
-	 * A utility method for getting a buffered reader (as returned by
-	 * the abstract getDescriptionGraphReader() method) for reading
-	 * from a file.
-	 */
-	protected BufferedReader getFileReader(String fileName)
-	{
-		try {
-			return new BufferedReader(new InputStreamReader(
-				getServletContext().getResourceAsStream(fileName)));
-		} catch (Throwable t) {
-			return null;
-		}
-	}
-    
-    /**
-     * A utility method for getting the date a file was last modified.
-     * Subclasses that store their graphs in files will call this from
-     * their getLastModified() method.
-     */
-    protected long getLastModifiedDate(String fileName)
-    {
-        File f = new File(getServletContext().getRealPath(fileName));
-        if (f.exists()) {
-            return f.lastModified();
-        } else {
-            return Long.MAX_VALUE;
-        }
-    }
-    
-    /**
-     * By MOBY convention, an HTTP POST equates to a request for the service
-     * provided by a provider.
-     */
-    public void doPost(HttpServletRequest request, HttpServletResponse response)
-        throws ServletException, IOException
-    {
-    }
+package org.smoby.tools.server.servlet;
+
+import java.io.*;
+import java.util.*;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import org.apache.commons.httpclient.util.DateParseException;
+import org.apache.commons.httpclient.util.DateParser;
+import org.smoby.tools.common.vocabulary.MOBY;
+
+/**
+ * This abstract class serves as a base class for MOBY servlets.
+ */
+public abstract class AbstractMobyServlet extends HttpServlet
+{
+	/**
+	 * By MOBY convention, an HTTP GET equates to a request for the
+	 * canonical OWL description graph for a provider.
+	 */
+	public void doGet(HttpServletRequest request, HttpServletResponse response)
+		throws ServletException, IOException
+	{
+        // Get a reader for reading the description graph. If a subclass
+        // returns null, then report a 404 Not Found; otherwise, stream
+        // the graph to the writer.
+        //
+        BufferedReader reader = getDescriptionGraphReader();
+        
+        if (reader == null)
+        {
+            response.sendError(HttpServletResponse.SC_NOT_FOUND);
+        }
+        else
+        {    
+            // Write everything from the reader to the writer
+            //
+            PrintWriter writer = response.getWriter();
+            String line;
+            while ((line = reader.readLine()) != null) {
+                writer.println(line);
+            }
+            reader.close();
+            writer.close();
+        }
+    }
+    
+    /**
+	 * Return a reader for reading the canonical OWL description graph that
+	 * describes this provider. The graph should be in RDF/XML format.
+	 */
+	protected abstract BufferedReader getDescriptionGraphReader();
+	
+	/**
+	 * A utility method for getting a buffered reader (as returned by
+	 * the abstract getDescriptionGraphReader() method) for reading
+	 * from a file.
+	 */
+	protected BufferedReader getFileReader(String fileName)
+	{
+		try {
+			return new BufferedReader(new InputStreamReader(
+				getServletContext().getResourceAsStream(fileName)));
+		} catch (Throwable t) {
+			return null;
+		}
+	}
+    
+    /**
+     * A utility method for getting the date a file was last modified.
+     * Subclasses that store their graphs in files will call this from
+     * their getLastModified() method.
+     */
+    protected long getLastModifiedDate(String fileName)
+    {
+        File f = new File(getServletContext().getRealPath(fileName));
+        if (f.exists()) {
+            return f.lastModified();
+        } else {
+            return Long.MAX_VALUE;
+        }
+    }
+    
+    /**
+     * By MOBY convention, an HTTP POST equates to a request for the service
+     * provided by a provider.
+     */
+    public void doPost(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException
+    {
+    }
 }
\ No newline at end of file




More information about the MOBY-guts mailing list