[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Fri Dec 14 23:04:31 UTC 2007


gordonp
Fri Dec 14 18:04:31 EST 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory dev.open-bio.org:/tmp/cvs-serv24821/src/main/org/biomoby/client

Modified Files:
	MobyRequest.java 
Log Message:
Got rid of unchecked type operations
moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.30,1.31
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java	2007/12/14 16:28:33	1.30
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java	2007/12/14 23:04:31	1.31
@@ -69,7 +69,7 @@
 
     // Used as invocation callback if MobyRequest is acting as a server,
     // or is executing services as a client asynchronously
-    private Vector eventHandlers; 
+    private Vector<MobyRequestEventHandler> eventHandlers; 
 
     /**
      * Default constructor.  You should have a Central instance around since you're going to 
@@ -82,7 +82,7 @@
 	mobyCentral = central;
 	wsdlCache = new Hashtable();
 
-	eventHandlers = new Vector();
+	eventHandlers = new Vector<MobyRequestEventHandler>();
 
 	DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 	dbf.setNamespaceAware(true);	
@@ -237,7 +237,7 @@
 	Iterator queryNames = inputData.keySet().iterator();
 	// For each query
 	while(queryNames.hasNext()){
-	    AbstractMap queryParams = (AbstractMap) inputData.get(queryNames.next());
+	    MobyDataJob queryParams = inputData.get(queryNames.next());
 	    // Set all the secondary params (overwrites any old ones)
 	    for(int i = 0; i < secondaryData.length; i++){
 		queryParams.put(secondaryData[i].getName(), secondaryData[i]);
@@ -317,7 +317,7 @@
 	// Essentially cloning, so removing ids doesn't change the 
 	// MobyContentInstance "data" (which we will use again later on)
 	MobyContentInstance finalContents = new MobyContentInstance();
-	Set<String> queryIDs = new HashSet(inData.keySet());
+	Set<String> queryIDs = new HashSet<String>(inData.keySet());
 	try {
 	    // Should add some timeout here...
 	    while(!queryIDs.isEmpty()){
@@ -875,10 +875,11 @@
 	// Make sure the number of input args is correct for each query being submitted
 	while(queries.hasNext()){
 	    String queryName = (String) queries.next();
-	    Map query = (Map) data.get(queryName);
+	    MobyDataJob query = data.get(queryName);
 
-	    HashMap primaryParams = new HashMap();
-	    HashMap secondaryParams = new HashMap();
+	    // Additionally, we check if they are MobyDataInstances below
+	    Map<String,MobyPrimaryData> primaryParams = new HashMap<String,MobyPrimaryData>();
+	    Map<String,MobySecondaryData> secondaryParams = new HashMap<String,MobySecondaryData>();
 
 	    Iterator params = query.keySet().iterator();
 	    // To store the primary input parameter name as given by the user, 
@@ -892,17 +893,22 @@
 		    throw new MobyException("Query " + queryName + 
 					    " contained a null input parameter (" + name + ")");
 		}
+		else if(!(param instanceof MobyDataInstance)){
+		    System.err.println("Input parameter " + name + " (query " + queryName +
+				       ") was not a MobyDataInstance " +
+				       "as expected, but rather was of class " + param.getClass().getName());
+		}
 		else if(param instanceof MobyPrimaryData){
-		    primaryParams.put(name, param);
+		    primaryParams.put(name, (MobyPrimaryData) param);
 		    primaryParamName = name;
 		}
 		else if(param instanceof MobySecondaryData){
-		    secondaryParams.put(name, param);
+		    secondaryParams.put(name, (MobySecondaryData) param);
 		}
 		else{
 		    System.err.println("Input parameter " + name + " (query " + queryName +
 				       ") was not a MobyPrimaryData or MobySecondaryData " +
-				       "as expected, but rather of class " + param.getClass().getName());
+				       "as expected, but rather was of class " + param.getClass().getName());
 		}
 	    }
 
@@ -932,7 +938,7 @@
 		    MobyPrimaryData theInputToRename = (MobyPrimaryData) query.remove(primaryParamName);
 
 		    // Add in the same parameter, but with the appropriate name
-		    query.put(serviceParamName, theInputToRename);
+		    query.put(serviceParamName, (MobyDataInstance) theInputToRename);
 		}
 	    }
 	}




More information about the MOBY-guts mailing list