[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Fri Nov 30 17:23:17 UTC 2007


gordonp
Fri Nov 30 12:23:16 EST 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data
In directory dev.open-bio.org:/tmp/cvs-serv2857/src/main/org/biomoby/shared/data

Modified Files:
	MobyDataBoolean.java MobyDataComposite.java 
	MobyDataDateTime.java MobyDataFloat.java MobyDataInt.java 
	MobyDataObject.java MobyDataString.java 
Log Message:
Fixed missing passing of the registry to c-tors, which caused incorrect use of default registry for DOM-based object building
moby-live/Java/src/main/org/biomoby/shared/data MobyDataBoolean.java,1.5,1.6 MobyDataComposite.java,1.19,1.20 MobyDataDateTime.java,1.10,1.11 MobyDataFloat.java,1.8,1.9 MobyDataInt.java,1.7,1.8 MobyDataObject.java,1.20,1.21 MobyDataString.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBoolean.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/data/MobyDataBoolean.java	2007/06/09 18:14:33	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataBoolean.java	2007/11/30 17:23:16	1.6
@@ -30,7 +30,7 @@
     public MobyDataBoolean(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{
 	this(getName(element), getTextContents(element), registry);
 	setId(getId(element));
-	addNamespace(getNamespace(element));
+	addNamespace(getNamespace(element, registry));
     }
     
     /**
@@ -43,7 +43,7 @@
 
     /** Every c-tor eventually winds up here */
     public MobyDataBoolean(String articleName, Boolean b, Registry registry){
-	super(articleName);
+	super(articleName, registry);
 	setDataType(MobyDataType.getDataType(MobyTags.MOBYBOOLEAN, registry));
 	value = b;
     }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java	2007/10/31 15:35:55	1.19
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java	2007/11/30 17:23:16	1.20
@@ -40,7 +40,7 @@
     public MobyDataComposite(org.w3c.dom.Element element, Registry registry) throws MobyException{
 	this(MobyDataType.getDataType(element.getLocalName(), registry), 
 	     getName(element), 
-	     getNamespace(element), 
+	     getNamespace(element, registry), 
 	     getId(element));
 	if(getDataType() == null){
 	    throw new MobyException("Attempted to build a composite MOBY object from XML, " +
@@ -75,7 +75,7 @@
 					    " does not have an article " +
 					    "name, which is required (tag "+element.getNodeName()+")");
 		}
-		MobyDataObject childObject = (MobyDataObject) createInstanceFromDOM(child);
+		MobyDataObject childObject = (MobyDataObject) createInstanceFromDOM(child, registry);
 		if(childObject == null){
 		    throw new MobyException("The object member '" + fieldName + "' for object '"+ getName() +
 					    " could not be properly parsed into a MOBY object");
@@ -86,7 +86,7 @@
     }
 
     public MobyDataComposite(MobyDataType type, String name, MobyNamespace namespace, String id){
-	super(namespace.getName(), id);
+	super(namespace.getName(), id, type.getRegistry());
 	setName(name);
 	setDataType(type);
 	members = new ConcurrentHashMap<String, MobyDataObject>();

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java	2007/06/09 18:14:33	1.10
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataDateTime.java	2007/11/30 17:23:16	1.11
@@ -41,7 +41,7 @@
     public MobyDataDateTime(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{
 	this(getName(element), getTextContents(element), registry);
 	setId(getId(element));
-	addNamespace(getNamespace(element));
+	addNamespace(getNamespace(element, registry));
     }
     
     /**
@@ -53,7 +53,7 @@
     }
 
     public MobyDataDateTime(String articleName, String stringISO8601, Registry registry) throws IllegalArgumentException{
-	super(articleName);
+	super(articleName, registry);
 	setDataType(MobyDataType.getDataType(MobyTags.MOBYDATETIME, registry));
 	value = parseISO8601(stringISO8601.trim());
     }
@@ -67,7 +67,7 @@
     }
 
     public MobyDataDateTime(String articleName, GregorianCalendar cal, Registry registry){
-	super(articleName, "");
+	super(articleName, "", registry);
 	setDataType(MobyDataType.getDataType(MobyTags.MOBYDATETIME, registry));
 	value = cal;
     }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java	2007/06/09 18:14:33	1.8
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataFloat.java	2007/11/30 17:23:16	1.9
@@ -34,7 +34,7 @@
     public MobyDataFloat(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{
 	this(getName(element), getTextContents(element), registry);
 	setId(getId(element));
-	addNamespace(getNamespace(element));
+	addNamespace(getNamespace(element, registry));
     }
 
     /**
@@ -46,7 +46,7 @@
     }
 
     public MobyDataFloat(String articleName, Number n, Registry r){
-	super(articleName);
+	super(articleName, r);
 	setDataType(MobyDataType.getDataType(MobyTags.MOBYFLOAT, r));
 	if(n instanceof BigDecimal){
 	    value = (BigDecimal) n;
@@ -100,7 +100,7 @@
     }
 
     public MobyDataFloat(String articleName, String stringNumber, Registry registry) throws NumberFormatException{
-	super(articleName);
+	super(articleName, registry);
 	setDataType(MobyDataType.getDataType(MobyTags.MOBYFLOAT, registry));
 	value = new BigDecimal(stringNumber.trim());
     }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.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/data/MobyDataInt.java	2007/06/09 18:14:33	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataInt.java	2007/11/30 17:23:16	1.8
@@ -33,7 +33,7 @@
     public MobyDataInt(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{
 	this(getName(element), getTextContents(element), registry);
 	setId(getId(element));
-	addNamespace(getNamespace(element));
+	addNamespace(getNamespace(element, registry));
     }
 
     /**
@@ -46,7 +46,7 @@
     }
 
     public MobyDataInt(String articleName, Number n, Registry registry){
-	super(articleName);
+	super(articleName, registry);
 	setDataType(MobyDataType.getDataType(MobyTags.MOBYINTEGER, registry));
 	if(n instanceof BigInteger){
 	    value = (BigInteger) n;
@@ -76,7 +76,7 @@
     }
 
     public MobyDataInt(String articleName, int i, Registry registry){
-	super(articleName);
+	super(articleName, registry);
 	setDataType(MobyDataType.getDataType(MobyTags.MOBYINTEGER, registry));
 	value = new BigInteger(""+i);
     }
@@ -95,7 +95,7 @@
     }
 
     public MobyDataInt(String articleName, String stringNumber, Registry registry) throws NumberFormatException{
-	super(articleName);
+	super(articleName, registry);
 	setDataType(MobyDataType.getDataType(MobyTags.MOBYINTEGER, registry));
 	value = new BigInteger(stringNumber.trim());
     }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java	2007/10/31 15:35:55	1.20
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java	2007/11/30 17:23:16	1.21
@@ -175,7 +175,7 @@
 						   "instance to create");
 	    }
 
-	    return createInstanceFromDOM(elementChild);
+	    return createInstanceFromDOM(elementChild, registry);
 	}
 
 	// There are six types of objects we can populate with data directly
@@ -208,7 +208,7 @@
 	else{	   
 	    MobyDataType type = MobyDataType.getDataType(objectClass, registry);
 	    // Treat base64-encoded binary data as a special case, as we have a convenience class for it
-	    if(type != null && type.inheritsFrom(MobyDataType.getDataType(MobyDataBytes.BASE64_DATATYPE))){
+	    if(type != null && type.inheritsFrom(MobyDataType.getDataType(MobyDataBytes.BASE64_DATATYPE, registry))){
 		return new MobyDataBytes(objectTag, registry);
 	    }
 	    else{
@@ -238,11 +238,16 @@
     }
 
     protected static MobyNamespace getNamespace(Element e){
+	return getNamespace(e, null);
+    }
+
+    protected static MobyNamespace getNamespace(Element e, Registry registry){
 	String namespace = MobyPrefixResolver.getAttr(e, "namespace");
-	MobyNamespace nsObj = MobyNamespace.getNamespace(namespace);
+	MobyNamespace nsObj = MobyNamespace.getNamespace(namespace, registry);
 	if(nsObj == null){
 	    // Not in the ontology, so create a token namespace
 	    nsObj = new MobyNamespace(namespace == null ? "" : namespace);
+            nsObj.setRegistry(registry);
 	}
 	return nsObj;
     }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.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/data/MobyDataString.java	2007/07/23 21:32:58	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataString.java	2007/11/30 17:23:16	1.8
@@ -29,7 +29,7 @@
     public MobyDataString(org.w3c.dom.Element element, Registry registry) throws IllegalArgumentException{
 	this(getName(element), getTextContents(element), registry);
 	setId(getId(element));
-	addNamespace(getNamespace(element));
+	addNamespace(getNamespace(element, registry));
     }
     
     /**
@@ -41,7 +41,7 @@
     }
 
     public MobyDataString(String articleName, CharSequence stringValue, Registry registry){
-	super(articleName);
+	super(articleName, registry);
 	setDataType(MobyDataType.getDataType(MobyTags.MOBYSTRING, registry));
 	value = stringValue == null ? null : new StringBuffer(stringValue.toString());
     }




More information about the MOBY-guts mailing list