[MOBY-guts] biomoby commit

Martin Senger senger at dev.open-bio.org
Mon Mar 3 11:34:17 UTC 2008


senger
Mon Mar  3 06:34:17 EST 2008
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator
In directory dev.open-bio.org:/tmp/cvs-serv3170/src/main/org/biomoby/service/generator

Modified Files:
	DataTypesGenerator.java Generator.java ServicesGenerator.java 
Log Message:
* more work on junit testing and its infrastructure
* removing some compiler warnings from generated data types
* better use of caching in skeleton generator

moby-live/Java/src/main/org/biomoby/service/generator DataTypesGenerator.java,1.6,1.7 Generator.java,1.5,1.6 ServicesGenerator.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/DataTypesGenerator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/DataTypesGenerator.java	2008/03/02 12:45:26	1.6
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/DataTypesGenerator.java	2008/03/03 11:34:17	1.7
@@ -18,6 +18,8 @@
 import org.biomoby.client.FilterDataTypes;
 import org.biomoby.client.Graphviz;
 
+import org.apache.commons.lang.BooleanUtils;
+
 import java.util.Properties;
 import java.util.Map;
 import java.util.HashMap;
@@ -171,7 +173,7 @@
     public void generate (Properties props)
 	throws MobyException {
 
-	verbose = isTrue (props.get (GPROP_VERBOSE));
+	verbose = BooleanUtils.toBoolean (props.getProperty (GPROP_VERBOSE));
 
 	Pattern pattern = null;
 	String filter = props.getProperty (GPROP_FILTER);
@@ -245,7 +247,7 @@
 	throws MobyException {
 
 	String dataTypeName = Utils.pureName (dataType.getName());
-	if (isTrue (props.get (GPROP_NOGEN))) {
+	if (BooleanUtils.toBoolean (props.getProperty (GPROP_NOGEN))) {
 	    System.out.println (dataTypeName);
 	    return;
 	}
@@ -459,7 +461,8 @@
 				   MobyDataType[] allDataTypes,
 				   StringBuffer spaceForImageMap) {
 
-	if (isTrue (props.get (GPROP_NOGRAPHS))) return false;
+	if (BooleanUtils.toBoolean (props.getProperty (GPROP_NOGRAPHS)))
+	    return false;
 
 	MobyDataType[] subTree = FilterDataTypes.getSubTree (dataType,
 							     allDataTypes);

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/Generator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/Generator.java	2008/03/02 12:45:26	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/Generator.java	2008/03/03 11:34:17	1.6
@@ -17,6 +17,8 @@
 import org.biomoby.shared.Utils;
 import org.biomoby.client.CentralDigestCachedImpl;
 
+import org.apache.commons.lang.BooleanUtils;
+
 import java.util.Properties;
 import java.util.Map;
 import java.util.regex.Pattern;
@@ -220,13 +222,6 @@
     }
 
     /*************************************************************************
-     * Read a boolean property...
-     *************************************************************************/
-    protected static boolean isTrue (Object value) {
-	return new Boolean ((String)value).booleanValue();
-    }
-
-    /*************************************************************************
      * Format who generated this...
      *************************************************************************/
     protected static String getSignature() {
@@ -293,7 +288,8 @@
      *************************************************************************/
     protected void makeDirForGraphs (File outputDir, Properties props) {
 
-	if (isTrue (props.get (GPROP_NOGRAPHS))) return;
+	if (BooleanUtils.toBoolean (props.getProperty (GPROP_NOGRAPHS)))
+	    return;
 
 	File graphDir = new File (outputDir, "doc-files");
 	if (! graphDir.exists()) {

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/ServicesGenerator.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/ServicesGenerator.java	2008/03/02 12:45:26	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/generator/ServicesGenerator.java	2008/03/03 11:34:17	1.8
@@ -27,6 +27,7 @@
 
 import org.tulsoft.tools.servlets.Html;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.BooleanUtils;
 
 import java.util.Properties;
 import java.util.Iterator;
@@ -192,7 +193,7 @@
     public void generate (Properties props)
 	throws MobyException {
 
-	verbose = isTrue (props.get (GPROP_VERBOSE));
+	verbose = BooleanUtils.toBoolean (props.getProperty (GPROP_VERBOSE));
 
 	// compile patterns for filtering by service and authority names
 	Pattern wantedService = null;
@@ -225,7 +226,8 @@
 	// conditionally, read all data types (also from a registry)
 	MobyDataType[] allDataTypes = null;
 	MobyService[] allServices = null;
-	if (! isTrue (props.get (GPROP_NOGRAPHS))) {
+	if (worker.isUsingCache() ||
+	    ! BooleanUtils.toBoolean (props.getProperty (GPROP_NOGRAPHS))) {
 	    if (verbose)
 		System.out.println ("Reading data type definitions...");
 	    allDataTypes = worker.getDataTypes();
@@ -277,7 +279,7 @@
 	    return;
 	}
 
-	if (isTrue (props.get (GPROP_NOGEN))) {
+	if (BooleanUtils.toBoolean (props.getProperty (GPROP_NOGEN))) {
 	    System.out.println (service.toShortString());
 	    return;
 	}
@@ -569,9 +571,9 @@
     /**************************************************************************
      * Return services that match 'patternService'. You can take an
      * advantage of already collected all services in 'allServices' if
-     * it is not null (it is null if graphs are not required,
-     * BTW). If it is null, however, do a normal way: go to a registry
-     * using given 'worker'.
+     * it is not null (it is null if a local cache is not used, or if
+     * graphs are not required). If it is null, however, do a normal
+     * way: go to a registry using given 'worker'.
      *
      * Note that 'patternService' has filled only service and
      * authority name (and both are guaranteed not to be null), so
@@ -581,8 +583,8 @@
 					 CentralCached worker,
 					 MobyService[] allServices)
 	throws MobyException {
-	if (allServices == null)
-	    return worker.findService (patternService);
+ 	if (allServices == null)
+ 	    return worker.findService (patternService);
 	Vector<MobyService> v = new Vector<MobyService>();
 	String name = patternService.getName();
 	String auth = patternService.getAuthority();
@@ -612,7 +614,10 @@
 				   MobyService[] allServices,
 				   MobyDataType[] allDataTypes) {
 
-	if (isTrue (props.get (GPROP_NOGRAPHS))) return false;
+	if (BooleanUtils.toBoolean (props.getProperty (GPROP_NOGRAPHS)))
+	    return false;
+	if (allServices == null || allDataTypes == null)
+	    return false;
 
 	ServicesEdge[] edges
 	    = ServiceConnections.build (allDataTypes, allServices);




More information about the MOBY-guts mailing list