[MOBY-guts] biomoby commit

Martin Senger senger at pub.open-bio.org
Thu Sep 22 16:07:09 UTC 2005


senger
Thu Sep 22 12:07:09 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared
In directory pub.open-bio.org:/tmp/cvs-serv17235/src/main/org/biomoby/shared

Modified Files:
	CentralDigest.java MobyDataType.java MobyNamespace.java 
	MobyPrimaryDataSet.java MobyPrimaryDataSimple.java 
	MobySecondaryData.java MobyService.java 
Log Message:


moby-live/Java/src/main/org/biomoby/shared CentralDigest.java,1.1,1.2 MobyDataType.java,1.7,1.8 MobyNamespace.java,1.1,1.2 MobyPrimaryDataSet.java,1.2,1.3 MobyPrimaryDataSimple.java,1.4,1.5 MobySecondaryData.java,1.3,1.4 MobyService.java,1.6,1.7
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/CentralDigest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/CentralDigest.java	2004/10/18 14:49:30	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/CentralDigest.java	2005/09/22 16:07:09	1.2
@@ -1,14 +1,16 @@
 // CentralDigest.java
 //
-//    senger at ebi.ac.uk
-//    September 2004
+// Created: September 2004
+//
+// This file is a component of the BioMoby project.
+// Copyright Martin Senger (martin.senger at gmail.com).
 //
 
 package org.biomoby.shared;
 
 /**
- * An interface to the cumulated (digested) contents of the Moby Registry.
- *<p>
+ * An interface to the cumulated (digested) contents of the Moby
+ * Registry. <p>
  *
  * The main purpose of this interface is for those clients that are
  * accessing the whole, or a substantial part of, Moby registry. The
@@ -16,7 +18,7 @@
  * registry API that allow to get more information in one go - saving
  * significantly network and time.  <p>
  *
- * @author <A HREF="mailto:senger at ebi.ac.uk">Martin Senger</A>
+ * @author <A HREF="mailto:martin.senger at gmail.com">Martin Senger</A>
  * @version $Id$
  */
 
