Lars Martin wrote:
> 
> On Mon, 23 Apr 2001 17:52:05 -0700
> Kimbro Staken <[EMAIL PROTECTED]> wrote:

> Why the Collection interface needs setter/getter for ResourceType? Does
> a Collection can not contain different Resources, e.g. DOM and Binary?
> Did I overlooked something here?

It can but this is mainly used to switch what representation you want
for XML. e.g. SAX, DOM, Text. This is definitely the one thing about the
API that I'm not really happy with.

The use case looks like.

Collection collection = DatabaseManager.getCollection("some db uri");

// tell the API you want a DOMNodeResource when you call getResource()
collection.setResourceType("DOMNode"); 

String id = "gladiator-2000";
DOMNodeResource resource = (DOMNodeResource) collection.getResource(id);
Document doc = (Document) resource.getContent();


BTW, do we really need to be able to support mixed binary/XML within the
same collection?

> 
> > The Resource interface should have a getResourceType method so that you
> > can know what kind of resource it encapsulates.
> 
> sounds reasonable
> 
> > In Collection there should probably be a getChildCollection method to
> > retrieve a collection relative to the current collection.
> >
> > In Collection there is currently a getChildCollections method that
> > returns a list of Collection instances. This would probably be better as
> > a listChildCollections method that returns a list of child collection
> > names instead of actual collection instances. You could then use
> > getChildCollection to retrieve the Collection instances as needed.
> >

Any opinion on this change?

> > In Collection there should probably be a way to test for the existance
> > of a Resource prior to retrieving/changing/deleting it.
> >
> > In Collection there should probably be a way to test for the existence
> > of a particular service.
> 
> Well I see the advantages of dedicated "exists" methods but I'm not sure
> whether they're really necessary?!
> 
> 1. proceeding you request:
> 
>         if (collection.serviceExists("XPathQueryService", "1.0")) {
>            Service service = collection.getService("XPathQueryService",
>                              "1.0");
>            service.setCollection(collection);
>            ....
>         }
> 
> or 2. current proceeding:
> 
>         Service service = null;
>         if ((service = collection.getService("XPathQueryService", "1.0"))
>                              != null) {
>             service.setCollection(collection);
>             ....
>         }
> 
> Same for Resources....
> 

Done deal. null returns on getService and getResource if not found. 


> > I think that's it for now.
> >
> > --
> > Kimbro Staken
> > Chief Technology Officer
> > dbXML Group L.L.C
> > http://www.dbxmlgroup.com
> >
> > ----------------------------------------------------------------------
> > Post a message:         mailto:[EMAIL PROTECTED]
> > Unsubscribe:            mailto:[EMAIL PROTECTED]
> > Contact adminstrator:   mailto:[EMAIL PROTECTED]
> > Read archived messages: http://archive.xmldb.org/
> > ----------------------------------------------------------------------
> 
> --
> ______________________________________________________________________
> Lars Martin                                    mailto:[EMAIL PROTECTED]
> SMB GmbH                                        http://www.smb-tec.com
> 
> ----------------------------------------------------------------------
> Post a message:         mailto:[EMAIL PROTECTED]
> Unsubscribe:            mailto:[EMAIL PROTECTED]
> Contact adminstrator:   mailto:[EMAIL PROTECTED]
> Read archived messages: http://archive.xmldb.org/
> ----------------------------------------------------------------------

-- 
Kimbro Staken
Chief Technology Officer
dbXML Group L.L.C
http://www.dbxmlgroup.com

----------------------------------------------------------------------
Post a message:         mailto:[EMAIL PROTECTED]
Unsubscribe:            mailto:[EMAIL PROTECTED]
Contact adminstrator:   mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------

Reply via email to