[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Mon Oct 16 17:23:16 UTC 2006


kawas
Mon Oct 16 13:23:16 EDT 2006
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-serv16466/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities

Modified Files:
	ContextLoader.java ServiceTester.java 
Log Message:

moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities ContextLoader.java,1.1,1.2 ServiceTester.java,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ContextLoader.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/ContextLoader.java	2006/10/11 01:54:50	1.1
+++ /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
@@ -275,14 +275,15 @@
 				}
 			} catch (Exception ex) {
 				// some defaults if nothing else works
-				URI_MAP.put("Object", "http://biomoby.org/RESOURCES/MOBY-S/Objects#");
+				log.warn("Using hard-coded URIs for Objects, Service, Namespace and Serviceinstances.");
+				URI_MAP.put("Object", "http://biomoby.org/authority/RESOURCES/MOBY-S/Objects#");
 
-				URI_MAP.put("Service", "http://biomoby.org/RESOURCES/MOBY-S/Services#");
+				URI_MAP.put("Service", "http://biomoby.org/authority/RESOURCES/MOBY-S/Services#");
 
-				URI_MAP.put("Namespace", "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#");
+				URI_MAP.put("Namespace", "http://biomoby.org/authority/RESOURCES/MOBY-S/Namespaces#");
 
 				URI_MAP.put("ServiceInstance",
-						"http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#");
+						"http://biomoby.org/authority/RESOURCES/MOBY-S/ServiceInstances#");
 			}
 		}
 

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.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/utilities/ServiceTester.java	2006/10/12 01:55:20	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ui/graphical/servlet/utilities/ServiceTester.java	2006/10/16 17:23:16	1.6
@@ -1,5 +1,6 @@
 package org.biomoby.client.ui.graphical.servlet.utilities;
 
+import java.text.DecimalFormat;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -15,6 +16,7 @@
 import org.biomoby.shared.Central;
 import org.biomoby.shared.MobyException;
 import org.biomoby.shared.MobyService;
+import org.biomoby.shared.Utils;
 import org.tulsoft.tools.soap.axis.AxisUtils;
 
 public class ServiceTester {
@@ -153,6 +155,41 @@
 		log.info("getting results complete");
 		return sb.toString();
 	}
+	
+	public String getStats() {
+		StringBuffer sb = new StringBuffer();
+		Map map = getResultMap();
+		int num_bad_authorities = 0;
+		int total_alive = 0;
+		int total_dead = 0;
+		
+		sb.append("There are " + map.keySet().size() + " service providers, with at least one registered service, registered with this registry." + newline);
+		for (Iterator it = map.keySet().iterator(); it.hasNext();) {
+			String key = (String) it.next();
+			Map list = (Map) map.get(key);
+			boolean hasGoodService = false;
+			// dive into this authoritys' services
+			for (Iterator listIt = list.keySet().iterator(); listIt.hasNext();) {
+				String servicename = (String) listIt.next();
+				Boolean contents = (Boolean) list.get(servicename);
+				if (contents.booleanValue()) {
+					total_alive++;
+					hasGoodService = true;
+				} else {
+					total_dead++;
+				}
+			}
+			// increment authority counts
+			if (!hasGoodService)
+				num_bad_authorities++;
+		}		
+		DecimalFormat df = new DecimalFormat("####.00");
+		sb.append("\tOf these service providers, there are " + num_bad_authorities + " that don't have at least one working service."+newline);
+		sb.append("There are "+total_alive+" services that are reachable in there current state."+newline);
+		sb.append("There are "+total_dead+" services that are not reachable."+newline);
+		sb.append(newline + "\tThat represents approximately " + df.format(((float)total_alive/(float)(total_dead+total_alive))*100) + "% in terms of alive services." );
+		return Utils.format(sb.toString(), 4);
+	}
 
 	public String getServiceInformationByAuthority(String authority) {
 		StringBuffer sb = new StringBuffer();
@@ -319,10 +356,4 @@
 	public void setNumThreads(int numThreads) {
 		this.numThreads = numThreads;
 	}
-	public static void main(String[] args) throws MobyException {
-		ServiceTester s = new ServiceTester("http://localhost/cgi-bin/MOBY-Central.pl","http://localhost/MOBY/Central");
-		s.testServices(s.getServices());
-		System.out.println(s.getResults());
-		
-	}
 }




More information about the MOBY-guts mailing list