[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Thu Oct 26 01:31:25 UTC 2006


gordonp
Wed Oct 25 21:31:25 EDT 2006
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv15214/src/main/ca/ucalgary/seahawk/gui

Modified Files:
	MobyServicesGUI.java 
Log Message:
Got rid of redundant code
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyServicesGUI.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.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/MobyServicesGUI.java	2006/10/25 02:33:22	1.1
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyServicesGUI.java	2006/10/26 01:31:25	1.2
@@ -53,6 +53,7 @@
 
     public MobyServicesGUI() throws Exception{
 	mobyClient = new MobyClient();
+        mobyClient.setRequiredServiceLevel(MobyService.ALIVE);
 
 	mobyRequest = new MobyRequest(mobyClient.getMobyCentralImpl());
 	waitItem = new JMenuItem("Building data list, please wait...");
@@ -529,61 +530,76 @@
 	addClipboardItem(submenu, mobyData);
 	submenu.add(getWaitItem(submenu));
 
-	MobyService[] foundServices = null;
+// 	MobyService[] foundServices = null;
+// 	try{
+// 	    mobyData.setXmlMode(MobyDataInstance.CENTRAL_XML_MODE);
+// 	    //logger.debug("Querying central with: " + mobyData.toXML());
+// 	    MobyService templateService = new MobyService("");
+// 	    if(!(mobyData instanceof MobyData)){
+// 		logger.warn("MobyDataInstance implementer " + mobyData.getClass() + 
+// 			    " cannot be used to find services, it does not " +
+// 			    "inherit from MobyData as Central requires");
+// 	    }
+// 	    templateService.addInput((MobyData) mobyData);
+// 	    foundServices = mobyClient.getMobyCentralImpl().findService(templateService);
+// 	}
+// 	catch(Exception mobye){
+// 	    logger.error("Could not retrieve list of MobyServices from initialized MobyClient using the " +
+// 			       "MOBY data " + mobyData);mobye.printStackTrace();
+// 	    synchronized(popupList){
+// 		popupList.setVisible(false);
+// 		popupList.remove(waitItem);
+// 		if(submenu.isPopupMenuVisible()){
+// 		    submenu.setPopupMenuVisible(false);
+// 		    submenu.remove(getWaitItem(submenu));
+// 		    submenu.setPopupMenuVisible(true);
+// 		}
+// 		else{
+// 		    submenu.remove(getWaitItem(submenu));
+// 		}
+// 		popupList.setVisible(true);
+// 	    }
+// 	    return;
+// 	}
+// 	if(foundServices == null || foundServices.length == 0){
+// 	    popupList.setVisible(false);
+// 	    return;
+// 	}
+
+// 	// Let's make sure all of the services have their service type properly instantiated
+// 	// for ontology checks later on
+// 	for(int j = 0; j < foundServices.length; j++){
+// 	    foundServices[j].setServiceType(MobyServiceType.getServiceType(foundServices[j].getServiceType().getName()));
+// 	}
+
+ 	MobyDataServiceAssocInstance serviceAssocObject = null;  
+// 	//Services for only the one piece of data
 	try{
-	    mobyData.setXmlMode(MobyDataInstance.CENTRAL_XML_MODE);
-	    //logger.debug("Querying central with: " + mobyData.toXML());
-	    MobyService templateService = new MobyService("");
-	    if(!(mobyData instanceof MobyData)){
-		logger.warn("MobyDataInstance implementer " + mobyData.getClass() + 
-			    " cannot be used to find services, it does not " +
-			    "inherit from MobyData as Central requires");
+	    if(mobyData instanceof MobyDataObjectSet){
+		serviceAssocObject = mobyClient.getServices((MobyDataObjectSet) mobyData);
 	    }
-	    templateService.addInput((MobyData) mobyData);
-	    foundServices = mobyClient.getMobyCentralImpl().findService(templateService);
-	}
-	catch(Exception mobye){
-	    logger.error("Could not retrieve list of MobyServices from initialized MobyClient using the " +
-			       "MOBY data " + mobyData);mobye.printStackTrace();
-	    synchronized(popupList){
-		popupList.setVisible(false);
-		popupList.remove(waitItem);
-		if(submenu.isPopupMenuVisible()){
-		    submenu.setPopupMenuVisible(false);
-		    submenu.remove(getWaitItem(submenu));
-		    submenu.setPopupMenuVisible(true);
-		}
-		else{
-		    submenu.remove(getWaitItem(submenu));
-		}
-		popupList.setVisible(true);
+	    else if(mobyData instanceof MobyDataObject){
+		serviceAssocObject = mobyClient.getServices((MobyDataObject) mobyData);
 	    }
-	    return;
-	}
-	if(foundServices == null || foundServices.length == 0){
+	    else{
+		logger.warn("Service options for objects other than MobyDataObject " +
+			    "and MobyDataObjectSet are not yet supported.");
+		return;
+	    }
+	} catch(Exception mobye){
+ 	    logger.error("Could not retrieve list of MobyServices from initialized MobyClient using the " +
+			 "MOBY data " + mobyData);
+	    mobye.printStackTrace();
 	    popupList.setVisible(false);
 	    return;
 	}
 
-	// Let's make sure all of the services have their service type properly instatiated
-	// for ontology checks later on
-	for(int j = 0; j < foundServices.length; j++){
-	    foundServices[j].setServiceType(MobyServiceType.getServiceType(foundServices[j].getServiceType().getName()));
+	if(serviceAssocObject == null || serviceAssocObject.getServices() == null ||
+	   serviceAssocObject.getServices().length == 0){
+	    popupList.setVisible(false);
+ 	    return;
 	}
 
-	MobyDataServiceAssocInstance serviceAssocObject = null;  
-	//Services for only the one piece of data
-	if(mobyData instanceof MobyDataObjectSet){
-	    serviceAssocObject = new MobyDataObjectSetSAI((MobyDataObjectSet) mobyData, foundServices);
-	}
-	else if(mobyData instanceof MobyDataObject){
-	    serviceAssocObject = new MobyDataObjectSAI((MobyDataObject) mobyData, foundServices);
-	}
-	else{
-	    logger.warn("Service options for objects other than MobyDataObject " +
-			"and MobyDataObjectSet are not yet supported.");
-	    return;
-	}
 	addServicesToSubMenu(submenu, serviceAssocObject, handler);
     }
 




More information about the MOBY-guts mailing list