[MOBY-guts] biomoby commit

Wendy Alexander walexander at dev.open-bio.org
Wed Mar 19 22:49:47 UTC 2008


walexander
Wed Mar 19 18:49:47 EDT 2008
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory dev.open-bio.org:/tmp/cvs-serv28953

Modified Files:
	SimpleClientPanel.java 
Log Message:
Added pinger button.
moby-live/Java/src/main/org/biomoby/service/dashboard SimpleClientPanel.java,1.9,1.10
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java	2008/03/02 12:45:26	1.9
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java	2008/03/19 22:49:47	1.10
@@ -248,12 +248,16 @@
 	className = createText (null, DP_IMPL_CLASS, DP_IMPL_CLASS);
 
 	ButtonGroup group = new ButtonGroup();
-	JRadioButton htNone, htRegistry, htEndpoint, htLocal, htNewURL;
+	JRadioButton htNone, htRegistry, htEndpoint, htLocal, htNewURL, htPing;
 	group.add (htEndpoint = createHowToButton ("Use service's usual endpoint", DP_CS_URL));
 	group.add (htNone     = createHowToButton ("No real call, just show/echo input", DP_CS_NONE));
 	group.add (htRegistry = createHowToButton ("Ask registry where service is, and call it", DP_CS_REGISTRY));
 	group.add (htNewURL   = createHowToButton ("Use this endpoint", DP_CS_NEWURL));
 	group.add (htLocal    = createHowToButton ("Use this local class", DP_CS_CLASS));
+	group.add (htPing	  = createHowToButton ("'Ping' this service", DP_CS_PING));
+	htPing.setToolTipText("A Moby 'Ping' is used to determine if the service is responsive, " +
+			"and if it responds in an API-compliant manner");
+	
 
 	boolean usingAsBytes = getPrefValue (DP_INP_ASBYTES, false);
 	JCheckBox asBytes = createCheckBox
@@ -280,7 +284,8 @@
  	SwingUtils.addComponent (howTo, htLocal,    0, 3, 1, 1, NONE, NWEST,  0.0, 0.0);
  	SwingUtils.addComponent (howTo, className,  1, 3, 1, 1, HORI, NWEST,  1.0, 0.0);
  	SwingUtils.addComponent (howTo, htNone,     0, 4, 2, 1, NONE, NWEST,  0.0, 0.0);
- 	SwingUtils.addComponent (howTo, asBytes,    0, 5, 2, 1, NONE, NWEST,  0.0, 0.0, BREATH_TOP);
+ 	SwingUtils.addComponent (howTo, htPing,		0, 5, 2, 1, NONE, NWEST,  0.0, 0.0);	
+ 	SwingUtils.addComponent (howTo, asBytes,    0, 6, 2, 1, NONE, NWEST,  0.0, 0.0, BREATH_TOP);
 
 	// run the service
 	runButton =
@@ -534,6 +539,16 @@
 		if ( DP_CS_NONE.equals (propertyChannel.getString (DP_CALL_SERVICE)) ||
 		     (propertyChannel.getBoolean (DP_INP_SHOWXML, false)) ) {
 		    input.setText ((String)data.getData());
+		} 
+		
+		// If we are only pinging the service, set the data object to an empty message
+		if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) {
+			String emptyMsg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+			"<moby:MOBY xmlns:moby=\"http://www.biomoby.org/moby\">\n" +
+			"  <moby:mobyContent />\n" +
+			"</moby:MOBY>";
+			data.setData(emptyMsg);
+			input.setText(emptyMsg);
 		}
 
 		// finally, call the service
@@ -559,15 +574,27 @@
 	    }
 
 	    if (exception == null) {
-		propertyChannel.fire (DP_STATUS_MSG, "Service invocation finished.");
-
-		// handle results here (using renderers...)
-		if (! DP_CS_NONE.equals (propertyChannel.getString (DP_CALL_SERVICE)) )
-		    results.updateComponent (data);
+	    	
+			// handle results here (using renderers...)
+			if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) {
+				propertyChannel.fire (DP_STATUS_MSG, service.getName()+" isAlive.");
+			} else {
+				propertyChannel.fire (DP_STATUS_MSG, "Service invocation finished.");
+			}
+			
+			if (! DP_CS_NONE.equals (propertyChannel.getString (DP_CALL_SERVICE))) {
+			    results.updateComponent (data);			
+			}
 
 	    } else {
-		propertyChannel.fire (DP_STATUS_MSG, "Service invocation failed.");
-		error (CALLER_ERROR, exception);
+			if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) {
+		    	propertyChannel.fire (DP_STATUS_MSG, service.getName()+" is dead.");
+				results.removeResults();
+			} else {
+		    	propertyChannel.fire (DP_STATUS_MSG, "Service invocation failed.");
+				error (CALLER_ERROR, exception);
+			}
+			exception.printStackTrace();
 	    }
 	    serviceFinished();
 	}




More information about the MOBY-guts mailing list