[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Wed Apr 14 23:48:27 UTC 2010


gordonp
Wed Apr 14 19:48:27 EDT 2010
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv9535/src/main/ca/ucalgary/seahawk/gui

Modified Files:
	MobyContentPane.java MobyPayloadCreator.java 
	MobyServicesGUI.java 
Log Message:
Additional commit related to initial implementation 'for each' in Seahawk service invocation
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentPane.java,1.27,1.28 MobyPayloadCreator.java,1.1,1.2 MobyServicesGUI.java,1.18,1.19
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java	2010/04/14 22:02:04	1.27
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java	2010/04/14 23:48:27	1.28
@@ -1215,7 +1215,6 @@
 	// chooses the for each option.  The Moby data instance's userData gives us the current context, enabling us 
         // to construct the correct payload in MobyPayloadCreator.createPayload() at any point in the future.
         String origUserData = (String) mobyData.getUserData();
-        MobyPayloadRequestListener payloadCreator = new MobyPayloadCreator(this);
         for(String peerMode: new String[]{DataUtils.ARTICLE_PEERS_MODE, DataUtils.DATATYPE_PEERS_MODE}){
             // note that getPeerElements() will modify the userData to reflect the semantic of the requested peer mode
             mobyData.setUserData(origUserData);
@@ -1229,17 +1228,20 @@
             }
             MobyDataType dataType = ((MobyPrimaryData) mobyData).getDataType();
             if(mobyData instanceof MobyPrimaryDataSet){	 // Collection
-                servicesGUI.addPopupOptions((MobyPrimaryDataSet) mobyData, popup, true, getDefaultHandler(), payloadCreator, 
-					    (String) mobyData.getUserData(), each);
+                servicesGUI.addPopupOptions((MobyPrimaryDataSet) mobyData, popup, true, getDefaultHandler(), 
+					    new MobyPayloadCreator(this, (String) mobyData.getUserData()), 
+					    each);
             }
             else if(MobyTags.MOBYOBJECT.equals(dataType.getName())){  
                 MobyNamespace namespace = null;
-                servicesGUI.addPopupOptions(namespace, popup, true, getDefaultHandler(), payloadCreator, 
-                                            (String) mobyData.getUserData(), each);
+                servicesGUI.addPopupOptions(namespace, popup, true, getDefaultHandler(),
+					    new MobyPayloadCreator(this, (String) mobyData.getUserData()), 
+                                            each);
             }
             else{
-                servicesGUI.addPopupOptions(dataType, popup, true, getDefaultHandler(), payloadCreator, 
-                                            (String) mobyData.getUserData(), each);
+                servicesGUI.addPopupOptions(dataType, popup, true, getDefaultHandler(),
+					    new MobyPayloadCreator(this, (String) mobyData.getUserData()), 
+                                            each);
             }
         }
 
@@ -1301,7 +1303,7 @@
 		// so PbE will properly reflect the logic of if(f1(x) matches filter){f2(x)}
 		DataUtils.addUserData(previousMDI, srcURL, getFilter());
 
