[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Sat Jan 27 00:31:09 UTC 2007


kawas
Fri Jan 26 19:31:08 EST 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms
In directory dev.open-bio.org:/tmp/cvs-serv2946/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms

Modified Files:
	RDFGenerator.java LSIDComplete.java 
Log Message:

moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms RDFGenerator.java,1.5,1.6 LSIDComplete.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/RDFGenerator.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/client/ui/graphical/servlet/forms/RDFGenerator.java	2006/08/30 17:07:55	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/RDFGenerator.java	2007/01/27 00:31:08	1.6
@@ -20,8 +20,9 @@
  * @author Eddie Kawas
  *         <p>
  *         Created for use by the Perl based moby central registry so that RDF
- *         documents for newly registered services can be generated. This servlet is most likely
- *         only called when a service has been registered.
+ *         documents for newly registered services can be generated. This
+ *         servlet is most likely only called when a service has been
+ *         registered.
  *         <p>
  *         email me at edward.kawas at gmail.com
  */
@@ -34,18 +35,19 @@
 
 	final private String newline = System.getProperty("line.separator");
 
-	protected void doGet(HttpServletRequest request,
-			HttpServletResponse response) throws ServletException, IOException {
+	protected void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
 		String authority = filter(request.getParameter("auth"));
 		String serviceName = filter(request.getParameter("name"));
 		String endpoint = filter(request.getParameter("url"));
 		String uri = filter(request.getParameter("uri"));
 
-		//System.out.println(endpoint + " " + authority + " " + uri + " " + serviceName);
+		// System.out.println(endpoint + " " + authority + " " + uri + " " +
+		// serviceName);
 		// null endpoints or uri default to mobycentral
 		endpoint = (endpoint == null) ? CentralImpl.DEFAULT_ENDPOINT : endpoint;
 		uri = (uri == null) ? CentralImpl.DEFAULT_NAMESPACE : uri;
-		
+
 		if (serviceName == null || serviceName.equals("")) {
 			// error routine here
 			response.setContentType("text/html");
@@ -60,9 +62,9 @@
 			out.println("The service providers authority is missing");
 			return;
 		}
+
 		response.setContentType("application/rdf+xml");
-		response.setHeader("Content-Disposition", "attachment;filename="
-				+ "service.rdf");
+		response.setHeader("Content-Disposition", "attachment;filename=" + "service.rdf");
 		PrintWriter out = response.getWriter();
 		out.print(ServiceInstanceRDF.findService(authority, serviceName, endpoint, uri, false));
 		return;

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/LSIDComplete.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/servlet/forms/LSIDComplete.java	2006/10/11 01:54:50	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/forms/LSIDComplete.java	2007/01/27 00:31:08	1.3
@@ -11,9 +11,9 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Timer;
-import java.util.TimerTask;
 
+
+import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
@@ -21,10 +21,8 @@
 import javax.sql.DataSource;
 
 import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.commons.discovery.tools.DiscoverSingleton;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.biomoby.client.ui.graphical.servlet.utilities.ContextLoader;
 import org.biomoby.registry.properties.MobyProperties;
 
 /*
@@ -50,26 +48,8 @@
 	private Map datas = Collections.synchronizedMap(new HashMap());
 	
 
-	public void init() throws ServletException {
+	public void init(ServletConfig conf) throws ServletException {
 		super.init();
-		
-		
-		ContextLoader cLoader = null;
-		try {
-			cLoader = (ContextLoader) DiscoverSingleton.find(Class
-					.forName((String) ContextLoader.class.getCanonicalName()), Class.forName(
-					(String) ContextLoader.class.getCanonicalName()).getName());
-			log
-					.warn((cLoader == null ? "ContextLoader is null and is therefore not loaded. This is BAD!"
-							: "ContextLoader has loaded successfully."));
-		} catch (Exception e) {
-			log.warn("ContextLoader is null and is therefore not loaded. This is BAD!"
-					+ System.getProperty("line.separator") + e.getStackTrace());
-		}
-		
-		log.debug("Initializing the Timer that will invoke the StatWriter");
-		Timer timer = new Timer();
-		timer.scheduleAtFixedRate(new StatWriter(this), new java.util.Date(), 1000 * 60 * 60);
 	}
 
 	// an array of properties objects created initialized once for more efficient running
@@ -331,8 +311,10 @@
 				continue;
 			BasicDataSource bds = (BasicDataSource) ds;
 			log.info("NumActive connections to " + object + ": " + bds.getNumActive());
-			log.info("NumIdle: connections to " + object + ": " + bds.getNumIdle());			
+			log.info("NumIdle: connections to " + object + ": " + bds.getNumIdle());
+			shutdownDataSource(bds);
 		}
+		map.clear();
 	}
 
 	public void shutdownDataSource(DataSource ds) throws SQLException {
@@ -340,22 +322,4 @@
 		bds.close();
 		ds = null;
 	}
-
-	private class StatWriter extends TimerTask {
-		private LSIDComplete lc = null;
-
-		public StatWriter(LSIDComplete lc) {
-			this.lc = lc;
-		}
-
-		public void run() {
-			log.debug("Attempting to invoke StatWriter");
-			try {
-				printDataSourceStats(lc.datas);
-			} catch (SQLException e) {
-				log.error("Error invoking the StatWriter " + e.getLocalizedMessage());
-			}
-		}
-
-	}
 }
\ No newline at end of file




More information about the MOBY-guts mailing list