@@ -44,6 +46,17 @@
 	throws MobyException;
 
     /*************************************************************************
+     * Get definition of all known namespaces. It differs from the
+     * {@link Central#getNamespaces} because it returns an array of
+     * full definitions of namespaces, and not just their names and
+     * descriptions. <p>
+     *
+     * @throws MobyException if communication with the Moby Registry fails
+     *************************************************************************/
+    MobyNamespace[] getFullNamespaces()
+	throws MobyException;
+
+    /*************************************************************************
      * Get definition of all registered service instances. It is a
      * cumulation of many individual calls to {@link
      * Central#findService(MobyService) findService by name} for all

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.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/shared/MobyDataType.java	2005/08/26 06:27:04	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java	2005/09/22 16:07:09	1.8
@@ -7,6 +7,7 @@
 
 package org.biomoby.shared;
 
+import org.tulsoft.shared.UUtils;
 
 
 /**
@@ -246,20 +247,27 @@
     public String toString() {
 	StringBuffer buf = new StringBuffer();
 	buf.append ("Name:    " + name + "\n");
-	buf.append ("Auth:    " + authority + "\n");
-	buf.append ("Desc:    " + description + "\n");
-	buf.append ("Contact: " + emailContact + "\n");
+	if (UUtils.notEmpty (authority))    buf.append ("Auth:    " + authority + "\n");
+	if (UUtils.notEmpty (description))  buf.append ("Desc:    " + description + "\n");
+	if (UUtils.notEmpty (emailContact)) buf.append ("Contact: " + emailContact + "\n");
 	if (id != null) buf.append ("ID:      " + id + "\n");
-	buf.append ("Parents:\n");
-	for (int i = 0 ; i < parentNames.length; i++) {
-	    buf.append (Utils.format (null, 1));
-	    buf.append (parentNames [i]);
+	if (parentNames.length > 0) {
+	    buf.append ("Parents: ");
+	    for (int i = 0 ; i < parentNames.length; i++) {
+		if (i > 0) buf.append (", ");
+		buf.append (parentNames [i]);
+	    }
 	    buf.append ("\n");
 	}
-	buf.append ("Children (only those registered here):\n");
-	for (int i = 0 ; i < children.length; i++) {
-	    buf.append (Utils.format (null, 1));
-	    buf.append (children[i].toString());
+	int chLen = children.length;
+	if (chLen > 0) {
+	    buf.append ("Children (only those registered here): ");
+	    if (chLen > 1)
+		buf.append ("\n");
+	    for (int i = 0 ; i < chLen; i++) {
+		if (i > 0) buf.append ("\n\t");
+		buf.append (children[i].toString());
+	    }
 	    buf.append ("\n");
 	}
 	return new String (buf);

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyNamespace.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyNamespace.java	2003/09/24 14:33:37	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyNamespace.java	2005/09/22 16:07:09	1.2
@@ -6,6 +6,7 @@
 //
 
 package org.biomoby.shared;
+import org.tulsoft.shared.UUtils;
 
 /**
  * A container representing a namespace used in the Moby registry.
@@ -69,10 +70,12 @@
 
     public String toString() {
 	StringBuffer buf = new StringBuffer();
-	buf.append ("Name:    " + name + "\n");
-	buf.append ("Auth:    " + authority + "\n");
-	buf.append ("Desc:    " + description + "\n");
-	buf.append ("ID:      " + id + "\n");
+	buf.append ("Name: " + name);
+	if (UUtils.notEmpty (authority))
+	    buf.append (", Auth: " + authority);
+	if (id != null) buf.append (", ID: " + id);
+	if (UUtils.notEmpty (description))
+	    buf.append ("\n\t" + description);
 	return new String (buf);
     }
     public String format (int indent) {

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.java	2005/04/07 16:37:02	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.java	2005/09/22 16:07:09	1.3
@@ -6,6 +6,8 @@
 
 package org.biomoby.shared;
 
+import org.tulsoft.shared.UUtils;
+
 import java.util.Enumeration;
 import java.util.Vector;
 
@@ -106,8 +108,9 @@
 
     public String toString() {
 	StringBuffer buf = new StringBuffer();
-	buf.append ("Name:    " + name + "\n");
-	buf.append ("ID:      " + id + "\n");
+	if (UUtils.notEmpty (name))
+	    buf.append ("Name:    " + name + "\n");
+	if (id != null) buf.append ("ID:      " + id + "\n");
 	buf.append ("Elements in collection:\n");
 	for (Enumeration en = elements.elements(); en.hasMoreElements(); ) {
 	    buf.append (((MobyPrimaryDataSimple)en.nextElement()).format (1));

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java	2005/04/07 16:37:02	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSimple.java	2005/09/22 16:07:09	1.5
@@ -6,6 +6,8 @@
 
 package org.biomoby.shared;
 
+import org.tulsoft.shared.UUtils;
+
 import java.util.Enumeration;
 import java.util.Vector;
 
@@ -130,15 +132,18 @@
 
     public String toString() {
 	StringBuffer buf = new StringBuffer();
-	buf.append ("Name:    " + name + "\n");
+	if (UUtils.notEmpty (name))
+	    buf.append ("Name:    " + name + "\n");
 	if (id != null) buf.append ("ID:      " + id + "\n");
 	if (dataType != null)
 	    buf.append ("Data Type:\n" + dataType.format (1));
-	buf.append ("Namespaces:\n");
-	for (Enumeration en = namespaces.elements(); en.hasMoreElements(); ) {
-	    buf.append (((MobyNamespace)en.nextElement()).format (1));
+	if (namespaces.size() > 0) {
+	    buf.append ("Namespaces:\n");
+	    for (Enumeration en = namespaces.elements(); en.hasMoreElements(); ) {
+		buf.append (((MobyNamespace)en.nextElement()).format (1));
+		buf.append ("\n");
+	    }
 	}
-	buf.append ("\n");
 	return new String (buf);
     }
 

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java	2005/04/19 17:58:49	1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobySecondaryData.java	2005/09/22 16:07:09	1.4
@@ -6,6 +6,8 @@
 
 package org.biomoby.shared;
 
+import org.tulsoft.shared.UUtils;
+
 import java.util.Enumeration;
 import java.util.Vector;
 
@@ -178,19 +180,23 @@
 
     public String toString() {
 	StringBuffer buf = new StringBuffer();
-	buf.append ("Name:      " + name + "\n");
-	buf.append ("ID:        " + id + "\n");
+	if (UUtils.notEmpty (name))
+	    buf.append ("Name:      " + name + "\n");
+	if (id != null) buf.append ("ID:        " + id + "\n");
 	buf.append ("Data Type: " + dataType + "\n");
-	buf.append ("Default:   " + defaultValue + "\n");
+	if (UUtils.notEmpty (defaultValue))
+	    buf.append ("Default:   " + defaultValue + "\n");
 	if (minimumValue != Integer.MIN_VALUE)
 	    buf.append ("Min:       " + minimumValue + "\n");
 	if (maximumValue != Integer.MAX_VALUE)
 	    buf.append ("Max:       " + maximumValue + "\n");
-	buf.append ("Allowed values: ");
-	for (Enumeration en = allowedValues.elements(); en.hasMoreElements(); ) {
-	    buf.append (en.nextElement() + " ");
+	if (allowedValues.size() > 0) {
+	    buf.append ("Allowed values: ");
+	    for (Enumeration en = allowedValues.elements(); en.hasMoreElements(); ) {
+		buf.append (en.nextElement() + " ");
+	    }
+	    buf.append ("\n");
 	}
-	buf.append ("\n");
 	return new String (buf);
     }
 }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.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/shared/MobyService.java	2005/08/26 06:27:04	1.6
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java	2005/09/22 16:07:09	1.7
@@ -7,6 +7,8 @@
 
 package org.biomoby.shared;
 
+import org.tulsoft.shared.UUtils;
+
 import java.util.Enumeration;
 import java.util.Vector;
 
@@ -70,6 +72,15 @@
 	setName (name);
     }
 
+    /**************************************************************************
+     * Even more normal constructor - because a service is fully
+     * qualified only by its name <b>and</b> its authority. <p>
+     *************************************************************************/
+    public MobyService (String name, String authority) {
+	setName (name);
+	setAuthority (authority);
+    }
+
     public String getUniqueName() {
 	return name + "/" + authority;
     }