-		servicesGUI.addPopupOptions(previousMDI, popup, true, null, "previous input");
+		servicesGUI.addPopupOptions(previousMDI, popup, true, null, null, "previous input");
 	    }
 	} catch(Exception e){
 	    logger.warn("Could not load previous service info, 'previous input' option will not be displayed", e);

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyPayloadCreator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyPayloadCreator.java	2010/04/14 22:02:04	1.1
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyPayloadCreator.java	2010/04/14 23:48:27	1.2
@@ -14,14 +14,16 @@
  */
 public class MobyPayloadCreator implements MobyPayloadRequestListener{
     private MobyContentPane srcPane;
+    private String requestKey;
 
     private static Logger logger = Logger.getLogger(MobyPayloadCreator.class.getName());
 
-    public MobyPayloadCreator(MobyContentPane pane){
+    public MobyPayloadCreator(MobyContentPane pane, String requestKey){
         srcPane = pane;
+	this.requestKey = requestKey;
     }
 
-    public MobyContentInstance createPayload(String requestKey, String targetJobArgName){
+    public MobyContentInstance createPayload(String targetJobArgName){
 	// The request key is the sample data's app context: 
         // url#xpath <tab> sample_xptr <tab> filter_regex <tab> filter_xpath <tab> xpath_desc <tab> case_sensitive_boolean <tab> inverse selection
         // from which we will build the peer dataset to submit.

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java	2010/04/14 22:02:04	1.18
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java	2010/04/14 23:48:27	1.19
@@ -586,30 +586,6 @@
     }
 
     /**
-     * Creates a menu item based on the provided data type.  If a service is selected from here,
-     * a callback will be made to the MobyPayloadRequestListener for the actual submission data.
-     *
-     * @param payloadKey a key that will be used in the callback so the listener knows what payload the create
-     */
-    public void addPopupOptions(MobyDataType mobyDataType, JPopupMenu popupList, boolean asynchronous, 
-                                MobyRequestEventHandler handler, MobyPayloadRequestListener payloadCreator, 
-                                String payloadKey, String extraMenuText){
-        addPopupOptions(mobyDataType, popupList, asynchronous, handler, payloadCreator, extraMenuText);
-    }
-
-    public void addPopupOptions(MobyNamespace mobyNamespace, JPopupMenu popupList, boolean asynchronous, 
-                                MobyRequestEventHandler handler, MobyPayloadRequestListener payloadCreator, 
-                                String payloadKey, String extraMenuText){
-        addPopupOptions(mobyNamespace, popupList, asynchronous, handler, payloadCreator, extraMenuText);
-    }
-
-    public void addPopupOptions(MobyPrimaryDataSet collection, JPopupMenu popupList, boolean asynchronous, 
-                                MobyRequestEventHandler handler, MobyPayloadRequestListener payloadCreator, 
-                                String payloadKey, String extraMenuText){
-        addPopupOptions(collection, popupList, asynchronous, handler, payloadCreator, extraMenuText);
-    }
-
-    /**
      * Same as three arg addPopupOptions, but uses default response handler
      */
     public void addPopupOptions(MobyDataInstance mobyData, JPopupMenu popupList, boolean asynchronous){
@@ -678,16 +654,32 @@
 	    }
             // The data will be loaded later
             else if(payloadCreator != null){
-                if(mobyData instanceof MobyPrimaryDataSet){
-                    //serviceAssocObject = mobyClient.getServices(new MobyDataObjectSetDeferred(mobyData, payloadCreator, requestKey));
-                }
-                else{
-                    //serviceAssocObject = mobyClient.getServices(new MobyDataObjectDeferred(mobyData, payloadCreator, requestKey));
-                }
+                try{
+                    if(mobyData instanceof MobyPrimaryDataSet){
+			serviceAssocObject = mobyClient.getServices(new MobyDataObjectSetDeferred((MobyPrimaryDataSet) mobyData, 
+												  payloadCreator));
+		    }
+		    else if(mobyData instanceof MobyNamespace){
+			serviceAssocObject = mobyClient.getServices(new MobyDataObjectDeferred((MobyNamespace) mobyData, 
+											       payloadCreator));
+		    }
+		    else if(mobyData instanceof MobyDataType){
+			serviceAssocObject = mobyClient.getServices(new MobyDataObjectDeferred((MobyDataType) mobyData, 
+											       payloadCreator));
+		    }
+		    else{
+			logger.warn("Ignoring unrecognized template class (" + mobyData.getClass().getName()+
+				    ") for deferred data creation by a MobyPayloadRequestListener"); 
+			return;
+		    }
+		} catch(Exception e){
+		    logger.error("Could not create deferred Moby data object", e);
+		}
             }
 	    else{
 		logger.warn("Service options for objects other than MobyDataObject " +
-			    "and MobyDataObjectSet are not yet supported.");
+			    "and MobyDataObjectSet are not yet supported unless you " +
+			    "have defined a MobyPayloadRequestListener.");
 		return;
 	    }
 	} catch(Exception mobye){




More information about the MOBY-guts mailing list