[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Thu May 13 16:10:06 UTC 2010


gordonp
Thu May 13 12:10:06 EDT 2010
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv29249/src/main/ca/ucalgary/seahawk/gui

Modified Files:
	MobyServicesGUI.java 
Log Message:
Proper support for when no primary data instances have been specified.  Public method to launch input GUI.
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyServicesGUI.java,1.24,1.25
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java	2010/04/26 16:27:31	1.24
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java	2010/05/13 16:10:06	1.25
@@ -253,8 +253,15 @@
         }
     }
 
+    /**
+     * Call the service given, or first launch a GUI to get missing input data if not provided in the MobyDataInstance.
+     */
+    public void setupService(MobyService mobyService, MobyDataInstance mdi, MobyRequestEventHandler mreh){
+	setupService(mobyService, mdi, mreh == null ? mobyRequestEventHandler.hashCode() : mreh.hashCode(), false);
+    }
+
     protected void setupService(MobyService mobyService, MobyDataInstance mdi, int handlerHashCode, boolean useDefaultSecondaries){
-	if(!(mdi instanceof MobyPrimaryData)){
+	if(mdi != null && !(mdi instanceof MobyPrimaryData)){
 	    logger.error("Failure in MOBY input, was not primary data as expected, but rather "+mdi.getClass().getName());
 	    return;
 	}
@@ -265,7 +272,7 @@
 	primaryInput = new MobyPrimaryData[primaryInputTemplate.length];
 	System.arraycopy(primaryInputTemplate, 0, primaryInput, 0, primaryInput.length);
 
-	if(!hasSecondaryInput(mobyService)){
+	if(!hasSecondaryInput(mobyService) && primaryInput.length == 1 && mdi != null){
             // code from mobyRequest.setInput() to executeService() should always be synced to avoid input mixup between requests
             synchronized(mobyRequest){
 	        try{
@@ -286,15 +293,16 @@
 	        removePopupOptions();
 	        executeService(getHandlerByHashCode(handlerHashCode));
             }
+	    return;
 	}
-	else{
-	    // We need more info from the user to launch this service
-	    //logger.warn("Need to get secondary parameters: " + secondaryInputTemplate.getClass());
-	    MobyService metaDataMobyService = MobyService.getService(mobyService.getName(), mobyService.getAuthority());
-
-	    // We need to figure out where the provided data instance goes into the parameter list for the service
-	    Vector<String> paramMatch = new Vector<String>();
-	    int paramMatchDefault = 0;
+	// else we need more info from the user to launch this service
+	//logger.warn("Need to get secondary parameters: " + secondaryInputTemplate.getClass());
+	MobyService metaDataMobyService = MobyService.getService(mobyService.getName(), mobyService.getAuthority());
+	
+	// We need to figure out where the provided data instance goes into the parameter list for the service
+	Vector<String> paramMatch = new Vector<String>();
+	int paramMatchDefault = 0;
+	if(mdi != null){
 	    MobyDataType providedDataType = ((MobyPrimaryData) mdi).getDataType();
 	    for(MobyPrimaryData input: primaryInput){
 		if(providedDataType.inheritsFrom(input.getDataType())){
@@ -306,7 +314,7 @@
 			     ") to any service param for service "+mobyService.getName());
 		return;
 	    }
-
+	    
 	    String targetParamName = paramMatch.elementAt(0);
 	    // Need to choose among multiple parameters	    
 	    if(paramMatch.size() > 1){
@@ -326,11 +334,11 @@
 		    primaryInput[i] = (MobyPrimaryData) mdi;
 		}
 	    }
-
-	    // We need to create the secondary parameters too, and launch the dialog to fill in the
-	    // uninstantiated data.
-	    getSecondaryInput(metaDataMobyService, handlerHashCode, useDefaultSecondaries);
-	}
+	} //end if mdi != null
+	
+	// We need to create the secondary parameters too, and launch the dialog to fill in the
+	// uninstantiated data.
+	getSecondaryInput(metaDataMobyService, handlerHashCode, useDefaultSecondaries);
     }
 
     // True if there are secondaries, or more than one primary input 
@@ -417,7 +425,7 @@
     /**
      * If a service is invoked by this class, the event handler registered here will 
      * get a callback when the response is ready for display (MobyServicesGUI does not
-     * display service results, this is its way of delegating that responsability).
+     * display service results, this is its way of delegating that responsibility).
      */
     public void setResponseHandler(MobyRequestEventHandler mreh){
 	mobyRequestEventHandler = mreh;




More information about the MOBY-guts mailing list