[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Wed Apr 25 20:32:28 UTC 2007


kawas
Wed Apr 25 16:32:28 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities
In directory dev.open-bio.org:/tmp/cvs-serv28203/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities

Modified Files:
	ContextLoader.java RegistryContextListener.java 
Log Message:
updated the context loader to read in a boolean regarding whether or not to test services.

the listener now uses that variable to determine whether or not we are to test the services in the registry.
moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities ContextLoader.java,1.2,1.3 RegistryContextListener.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ContextLoader.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/utilities/ContextLoader.java	2006/10/16 17:23:16	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ContextLoader.java	2007/04/25 20:32:28	1.3
@@ -38,6 +38,8 @@
 	private String FULL_SERVER_URL = "";
 	
 	private String CONTEXT_PATH = "";
+	
+	private boolean TESTING_SERVICES = false;
 
 	/**
 	 * Constructor loads variables from InitialContext()
@@ -115,6 +117,24 @@
 				log.error("Failure obtaining and setting LSID_PORT:"
 						+ System.getProperty("line.separator") + ex.getLocalizedMessage());
 			}
+			
+			// check if the server wants to validate services ...
+			try {
+				Boolean validate = false;
+				validate = (Boolean) c.lookup("java:comp/env/DO_SERVICE_VALIDATION");
+				if (validate != null) {
+					// set DO_SERVICE_VALIDATION
+					log.info(validate.booleanValue() ? "Service testing is turned on ..." : "Service testing is turned off ...");
+					TESTING_SERVICES = validate.booleanValue();
+					System.setProperty("DO_SERVICE_VALIDATION", validate.booleanValue() + "");
+				} else {
+					log.info("Service testing is turned off ...");
+				}
+
+			} catch (Exception ex) {
+				log.warn("Failure obtaining and setting DO_SERVICE_VALIDATION:"
+						+ System.getProperty("line.separator") + ex.getLocalizedMessage());
+			}
 
 		} catch (Exception e) {
 			log
@@ -343,4 +363,8 @@
 		return CONTEXT_PATH;
 	}
 
+	public boolean isTESTING_SERVICES() {
+		return TESTING_SERVICES;
+	}
+
 }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/RegistryContextListener.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/client/ui/graphical/servlet/utilities/RegistryContextListener.java	2006/10/25 19:32:54	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/RegistryContextListener.java	2007/04/25 20:32:28	1.2
@@ -45,17 +45,19 @@
 
 		// add objects to keep to the context - make sure to remove them on destroy!
 		ServletContext servletContext = servletContextEvent.getServletContext();
-		try {
-			Timer timer = new Timer();
-			ServiceTesterRunner runner = new ServiceTesterRunner();
-			Calendar calendar = Calendar.getInstance();
-			Date time = calendar.getTime();
-			log.info("Scheduling an on going task: ServiceTester");
-			timer.scheduleAtFixedRate(runner, time, 1000 * 60 * 60);
-			servletContext.setAttribute("tester", runner);
-			servletContext.setAttribute("timer", timer);
-		} catch (Exception e) {
-			
+		if (cLoader.isTESTING_SERVICES()) {
+			try {
+				Timer timer = new Timer();
+				ServiceTesterRunner runner = new ServiceTesterRunner();
+				Calendar calendar = Calendar.getInstance();
+				Date time = calendar.getTime();
+				log.info("Scheduling an on going task: ServiceTester");
+				timer.scheduleAtFixedRate(runner, time, 1000 * 60 * 60);
+				servletContext.setAttribute("tester", runner);
+				servletContext.setAttribute("timer", timer);
+			} catch (Exception e) {
+				
+			}
 		}
 	}
 
@@ -63,9 +65,10 @@
 		ServletContext servletContext = servletContextEvent.getServletContext();
 		// here we 'cleanup' all items we placed for 'global' use
 		Timer timer = (Timer)servletContext.getAttribute ("timer");
-		if (timer != null)
+		if (timer != null) {
 			timer.cancel();
-		log.info("cancelling on going task: ServiceTester");
+			log.info("cancelling on going task: ServiceTester");
+		}
 		servletContext.removeAttribute ("timer");
 		servletContext.removeAttribute ("tester");
 	}




More information about the MOBY-guts mailing list