[MOBY-guts] biomoby commit

Paul Gordon gordonp at pub.open-bio.org
Fri Apr 15 21:34:41 UTC 2005


gordonp
Fri Apr 15 17:34:40 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared
In directory pub.open-bio.org:/tmp/cvs-serv17821

Modified Files:
	MobyDataDateTime.java MobyDataFloat.java MobyDataInstance.java 
	MobyDataInt.java MobyDataSetInstance.java 
	MobyDataSimpleInstance.java MobyDataString.java 
Log Message:
Changes made to accomodate XML mode setting for ALL MobyDataInstances, plus implementation of MobyDataSetInstance as a Collection

moby-live/Java/src/main/org/biomoby/shared MobyDataDateTime.java,1.3,1.4 MobyDataFloat.java,1.5,1.6 MobyDataInstance.java,1.1,1.2 MobyDataInt.java,1.3,1.4 MobyDataSetInstance.java,1.1,1.2 MobyDataSimpleInstance.java,1.7,1.8 MobyDataString.java,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataDateTime.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/MobyDataDateTime.java	2005/04/07 22:28:40	1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataDateTime.java	2005/04/15 21:34:40	1.4
@@ -274,7 +274,7 @@
      */
     public String toXML(){
 	MobyNamespace[] ns = getNamespaces();
-	if(xmlMode == SERVICE_XML_MODE){
+	if(xmlMode == MobyDataInstance.SERVICE_XML_MODE){
 	    return "<moby:DateTime moby:namespace=\""+ 
 		(ns != null && ns.length < 0 ? ns[0].getName() : "")+ 
 		 "\" moby:id=\"" + (getId() != null ? getId() : "") + "\" " +

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataFloat.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/shared/MobyDataFloat.java	2005/04/07 21:00:06	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataFloat.java	2005/04/15 21:34:40	1.6
@@ -16,7 +16,7 @@
     
     /**
      * Constructor to use if the incoming value is a number object such as 
-     * Float, Double, iNTeger, BigDecimal, etc.
+     * Float, Double, Integer, BigDecimal, etc.
      */
     public MobyDataFloat(String articleName, Number n){
 	super(articleName);
@@ -86,7 +86,7 @@
 
     public String toXML(){
 	MobyNamespace[] ns = getNamespaces();
-	if(xmlMode == SERVICE_XML_MODE){
+	if(xmlMode == MobyDataInstance.SERVICE_XML_MODE){
 	    
 	    return "<moby:Float moby:namespace=\""+ 
 		(ns != null && ns.length < 0 ? ns[0].getName() : "")+ 

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataInstance.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/MobyDataInstance.java	2004/04/21 17:26:46	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataInstance.java	2005/04/15 21:34:40	1.2
@@ -7,8 +7,26 @@
 
 public interface MobyDataInstance{
 
+    public static final int CENTRAL_XML_MODE = 124;
+    public static final int SERVICE_XML_MODE = 891;
+
     /**
      * Returns the MOBY XML representation of the object.
      */
     public String toXML();
+
+    /**
+     * Determined whether toXML will return a Central template value or a service call instance value.
+     *
+     * @param mode one of CENTRAL_XML_MODE or SERVICE_XML_MODE
+     * @throws IllegalArgumentException if the mode is not one of the specified values
+     */
+    public void setXmlMode(int mode) throws IllegalArgumentException;
+
+   /**
+     * Report whether toXML will produce Central template or service call instance XML.
+     *
+     * @return one of CENTRAL_XML_MODE or SERVICE_XML_MODE
+     */
+    public int getXmlMode();
 }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataInt.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/MobyDataInt.java	2005/04/07 16:37:02	1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataInt.java	2005/04/15 21:34:40	1.4
@@ -76,7 +76,7 @@
 
     public String toXML(){
 	MobyNamespace[] ns = getNamespaces();
-	if(xmlMode == SERVICE_XML_MODE){
+	if(xmlMode == MobyDataInstance.SERVICE_XML_MODE){
 	    
 	    return "<moby:Integer moby:namespace=\""+ 
 		(ns != null && ns.length < 0 ? ns[0].getName() : "")+ 

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataSetInstance.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/MobyDataSetInstance.java	2004/04/21 17:26:46	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataSetInstance.java	2005/04/15 21:34:40	1.2
@@ -1,41 +1,380 @@
 package org.biomoby.shared;
 
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
 /**
- * This class simply adds to MobyPrimaryDataSet the ability to get and set instantiated Simple objects.
+ * This class adds to MobyPrimaryDataSet the ability to get and set instantiated Simple objects.
+ * The MOBY Collection concept that this class embodies is a mathematical bag, i.e. it can contain the
+ * same value more than once.  This class implements java.util.Collection to facilitate the manipulation
+ * of the bag, enforcing that all members of the bag be non-null, MobyDataSimpleInstances objects.
+ * The collection can be empty, but never null.
+ *
+ * NOTE: The order of members of the collection is meaningless, and may change throughout the 
+ * life of this object. Do not rely on the order of the items at any time!
+ *
+ * This class uses a Vector to hold the bag elements and implement most Collection functions.
  */
-public class MobyDataSetInstance extends MobyPrimaryDataSet implements MobyDataInstance{
+public class MobyDataSetInstance extends MobyPrimaryDataSet implements MobyDataInstance, Collection{
 
-    MobyDataSimpleInstance[] set = null;
+    Vector bag;
+    private int xmlMode = MobyDataInstance.SERVICE_XML_MODE;
     
+    /**
+     * Creates an empty collection bag with a name.
+     */
     public MobyDataSetInstance(String name){
 	super(name);
+	bag = new Vector();
     }
 
-    public MobyDataSetInstance(String name, MobyDataSimpleInstance[] values){
+    /**
+     * Creates a collection with a name, initializing the members with the given array
+     *
+     * @throw NullPointerException if the input array is null, or contains null elements
+     */
+    public MobyDataSetInstance(String name, MobyDataSimpleInstance[] values) throws NullPointerException{
 	this(name);
 	setElements(values);
     }
 
-    public void setElements(MobyDataSimpleInstance[] values){
-	set = values;
+    /**
+     * Creates a collection with a name, initializing the members with the members of the given collection.
+     *
+     * @param c usually another MobyDataSetInstance, or a Vector of MobyDataSetInstances
+     *
+     * @throw ClassCastException if a member of the input collection is not a MobyDataSimpleInstance
+     * @throw NullPointerException if the collection or one of its members is a null object
+     */
+    public MobyDataSetInstance(String name, Collection c) throws ClassCastException, NullPointerException{
+	this(name);
+	addAll(c);
     }
 
+    /**
+     * Replace whatever is in the collection right now with the values in the input array.
+     *
+     * @throw NullPointerException if the input array is null, or contains null elements
+     */
+    public void setElements(MobyDataSimpleInstance[] values) throws NullPointerException{
+	if(values == null){
+	    throw new NullPointerException("An attempt was made to set a  MobyDataSetInstance's members " +
+					   "from a null array, which is disallowed");
+	}
+
+	for(int i = 0; i < values.length; i++){
+	    if(values[i] == null){
+		throw new NullPointerException("An attempt was made to set a MobyDataSetInstance's members " +
+					       "from an array, but the element at index " + i + 
+					       " was null, which is disallowed.");
+	    }
+	}
+
+	// The array is okay if it got this far
+	bag.clear();
+	for(int i = 0; i < values.length; i++){
+	    bag.add(values[i]);
+	}
+    }
+    
+    /**
+     * @return the MobyDataSimpleInstances that comprise the collection
+     */
     public MobyDataSimpleInstance[] getElementInstances(){
-	return set;
+	return (MobyDataSimpleInstance[]) bag.toArray();
+    }
+    
+    private void checkInputClass(String action, Object mdsi) throws ClassCastException, NullPointerException{
+	if(mdsi == null){
+	    throw new NullPointerException("An attempt to " + action + " a null object was made, but null " +
+					   "objects are disallowed in MobyDataSetInstance collections.");
+	}
+	if(!(mdsi instanceof MobyDataSimpleInstance)){
+	    throw new ClassCastException("The MobyDataSetInstance collection can only " +
+					 "contain MobyDataSimpleInstance objects, but an " +
+					 "attempt to " + action + " a " + mdsi.getClass().getName() + 
+					 "was made.");
+	}
+    }
+
+    private void checkCollectionClass(String action, Collection c) throws ClassCastException, NullPointerException{
+	if(c == null){
+	    throw new NullPointerException("An attempt to " + action + " a null collection was made, but null " +
+					   "collection operations in MobyDataSetInstance are disallowed.");
+	}
+
+	// Make sure all of the elements in the collection are MobyDataSimpleInstances
+	Iterator iterator = c.iterator();
+	while(iterator.hasNext()){
+	    Object element = iterator.next();
+	    if(!(element instanceof MobyDataSimpleInstance)){
+		throw new ClassCastException("Attempted to " + action + " a " + element.getClass().getName() +
+					     "to a MobyDataSetInstance as part of a collection (" +
+					     c.getClass().getName() + "), which is disallowed");
+	    }
+	}
+    }
+
+    /**
+     * Add a single MobyDataSimpleInstance to the collection.
+     *
+     * @throw ClassCastException if the input is not a MobyDataSimpleInstance
+     * @throw NullPointerException if the input is a null object
+     */
+    public boolean add(Object mdsi) throws ClassCastException, NullPointerException{
+	checkInputClass("add", mdsi);
+
+	return bag.add(mdsi);
+    }
+    
+    /**
+     * Convenient way to add the input collection of MobyDataSimpleInstances 
+     * (usually a MobyDataSetInstance, or a Vector of MobyDataSimpleInstances) 
+     * to this collection.
+     *
+     * @throw ClassCastException if a member of the input collection is not a MobyDataSimpleInstance
+     * @throw NullPointerException if the collection or one of its members is a null object
+     * @return true if the collection changes as a result of the operation
+     */
+    public boolean addAll(Collection c) throws ClassCastException, NullPointerException{
+	checkCollectionClass("add", c);
+	
+	return bag.addAll(c);
     }
 
     /**
+     * Removes all of the MobyDataSimpleInstance elements from this collection.
+     */
+    public void clear(){
+	bag.clear();
+    }
+
+    /**
+     * @return true if this collection contains an element with the exact same value (equivalent in MOBY XML representation, including name)
+     * @throw ClassCastException if the input is not a MobyDataSimpleInstance
+     * @throw NullPointerException if the input is a null object
+     */
+    public boolean contains(Object mdsi) throws ClassCastException, NullPointerException{
+	checkInputClass("check for the presence of", mdsi);
+
+	return bag.contains(mdsi);
+    }
+
+    /**
+     * @return true if each element in the input collection returns true when contains(Object o) is called
+     * @throw ClassCastException if a member of the input collection is not a MobyDataSimpleInstance
+     * @throw NullPointerException if the collection or one of its members is a null object
+     */
+    public boolean containsAll(Collection c) throws ClassCastException, NullPointerException{
+	checkCollectionClass("check for presence of", c);
+	
+	return bag.containsAll(c);
+    }
+
+    /**
+     * Compare two MobyDataSimpleInstances collections.  Note that this may be a very expensive 
+     * operation if the lists are long, the equals() method is complicated, or collection is hard
+     * to convert into an array for sorting.
+     *
+     * @return true if and only if the input object is a MobyDataSetInstance, and the two collections contain exactly equal elements from a MOBY XML perspective
+     * @throw ClassCastException if the input is not a Collection of MobyDataSimpleInstances
+     * @throw NullPointerException if the input is a null object
+     */
+    public boolean equals(Object set) throws ClassCastException, NullPointerException{
+	if(!(set instanceof Collection)){
+	    throw new ClassCastException("An attempt to check the equivalency of a " + set.getClass().getName() +
+					 " to a MobyDataSetInstance was made, but that class is not a Collection.");
+	}
+
+	checkInputClass("check for equivalency of", set);
+
+	// Normally we cannot simple use the Vector class equals method, because it requires the objects to 
+	// be in the same order in both lists.  Element order in MOBY collections does not affect semantic equivalency.
+	// Luckily, MobyDataSimpleInstances are Comparable, which means that we can sort them. Only if someone calls 
+	// this method will we bother sorting the Vector.
+
+	MobyDataSimpleInstance[] mdsis = getElementInstances();
+	Arrays.sort(mdsis);
+
+	// This only works because we know internally to the class that setElements() doesn't 
+	// reorder the elements passed in.
+	// If we wanted to be really efficient, we might keep a variable around saying whether the list
+	// is already sorted or not.  Maybe later.
+	setElements(mdsis); //now bag has a sorted members list
+
+	MobyDataSimpleInstance[] inputMdsis = (MobyDataSimpleInstance[]) ((Collection) set).toArray();
+	Arrays.sort(inputMdsis);
+	Vector sortedInput = new Vector();
+	for(int i = 0; i < inputMdsis.length; i++){
+	    sortedInput.add(inputMdsis[i]);
+	}	
+
+	return bag.equals(new Vector(sortedInput));
+    }
+	
+    /**
+     * Implemented solely because of the general contract that c1.equals(c2) implies that c1.hashCode()==c2.hashCode()
+     */
+    public int hashCode(){
+	return super.hashCode();
+    }
+
+    /**
+     * Logically equivalent to size() == 0.
+     */
+    public boolean isEmpty(){
+	return bag.isEmpty();
+    }
+
+    /**
+     * @return an iterator over the non-null MobyDataSimpleInstances in this collection
+     */
+    public Iterator iterator(){
+	return bag.iterator();
+    }
+
+    /**
+     * Removes a single instance of an element from this collection, if it satisfies mdsi.equals().
+     * 
+     * @param mdsi the MobyDataSimpleInstance whose value equivalent (not object reference) is to be removed
+     * @return true if the element was found and removed
+     * @throw ClassCastException if the input is not a MobyDataSimpleInstance
+     * @throw NullPointerException if the input is a null object
+     */
+    public boolean remove(Object mdsi) throws ClassCastException, NullPointerException{
+	checkInputClass("remove", mdsi);
+
+	return bag.remove(mdsi);
+    }
+
+    /**
+     * Set theory subtraction operator implementation.
+     *
+     * @return true if this collection changed as a result of the call
+     * @throw ClassCastException if a member of the input collection is not a MobyDataSimpleInstance
+     * @throw NullPointerException if the collection or one of its members is a null object
+     */
+    public boolean removeAll(Collection c) throws ClassCastException, NullPointerException{
+	checkCollectionClass("remove", c);
+
+	return bag.removeAll(c);
+    }
+
+    /**
+     * Set theory intersection operator implementation.
+     * 
+     * @return true if this collection changed as a result of the call
+     * @throw ClassCastException if a member of the input collection is not a MobyDataSimpleInstance
+     * @throw NullPointerException if the collection or one of its members is a null object
+     */
+    public boolean retainAll(Collection c){
+	checkCollectionClass("intersect", c);
+
+	return bag.retainAll(c);
+    }
+
+    /**
+     * @return the number of elements in this collection
+     */
+    public int size(){
+	return bag.size();
+    }
+
+    /**
+     * @return a MobyDataSimpleInstance[] with the collection members
+     */
+    public Object[] toArray(){
+	MobyDataSimpleInstance[] mdsis = new MobyDataSimpleInstance[bag.size()];
+	return bag.toArray(mdsis);
+    }
+    
+    /**
+     * Don't use this method if at all possible.  It is only defined because of
+     * the Collection interface requirement.  Use toArray() instead.
+     *
+     * This method will only work if the input array is a MobyDataSimpleInstance[], or
+     * MobyDataInt[], MobyDataFloat[], etc. if you know for sure that all of the 
+     * collection elements are of a particular MOBY primitive subtype.  Otherwise
+     * an ArrayStoreException will be thrown.
+     */
+    public Object[] toArray(Object[] classArray) throws ArrayStoreException, NullPointerException{
+	return bag.toArray(classArray);
+    }
+    
+    /**
+     * Determined whether toXML will return a Central template value or a service call instance value.
+     *
+     * @param mode one of MobyDataInstance.CENTRAL_XML_MODE or MobyDataInstance.SERVICE_XML_MODE
+     * @throws IllegalArgumentException if the mode is not one of the specified values
+     */
+    public void setXmlMode(int mode) throws IllegalArgumentException{
+ 	if(mode != MobyDataInstance.CENTRAL_XML_MODE && mode != MobyDataInstance.SERVICE_XML_MODE){
+	    throw new IllegalArgumentException("Value passed to setXmlMode was neither " +
+                                               "MobyDataInstance.CENTRAL_XML_MODE nor " +
+                                               "MobyDataInstance.SERVICE_XML_MODE");
+	}
+        xmlMode = mode;
+    }
+
+    /**
+     * Report whether toXML will produce Central template or service call instance XML.
+     *
+     * @return one of MobyDataInstance.CENTRAL_XML_MODE or MobyDataInstance.SERVICE_XML_MODE
+     */
+    public int getXmlMode(){
+	return xmlMode;
+    }
+    
+    /**
      * Wraps the simple instances' XML in a MOBY Collection tag
      */
     public String toXML(){
 	StringBuffer collectionXml = new StringBuffer();
-	collectionXml.append("<moby:Collection xmlns:moby=\""+MobyPrefixResolver.MOBY_XML_NAMESPACE+
-			     (getName() != null ? "\" moby:articleName=\"" + getName() : "") + 
-			     "\">\n");
-	for(int i = 0; i < set.length; i++){
-	    collectionXml.append(set[i].toXML());
-	}
-	collectionXml.append("\n</moby:Collection>\n");
+	
+	Iterator membersIterator = bag.iterator();
+        if(xmlMode == MobyDataInstance.SERVICE_XML_MODE){
+	    collectionXml.append("<moby:Collection xmlns:moby=\""+MobyPrefixResolver.MOBY_XML_NAMESPACE+
+				 (getName() != null ? "\" moby:articleName=\"" + getName() : "") + 
+				 "\">\n");
+	    
+	    while(membersIterator.hasNext()){
+
+		MobyDataSimpleInstance mdsi = (MobyDataSimpleInstance) membersIterator.next();
+		mdsi.setXmlMode(xmlMode);
+
+		collectionXml.append(mdsi.toXML());
+	    }
+	    collectionXml.append("\n</moby:Collection>\n");
+        }
+	
+        // Otherwise it's MOBY Central query mode
+        // We need to find out what object classes are present in the array, and 
+        // enumerate them (the types, not the instances).
+        else{
+	    collectionXml.append("<Collection>\n");
+	    Hashtable printed = new Hashtable();
+
+	    while(membersIterator.hasNext()){
+
+		MobyDataSimpleInstance mdsi = (MobyDataSimpleInstance) membersIterator.next();
+		// Could the DataType be null?  I hope not!
+		String objectClass = mdsi.getDataType().getName();
+
+		// A new data type for the collection?
+		if(!printed.containsKey(objectClass)){
+		    mdsi.setXmlMode(xmlMode);
+
+		    collectionXml.append(mdsi.toXML());
+		    
+		    printed.put(objectClass, "printed object type in MOBY central input collection");
+		}
+	    }
+	    collectionXml.append("</Collection>\n");
+        }
+	
 	return collectionXml.toString();
     }
 }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataSimpleInstance.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/MobyDataSimpleInstance.java	2005/04/07 16:37:02	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataSimpleInstance.java	2005/04/15 21:34:40	1.8
@@ -22,17 +22,20 @@
  * or search template formatted XML depending on the mode set.
  * Having both modes is useful because the data instance created from a previous call can be 
  * passed to a service search template by switching the XML mode.  By default the object is in 
- * SERVICE_XML_MODE.
+ * MobyDataInstance.SERVICE_XML_MODE.
  *
  * @author Paul Gordon (gordonp at ucalgary.ca)
  */
 
 public class MobyDataSimpleInstance extends MobyPrimaryDataSimple implements MobyDataInstance, Cloneable, Comparable{
-    public static final int CENTRAL_XML_MODE = 124;
-    public static final int SERVICE_XML_MODE = 891;
-    protected int xmlMode = SERVICE_XML_MODE;
+    protected int xmlMode = MobyDataInstance.SERVICE_XML_MODE;
     protected String dataValue = null;
     protected boolean isObject = true;
+    public static MobyDataType staticObjectDataType;
+
+    static{
+      staticObjectDataType = new MobyDataType("Object");
+    }
 
     /**
      * Constructor that takes in a datatype, name and an object id to build the instance.
@@ -49,13 +52,20 @@
      * Constructor with no instance information.  That information can be filled out later with setValue()
      */
     public MobyDataSimpleInstance(String name){
-	super(name);
-	setDataType(new MobyDataType("Object"));
+        super(name);
+    }
+
+    /**
+     * Constructor convenient for a base object with a namespace and ID.
+     */
+    public MobyDataSimpleInstance(String namespace, String id){
+	this(staticObjectDataType, "", id);
+        addNamespace(new MobyNamespace(namespace));
     }
 
     /**
-     * Creates a simple object from the input instance, as opposed to clone, which creates
-     * an exact copy.
+     * Creates a simple object with the same object class as the input instance, 
+     * as opposed to clone, which creates an exact copy of all the fields.
      */
     public MobyDataSimpleInstance(MobyDataSimpleInstance mdsi){
 	super(mdsi.getName());
@@ -152,13 +162,13 @@
     /**
      * Determined whether toXML will return a Central template value or a service call instance value.
      *
-     * @param mode one of CENTRAL_XML_MODE or SERVICE_XML_MODE
+     * @param mode one of MobyDataInstance.CENTRAL_XML_MODE or MobyDataInstance.SERVICE_XML_MODE
      * @throws IllegalArgumentException if the mode is not one of the specified values
      */
     public void setXmlMode(int mode) throws IllegalArgumentException{
-        if(mode != CENTRAL_XML_MODE && mode != SERVICE_XML_MODE){
+        if(mode != MobyDataInstance.CENTRAL_XML_MODE && mode != MobyDataInstance.SERVICE_XML_MODE){
 	    throw new IllegalArgumentException("Value passed to setXmlMode was neither " +
-					       "CENTRAL_XML_MODE nor SERVICE_XML_MODE");
+					       "MobyDataInstance.CENTRAL_XML_MODE nor MobyDataInstance.SERVICE_XML_MODE");
 	}
 	xmlMode = mode;
     }
@@ -166,7 +176,7 @@
     /**
      * Report whether toXML will produce Central template or service call instance XML.
      *
-     * @return one of CENTRAL_XML_MODE or SERVICE_XML_MODE
+     * @return one of MobyDataInstance.CENTRAL_XML_MODE or MobyDataInstance.SERVICE_XML_MODE
      */
     public int getXmlMode(){
 	return xmlMode;
@@ -284,7 +294,7 @@
      * @return the MOBY XML representation of the data instance
      */
     public String toXML(){
-	if(xmlMode == SERVICE_XML_MODE)
+	if(xmlMode == MobyDataInstance.SERVICE_XML_MODE)
 	    return "<Simple xmlns=\""+MobyPrefixResolver.MOBY_XML_NAMESPACE+
 		(getName() != null ? "\" xmlns:moby=\""+
 		 MobyPrefixResolver.MOBY_XML_NAMESPACE+"\" moby:articleName=\"" + getName() : "")+

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataString.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/MobyDataString.java	2005/04/07 16:37:02	1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataString.java	2005/04/15 21:34:40	1.4
@@ -62,7 +62,7 @@
      */
     public String toXML(){
 	MobyNamespace[] ns = getNamespaces();
-	if(xmlMode == SERVICE_XML_MODE){
+	if(xmlMode == MobyDataInstance.SERVICE_XML_MODE){
 	    String tmpValue = value;
 	    if(tmpValue != null){
 		tmpValue = tmpValue.replaceAll("<", "&lt;");




More information about the MOBY-guts mailing list