[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Wed Oct 25 02:33:23 UTC 2006


gordonp
Tue Oct 24 22:33:23 EDT 2006
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared
In directory dev.open-bio.org:/tmp/cvs-serv9957/src/main/org/biomoby/shared

Modified Files:
	MobyService.java 
Log Message:
Added MobyServlet and Seahawk initial versions to the repository
moby-live/Java/src/main/org/biomoby/shared MobyService.java,1.12,1.13
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java	2006/07/07 04:12:40	1.12
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java	2006/10/25 02:33:23	1.13
@@ -53,6 +53,14 @@
     protected String lsid = null;
     protected MobyServiceType serviceType = new MobyServiceType();
 
+    public static final int UNCHECKED = 0;
+    public static final int DEAD= 1;
+    public static final int ALIVE = 2; // Can connect to the service endpoint
+    public static final int PINGED = 4; // Responds to a blank MOBY request
+    public static final int TESTED = 8; // Gives a valid answer to a valid test input provided by the service
+    protected int serviceStatus = UNCHECKED;
+    protected int statusChecks = UNCHECKED;
+
     // the elements of these Vectors are of type MobyData
     protected Vector primaryInputs = new Vector();
     protected Vector secondaryInputs = new Vector();
@@ -99,6 +107,32 @@
 	return name + "/" + authority;
     }
 
+    /**
+     * @param statusCode should be one of ALIVE, PINGED, TESTED
+     * @param mode whether the service passed the requirement or not
+     */
+    public void setStatus(int statusCode, boolean mode){
+	if(mode){
+           serviceStatus |= statusCode;
+        }
+	statusChecks |= statusCode;
+    }
+
+    /**
+     * @return bit-wise combination of ALIVE, PINGED, TESTED states for the service, or DEAD if no tests passed, or UNCHECKED if no tests have been run
+     */
+    public int getStatus(){
+        if((statusChecks & serviceStatus) != 0){ //some status test passed
+	  return serviceStatus;
+        }
+        else if(statusChecks == UNCHECKED){
+          return UNCHECKED;
+        }
+        else{
+          return DEAD; // failed every test thrown at it so far
+        }
+    }
+
     public String getName() {
 	return name;
     }




More information about the MOBY-guts mailing list