[MOBY-guts] biomoby commit

Wendy Alexander walexander at dev.open-bio.org
Wed May 14 20:37:10 UTC 2008


walexander
Wed May 14 16:37:10 EDT 2008
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory dev.open-bio.org:/tmp/cvs-serv13213

Modified Files:
	DashboardProperties.java ServiceCallerModel.java 
	SimpleClientPanel.java 
Log Message:
Modified the ping functionality in the Simple Client panel.  Ping is now a checkbox option instead of a radio button.  Also the 'Call Service' button text changes to reflect whether a ping is used or the data is being sent as bytes.
moby-live/Java/src/main/org/biomoby/service/dashboard DashboardProperties.java,1.27,1.28 ServiceCallerModel.java,1.5,1.6 SimpleClientPanel.java,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java	2008/03/19 22:50:46	1.27
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java	2008/05/14 20:37:10	1.28
@@ -65,7 +65,6 @@
     static final String DP_CS_URL = "service-endpoint";
     static final String DP_CS_NEWURL = "service-new-endpoint";
     static final String DP_CS_REGISTRY = "as-registered";
-    static final String DP_CS_PING = "ping";
 
     static final String DP_ENDPOINT = "serviceEndpoint";
     static final String DP_IMPL_CLASS = "serviceImplClass";
@@ -73,6 +72,7 @@
     static final String DP_INP_SHOW = "showInput";
     static final String DP_INP_SHOWXML = "showInputAsXML";
     static final String DP_INP_ASBYTES = "sendInputAsBytes";
+    static final String DP_INP_PING = "sendEmptyInputAsPing";
 
     static final String DP_OUT_SHOW = "showOutput";
     static final String DP_OUT_SHOWXML = "showOutputAsXML";

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceCallerModel.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/service/dashboard/ServiceCallerModel.java	2008/03/19 22:50:14	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceCallerModel.java	2008/05/14 20:37:10	1.6
@@ -145,7 +145,7 @@
 		if (! UUtils.isEmpty (sEndpoint))
 		    clonedService.setURL (sEndpoint);
 
