[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Thu Oct 26 00:36:16 UTC 2006


gordonp
Wed Oct 25 20:36:15 EDT 2006
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services
In directory dev.open-bio.org:/tmp/cvs-serv15063/src/main/ca/ucalgary/seahawk/services

Modified Files:
	MobyClient.java 
Log Message:
Got rid of redundant service lookup code
moby-live/Java/src/main/ca/ucalgary/seahawk/services MobyClient.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.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/services/MobyClient.java	2006/10/25 02:33:22	1.1
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java	2006/10/26 00:36:15	1.2
@@ -622,23 +622,51 @@
 	return (MobyDataObject[]) objectVector.toArray(new MobyDataObject[objectVector.size()]);
     }
 
+    public void setRequiredServiceLevel(int level){
+	serviceLevel = level;
+	System.err.println("Service level is now set to " + serviceLevel);
+    }
+
+    public MobyDataServiceAssocInstance getServices(MobyDataObjectSet mdos) throws MobyException{
+	return (getServices(new MobyDataObjectSet[]{mdos}))[0];
+    }
+
+    public MobyDataServiceAssocInstance getServices(MobyDataObject mdo) throws MobyException{
+	return (getServices(new MobyDataObject[]{mdo}))[0];
+    }
+
+    public MobyDataServiceAssocInstance[] getServices(MobyDataObjectSet[] mdoss) throws MobyException{ 
+	return getServices((MobyPrimaryData[]) mdoss);
+    }
+
     public MobyDataServiceAssocInstance[] getServices(MobyDataObject[] mdos) throws MobyException{ 
+	return getServices((MobyPrimaryData[]) mdos);
+    }
+
+    protected MobyDataServiceAssocInstance[] getServices(MobyPrimaryData[] mdos) throws MobyException{     
 	MobyDataServiceAssocInstance[] mobyDataServiceAssocInstances = new MobyDataServiceAssocInstance[mdos.length]; 
 
 	for(int i = 0; i < mdos.length; i++){
 	    MobyService templateServices = new MobyService("");
 	    templateServices.addInput(mdos[i]);
-	    //System.out.println("find services: ");
 	    MobyService[] mService = c.findService(templateServices);
 
 	    Vector<MobyService> filteredServices = new Vector();
 	    // Let's make sure all of the services have their service type properly instantiated
 	    // for ontology checks later on
 	    for(int j = 0; j < mService.length; j++){
+		MobyService service = MobyService.getService(mService[j].getName(), mService[j].getAuthority());
+		if(service != null){
+		    mService[j] = service;
+		}
+
 		mService[j].setServiceType(MobyServiceType.getServiceType(mService[j].getServiceType().getName()));
-		if(serviceLevel != MobyService.UNCHECKED && 
-		   ((mService[j].getStatus() & serviceLevel) >= serviceLevel)){
-		    filteredServices.add(mService[j]);		    
+		if(serviceLevel != MobyService.UNCHECKED){
+		    int serviceStatus = mService[j].getStatus();
+		    //System.err.println("Service " + mService[j].getName() + " has status " + serviceStatus);
+		    if((serviceStatus & serviceLevel) >= serviceLevel){
+			filteredServices.add(mService[j]);		    
+		    }
 		}
 	    }
 
@@ -646,7 +674,16 @@
 		mService = (MobyService []) filteredServices.toArray(new MobyService[filteredServices.size()]);
 	    }
 
-	    mobyDataServiceAssocInstances[i] = new MobyDataObjectSAI(mdos[i], mService);
+	    if(mdos[i] instanceof MobyDataObject){
+		mobyDataServiceAssocInstances[i] = new MobyDataObjectSAI((MobyDataObject) mdos[i], mService);
+	    }
+	    else if(mdos[i] instanceof MobyDataObjectSet){
+		mobyDataServiceAssocInstances[i] = new MobyDataObjectSetSAI((MobyDataObjectSet) mdos[i], mService);
+	    }
+	    else{
+		logger.warn("MobyClient could not handle service-associating an instance of " + mdos[i].getClass());
+		System.err.println("MobyClient could not handle service-associating an instance of " + mdos[i].getClass());
+	    }
 	}
 	return mobyDataServiceAssocInstances; 
     }




More information about the MOBY-guts mailing list