@@ -302,24 +313,25 @@
 	buf.append ("Desc:          " + description + "\n");
 	buf.append ("URL:           " + url + "\n");
 	buf.append ("Contact:       " + emailContact + "\n");
-	buf.append ("Signature URL: " + signatureURL + "\n");
-	buf.append ("Path to RDF:   " + pathToRDF + "\n");
+	if (UUtils.notEmpty (signatureURL))
+	    buf.append ("Signature URL: " + signatureURL + "\n");
+	if (UUtils.notEmpty (pathToRDF))
+	    buf.append ("Path to RDF:   " + pathToRDF + "\n");
 	if (id != null) buf.append ("ID:            " + id + "\n");
 
-	buf.append ("\nPrimary inputs:\n");
+	buf.append ("Primary inputs:\n");
 	for (Enumeration en = primaryInputs.elements(); en.hasMoreElements(); )
 	    buf.append (((MobyData)en.nextElement()).format (1));
-	buf.append ("\n");
 
-	buf.append ("\nSecondary inputs:\n");
-	for (Enumeration en = secondaryInputs.elements(); en.hasMoreElements(); )
-	    buf.append (en.nextElement().toString());
-	buf.append ("\n");
+	if (secondaryInputs.size() > 0) {
+	    buf.append ("Secondary inputs:\n");
+	    for (Enumeration en = secondaryInputs.elements(); en.hasMoreElements(); )
+		buf.append (((MobyData)en.nextElement()).format (1));
+	}
 
-	buf.append ("\nOutputs:\n");
+	buf.append ("Outputs:\n");
 	for (Enumeration en = primaryOutputs.elements(); en.hasMoreElements(); )
-	    buf.append (en.nextElement().toString());
-	buf.append ("\n");
+	    buf.append (((MobyData)en.nextElement()).format (1));
 
 	return new String (buf);
     }




More information about the MOBY-guts mailing list