[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Sun Dec 9 00:23:49 UTC 2007


gordonp
Sat Dec  8 19:23:49 EST 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data
In directory dev.open-bio.org:/tmp/cvs-serv4467/src/main/org/biomoby/shared/data

Modified Files:
	MobyDataComposite.java MobyDataObject.java 
	MobyDataObjectSAI.java MobyDataXref.java 
Log Message:
Added support for registry-aware crossreferences
moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.22,1.23 MobyDataObject.java,1.24,1.25 MobyDataObjectSAI.java,1.2,1.3 MobyDataXref.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java	2007/12/06 17:39:02	1.22
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java	2007/12/09 00:23:49	1.23
@@ -61,7 +61,7 @@
 	for(int i = 0; i < numSubstructures; i++){
 	    org.w3c.dom.Element child = (org.w3c.dom.Element) substructures.item(i);
 	    if(child.getLocalName().equals(MobyTags.CROSSREFERENCE)){
-		addCrossReferences(child);
+		addCrossReferences(child, registry);
 	    }
  	    else if(child.getLocalName().equals(MobyTags.PROVISIONINFORMATION)){
  		addProvisionInfo(child);		

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java	2007/12/06 23:43:17	1.24
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObject.java	2007/12/09 00:23:49	1.25
@@ -96,7 +96,7 @@
      * copy of all the fields and the datatype.
      */
     public MobyDataObject(MobyDataObject mobj){
-	super(mobj.getName());
+	this(mobj.getName(), mobj.getDataType().getRegistry());
 	setId(mobj.getId());
 	setNamespaces(mobj.getNamespaces());
     }
@@ -423,6 +423,10 @@
     }
 
     public void addCrossReferences(Element e) throws MobyException{
+    	addCrossReferences(e, null);
+    }
+
+    public void addCrossReferences(Element e, Registry reg) throws MobyException{
 	if(e == null){
 	    throw new NullPointerException("Cannot add a null cross-reference element to an object");
 	}
@@ -439,10 +443,10 @@
 	    Element child = (Element) substructures.item(i);
 	    String objectClass = child.getLocalName();
 	    if(MobyTags.MOBYOBJECT.equals(objectClass)){
-		addCrossReference(new MobyDataObject(child));
+		addCrossReference(new MobyDataObject(child, reg));
 	    }
 	    else if(MobyTags.XREF.equals(objectClass)){
-		addCrossReference(new MobyDataXref(child));
+		addCrossReference(new MobyDataXref(child, reg));
 	    }
 	    else{
 		throw new MobyException("Cross-reference block contained an illegal child element ("+objectClass+

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSAI.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/data/MobyDataObjectSAI.java	2007/12/06 23:43:17	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataObjectSAI.java	2007/12/09 00:23:49	1.3
@@ -31,6 +31,7 @@
 	super("", registry);  // Not using c-tor(namespace, id), then assigning "this" to
 	                      // dataInstance, because that would cause recursion in the shadowed calls
 	dataInstance = new MobyDataObject(namespace, id, registry);
+	// Note: in future maybe we should check that the services come from from the passed in registry, for consistency
 	mobyServices = services;
     }
 
@@ -39,6 +40,7 @@
      */
     public MobyDataObjectSAI(MobyDataObject mdsi, MobyService[] services){
 	super(mdsi.getName(), mdsi.getDataType().getRegistry());
+	// Note: in future maybe we should check that the data object and the services come from from the same registry
 	dataInstance = mdsi;
 	mobyServices = services;
     }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.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/MobyDataXref.java	2007/06/09 18:13:38	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java	2007/12/09 00:23:49	1.8
@@ -1,6 +1,7 @@
 package org.biomoby.shared.data;
 
 import org.w3c.dom.Element;
+import org.biomoby.registry.meta.Registry;
 import org.biomoby.shared.*;
 
 /**
@@ -50,26 +51,39 @@
 
     public MobyDataXref(MobyNamespace namespace, String id, MobyService service){
 	// Anonymous object
-	super("", id, new MobyService[] {service});
+	super("", id, new MobyService[] {service}, service.getServiceType().getRegistry());
+	// Note: in future maybe we should check that the namespace and the service from from the same registry
 	addNamespace(namespace);
     }
 
+    /**
+     * Gets the registry implicitly from the service being passed in. 
+     */
     public MobyDataXref(String namespace, String id, MobyService service){
-	super("", id, new MobyService[] {service});
+	super("", id, new MobyService[] {service}, service.getServiceType().getRegistry());
 	addNamespace(MobyNamespace.getNamespace(namespace));
     }
 
     public MobyDataXref(String namespace, String id, String serviceName, String authURI){
-	super("", id, new MobyService[] {new MobyService(serviceName)});
+	this(namespace, id, serviceName, authURI, null);
+    }
+
+    public MobyDataXref(String namespace, String id, String serviceName, String authURI, Registry registry){
+	super("", id, new MobyService[] {MobyService.getService(serviceName, authURI)}, registry);
 	addNamespace(MobyNamespace.getNamespace(namespace));
 	getService().setAuthority(authURI);
     }
 
     public MobyDataXref(Element e) throws MobyException{
+	this(e, (Registry) null);
+    }
+
+    public MobyDataXref(Element e, Registry registry) throws MobyException{
 	this(getNamespace(e).getName(), 
 	     getId(e), 
 	     MobyPrefixResolver.getAttr(e, "serviceName"), 
-	     MobyPrefixResolver.getAttr(e, "authURI"));
+	     MobyPrefixResolver.getAttr(e, "authURI"), 
+	     registry);
 
 	setEvidenceCodeByAbbrev(MobyPrefixResolver.getAttr(e, "evidenceCode"));
 	setXrefType(MobyPrefixResolver.getAttr(e, "xrefType"));




More information about the MOBY-guts mailing list