Per Nyfelt wrote:
>
> I tried this question on the Ozone Dev list but no reply. Hope you do not
> think it's too off topic.
>
> I'm one of the people to volunteer to try to implement support for the
> XML:DB api in Ozone and I'm struggling with CollectionImpl.createResource()
> and CollectionImpl.storeResource(). What should be the relationships between
> org.xmldb.api.base.Collection, org.xmldb.api.base.Resource and
> org.ozoneDB.xml.util.XMLContainer? From what i understand of the reference
> implementation a Collection ends up being a directory and a resource is a
> file that end up in that directory. This to me implies that a Collection
> should contain (aggregate) Resources.
>
That is correct.
> For createResource() I had 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.length() == 0 ) ) {
> 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.VENDOR_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 were to store it as
> a
> separate object what denoted its relationship with a Collection?
>
Afraid I can't help here as I'm not that familiar with Ozone.
> public void storeResource( Resource res ) throws XMLDBException {
> try {
> String id = res.getId();
> if ((id == null) || (id.length() == 0)) {
> id = createId();
> }
> // what to do with this?
> database.createObject( Resource.class.getName(),
> OzoneInterface.Public, id);
> }
> catch (Exception e) {
> throw new XMLDBException(ErrorCodes.VENDOR_ERROR,
> e.toString());
> }
> }
>
> Any ideas/suggestions would be very much appreciated.
>
> Best regards,
> Per
>
> ----------------------------------------------------------------------
> Post a message: mailto:[EMAIL PROTECTED]
> Unsubscribe: mailto:[EMAIL PROTECTED]
> Contact adminstrator: mailto:[EMAIL PROTECTED]
> Read archived messages: http://archive.xmldb.org/
> ----------------------------------------------------------------------
--
Kimbro Staken
The dbXML Project
http://www.dbxml.org/
----------------------------------------------------------------------
Post a message: mailto:[EMAIL PROTECTED]
Unsubscribe: mailto:[EMAIL PROTECTED]
Contact adminstrator: mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------