-	    } else if (DP_CS_REGISTRY.equals (howToCall) || DP_CS_PING.equals(howToCall)) {
+	    } else if (DP_CS_REGISTRY.equals (howToCall)) {
 		clonedService.setURL (null);
 		setRegistryEndpoint (propertyChannel.getString (DP_REGISTRY_ENDPOINT));
 		setRegistryNamespace (propertyChannel.getString (DP_REGISTRY_NAMESPACE));

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java	2008/03/19 22:49:47	1.10
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java	2008/05/14 20:37:10	1.11
@@ -248,48 +248,28 @@
 	className = createText (null, DP_IMPL_CLASS, DP_IMPL_CLASS);
 
 	ButtonGroup group = new ButtonGroup();
-	JRadioButton htNone, htRegistry, htEndpoint, htLocal, htNewURL, htPing;
+	JRadioButton htNone, htRegistry, htEndpoint, htLocal, htNewURL;
 	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
-	    ("Send data to service as a byte array",
-	     usingAsBytes, -1,
-	     new ItemListener() {
-		 public void itemStateChanged (ItemEvent e) {
-		     boolean enabled = (e.getStateChange() == ItemEvent.SELECTED);
-		     onAsBytes (enabled);
-		     setPrefValue (DP_INP_ASBYTES, enabled);
-		     propertyChannel.put (DP_INP_ASBYTES,
-					  new Boolean (enabled).toString());
-		 }
-	     });
-	onAsBytes (usingAsBytes);
-        asBytes.setToolTipText ("It should not have any effect on result; it is for debugging");
-	Font font = asBytes.getFont();
-	asBytes.setFont (font.deriveFont (Math.max (1, font.getSize2D() - 1)));
-
- 	SwingUtils.addComponent (howTo, htEndpoint, 0, 0, 2, 1, HORI, NWEST,  1.0, 0.0);
- 	SwingUtils.addComponent (howTo, htNewURL,   0, 1, 1, 1, NONE, NWEST,  0.0, 0.0);
- 	SwingUtils.addComponent (howTo, endpoint,   1, 1, 1, 1, HORI, NWEST,  1.0, 0.0);
- 	SwingUtils.addComponent (howTo, htRegistry, 0, 2, 2, 1, NONE, NWEST,  0.0, 0.0);
- 	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, 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
+	// determine button text from preferences
+	boolean usingPing = getPrefValue (DP_INP_PING, false);
+	boolean usingAsBytes = getPrefValue (DP_INP_ASBYTES, false);
+	String runLabel = " Call Service ";
+	if (usingPing) {
+		if (usingAsBytes) runLabel = " Ping and Show Input ";
+		else runLabel = " Ping Service ";
+	}
+	else {
+		if (usingAsBytes) runLabel = " Show Input ";
+	}		
+	
 	runButton =
-	    createButton (" Call service ",
+	    createButton (runLabel,
 			  "Invoke selected service",
 			  KeyEvent.VK_C,
 			  new ActionListener() {
@@ -324,6 +304,74 @@
 
 	JPanel buttonPanel = createButtonPanel (new JButton[] { runButton,
 								stopButton });
+	
+	JCheckBox asPing = createCheckBox
+	    ("'Ping' this service",
+	     usingPing, -1,
+	     new ItemListener() {
+		 public void itemStateChanged (ItemEvent e) {
+		     boolean enabled = (e.getStateChange() == ItemEvent.SELECTED);
+		     setPropertySelect (enabled, DP_INP_PING);
+		     setPrefValue (DP_INP_PING, enabled);
+		     propertyChannel.put (DP_INP_PING,
+					  new Boolean (enabled).toString());		     
+		     if (enabled) {
+		    	 if (propertyChannel.getString(DP_INP_ASBYTES).toLowerCase().equals("true"))
+		    		 runButton.setText(" Ping and Show Input ");
+		    	 else runButton.setText(" Ping Service ");
+		     }
+		     else {
+		    	 if (propertyChannel.getString(DP_INP_ASBYTES).toLowerCase().equals("true"))
+		    		 runButton.setText(" Show Input ");
+		    	 else runButton.setText(" Call Service ");
+		     }
+		 }
+	     });
+    setPropertySelect (usingPing, DP_INP_PING);
+    asPing.setToolTipText ("A Moby 'Ping' is used to determine if the service is responsive " +
+    		"and if it responds in an API-compliant manner.");
+	Font font = asPing.getFont();
+	asPing.setFont (font.deriveFont (Math.max (1, font.getSize2D() - 1)));	
+
+	JCheckBox asBytes = createCheckBox
+	    ("Send data to service as a byte array",
+	     usingAsBytes, -1,
+	     new ItemListener() {
+		 public void itemStateChanged (ItemEvent e) {
+		     boolean enabled = (e.getStateChange() == ItemEvent.SELECTED);
+		     setPropertySelect (enabled, DP_INP_ASBYTES);
+		     setPrefValue (DP_INP_ASBYTES, enabled);
+		     propertyChannel.put (DP_INP_ASBYTES,
+					  new Boolean (enabled).toString());		     
+		     if (enabled) {
+		    	 if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true"))
+		    		 runButton.setText(" Ping and Show Input ");
+		    	 else runButton.setText(" Show Input ");
+		     }
+		     else {
+		    	 if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true"))
+		    		 runButton.setText(" Ping Service ");
+		    	 else runButton.setText(" Call Service ");
+		     }
+		     
+		 }
+	     });
+    setPropertySelect (usingAsBytes, DP_INP_ASBYTES);
+        asBytes.setToolTipText ("It should not have any effect on result; it is for debugging");
+	font = asBytes.getFont();
+	asBytes.setFont (font.deriveFont (Math.max (1, font.getSize2D() - 1)));
+
+	
+ 	SwingUtils.addComponent (howTo, htEndpoint, 0, 0, 2, 1, HORI, NWEST,  1.0, 0.0);
+ 	SwingUtils.addComponent (howTo, htNewURL,   0, 1, 1, 1, NONE, NWEST,  0.0, 0.0);
+ 	SwingUtils.addComponent (howTo, endpoint,   1, 1, 1, 1, HORI, NWEST,  1.0, 0.0);
+ 	SwingUtils.addComponent (howTo, htRegistry, 0, 2, 2, 1, NONE, NWEST,  0.0, 0.0);
+ 	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, asPing,		0, 5, 2, 1, NONE, NWEST,  0.0, 0.0, BREATH_TOP);	
+ 	SwingUtils.addComponent (howTo, asBytes,    0, 6, 2, 1, NONE, NWEST,  0.0, 0.0);
+
 
 	Component glue = Box.createVerticalGlue();
  	SwingUtils.addComponent (p, selService,  0, 0, 1, 1, NONE, CENTER, 0.0, 0.0);
@@ -334,12 +382,11 @@
     }
 
     /**************************************************************************
-     * Select/unselect using 'send as bytes'...
+     * Select/unselect using 'send as bytes' or 'ping'...
      **************************************************************************/
-    protected void onAsBytes (boolean enabled) {
-	setPrefValue (DP_INP_ASBYTES, enabled);
-	propertyChannel.put (DP_INP_ASBYTES,
-			     new Boolean (enabled).toString());
+    protected void setPropertySelect (boolean enabled, String property) {
+    	setPrefValue (property, enabled);
+    	propertyChannel.put (property, new Boolean (enabled).toString());
     }
 
     /**************************************************************************
@@ -542,7 +589,7 @@
 		} 
 		
 		// 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))) {
+		if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) {
 			String emptyMsg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
 			"<moby:MOBY xmlns:moby=\"http://www.biomoby.org/moby\">\n" +
 			"  <moby:mobyContent />\n" +
@@ -576,7 +623,7 @@
 	    if (exception == null) {
 	    	
 			// handle results here (using renderers...)
-			if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) {
+			if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) {
 				propertyChannel.fire (DP_STATUS_MSG, service.getName()+" isAlive.");
 			} else {
 				propertyChannel.fire (DP_STATUS_MSG, "Service invocation finished.");
@@ -587,7 +634,7 @@
 			}
 
 	    } else {
-			if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) {
+			if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) {
 		    	propertyChannel.fire (DP_STATUS_MSG, service.getName()+" is dead.");
 				results.removeResults();
 			} else {




More information about the MOBY-guts mailing list