[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
XML:DB implementation - Relationships between Collection, Resource and XMLContainer
- To: <ozone-dev@ozone-db.org>
- Subject: XML:DB implementation - Relationships between Collection, Resource and XMLContainer
- From: "Per Nyfelt" <per.nyfelt@nordicwave.com>
- Date: Wed, 30 May 2001 10:52:22 +0200
- Delivered-To: softw7-ozone-db:org-ozone-dev@ozone-db.org
- Importance: Normal
- In-Reply-To: <3B0D4C37.B0097B06@dbxmlgroup.com>
I'm struggling with CollectionImpl.createResource(). What should be the
relationships between org.xmldb.api.base.Collection,
org.xmldb.api.base.Resource and org.ozoneDB.xml.util.XMLContainer? I
something like the following in mind but I'm not sure this is a valid route:
public Resource createResource( String id, String type ) throws
XMLDBException {
try {
if ( ( id == null ) || ( id.equals("") ) ) {
id = createId();
}
if ( type.equals(XMLResource.RESOURCE_TYPE) ) {
// what to do with this?
return new XMLResourceImpl(database,this,
XMLContainer.newContainer( database, id));
}
else if ( type.equals(BinaryResource.RESOURCE_TYPE) ) {
throw new XMLDBException( ErrorCodes.VENDOR_ERROR,
"BinaryResource: Not yet implemented");
}
else {
throw new XMLDBException(ErrorCodes.UNKNOWN_RESOURCE_TYPE);
}
}
catch (Exception e) {
throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR,
e.toString());
}
}
Then for CollectionImpl.storeResource() i'm not sure how the storage of a
Resource should be viewed. If Collection should aggregate Resources we
should store the resource inside the Collection but then Collection needs to
have a list (Map) of Resources. On the other hand if we store it as a
separate object what denoted its relationship with a Collection?
public void storeResource( Resource res ) throws XMLDBException {
try {
String id = res.getId();
if ((id == null) || (id.length() == 0)) {
id = createId();
}
// what to do whith this?
database.createObject( Resource.class.getName(),
OzoneInterface.Public, id);
}
catch (Exception e) {
throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR,
e.toString());
}
}
Any suggestions?
Best regards,
Per