[MOBY-guts] biomoby commit

senger@ebi.ac.uk senger at pub.open-bio.org
Tue May 18 10:13:16 UTC 2004


senger
Tue May 18 06:13:16 EDT 2004
Update of /home/repository/moby/moby-live/Java/src/Clients
In directory pub.open-bio.org:/tmp/cvs-serv26265/src/Clients

Modified Files:
	MobyCmdLineClient.java 
Log Message:
improved finding services in MobyCmdLineClient

moby-live/Java/src/Clients MobyCmdLineClient.java,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/MobyCmdLineClient.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/Clients/MobyCmdLineClient.java	2003/11/25 13:18:10	1.3
+++ /home/repository/moby/moby-live/Java/src/Clients/MobyCmdLineClient.java	2004/05/18 10:13:16	1.4
@@ -443,25 +443,22 @@
 		    pattern.setAuthority (param.substring (pos+1));
 		    services = worker.findService (pattern);
 		}
-		if (services != null) {
-		    for (int i = 0; i < services.length; i++)
-			System.out.println (services[i]);
-		}
+		printServices (services, cmd.hasOption ("-on"));
 	    }
 	    if ((param = cmd.getParam ("-f")) != null ) {
 		decorationLn ("Looking for services related to: '" + param + "':");
 		decorationLn ("--------------------------------");
-		MobyService[] services = worker.findService (StringUtils.split (param, ","));
-		for (int i = 0; i < services.length; i++)
-		    System.out.println (services[i]);
+		printServices (worker.findService (StringUtils.split (param, ",")),
+			       cmd.hasOption ("-on"));
 	    }
 
 	    if ((param = cmd.getParam ("-ft")) != null ) {
 		decorationLn ("Looking for services of type '" + param + "':");
 		decorationLn ("----------------------------");
-		MobyService[] services = worker.findService (param);
-		for (int i = 0; i < services.length; i++)
-		    System.out.println (services[i]);
+		MobyService pattern = new MobyService ("dummy");
+		pattern.setType (param);
+		printServices (worker.findService (pattern, null, !cmd.hasOption ("-nc"), true),
+			       cmd.hasOption ("-on"));
 	    }
 
 	    if (cmd.hasParam ("-fs-type") || cmd.hasParam ("-fs-auth") ||
@@ -474,24 +471,30 @@
 		    String[] inputs = StringUtils.split (param, ",");
 		    for (int i = 0; i < inputs.length; i++) {
 			String[] parts = StringUtils.split (inputs[i], "=");
-			if (parts.length >= 2) {
-// 			    pattern.addInput (parts[0], parts[1]);
-			} else {
-// 			    pattern.addInput (parts[0], "");
-			}
+			MobyPrimaryDataSimple input = new MobyPrimaryDataSimple ("dummy");
+			input.setDataType (new MobyDataType (parts[0]));
+			if (parts.length >= 2)
+			    input.addNamespace (new MobyNamespace (parts[1]));
+			pattern.addInput (input);
 		    }
 		}
                 if ((param = cmd.getParam ("-fs-out")) != null ) {
 		    String[] outs = StringUtils.split (param, ",");
 		    for (int i = 0; i < outs.length; i++) {
+			MobyPrimaryDataSimple output = new MobyPrimaryDataSimple ("dummy");
+			output.setDataType (new MobyDataType (outs[i]));
+			pattern.addOutput (output);
 // 			pattern.addOutputType (outs [i]);
 		    }
 		}
 		decoration (pattern.toString());
 		decorationLn ("-----------------------------------------------");
-		MobyService[] services = worker.findService (pattern);
-		for (int i = 0; i < services.length; i++)
-		    System.out.println (services[i]);
+		boolean includeChildrenServiceTypes = !cmd.hasOption ("-nc");
+		boolean includeParentDataTypes = !cmd.hasOption ("-np");
+		printServices (worker.findService (pattern, null,
+						   includeChildrenServiceTypes,
+						   includeParentDataTypes),
+			       cmd.hasOption ("-on"));
 	    }
 
 	    //
@@ -560,4 +563,15 @@
 	}
     }
 
+    static void printServices (MobyService[] services, boolean onlyNames) {
+	if (services != null) {
+	    for (int i = 0; i < services.length; i++) {
+		if (onlyNames)
+		    System.out.println (services[i].getName());
+		else
+		    System.out.println (services[i]);
+	    }
+	}
+    }
+
 }




More information about the MOBY-guts mailing list