A Collection represents a collection of Resources
stored within an XML
database. An XML
database MAY expose collections as a hierarchical set of parent and child
collections.
A Collection provides access to the Resources
stored by the Collection and to Service instances
that can operate against the Collection and the
Resources stored within it. The Service mechanism
provides the ability to extend the functionality of a Collection
in ways that allows optional functionality to be enabled for the Collection.
Method Summary
void
close() Releases all resources consumed by the Collection.
getChildCollection(String name) Returns a Collection instance for the requested child collection
if it exists.
Parameters: name - the name of the child collection to retrieve.
int
getChildCollectionCount() Returns the number of child collections under this
Collection or 0 if no child collections exist.
listResources() Returns a list of the ids for all resources stored in the collection.
void
registerService(Service serv) Registers a new Service implementation with the collection.
The Service
implementation is queried for the name and version that will be used to
retrieve the service.
Releases all resources consumed by the Collection.
The close method must
always be called when use of a Collection is complete.
exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Creates a new unique ID within the context of the Collection
the created id as a string. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Creates a new empty Resource with the provided id.
The type of Resource
returned is determined by the type parameter. The XML:DB API currently
defines "XMLResource" and "BinaryResource" as valid resource types.
The id provided must be unique within the scope of the
collection. If
id is null or its value is empty then an id is generated by
calling createId(). The
Resource created is not stored to the database until
storeResource() is called.
Parameters: id - the unique id to associate with the created Resource. Parameters: type - the Resource type to create. an empty Resource instance. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur. ErrorCodes.UNKNOWN_RESOURCE_TYPE if the typeparameter is not a known Resource type.
Returns a Collection instance for the requested child collection
if it exists.
Parameters: name - the name of the child collection to retrieve. the requested child collection or null if it couldn't be found. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Returns the number of child collections under this
Collection or 0 if no child collections exist.
the number of child collections. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Returns the parent collection for this collection or null if no parent
collection exists.
the parent Collection instance. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Retrieves a Resource from the database. If the
Resource could not be
located a null value will be returned.
Parameters: id - the unique id for the requested resource. The retrieved Resource instance. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Returns the number of resources currently stored in this collection or 0
if the collection is empty.
the number of resource in the collection. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Returns a Service instance for the requested service name and version. If
no Service exists for those parameters a null value is returned.
Parameters: name - Description of Parameter Parameters: version - Description of Parameter the Service instance or null if no Service could be found. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Provides a list of all services known to the collection. If no services
are known an empty list is returned.
An array of registered Service implementations. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Returns a list of collection names naming all child collections
of the current collection. If no child collections exist an empty list is
returned.
an array containing collection names for all childcollections. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Returns a list of the ids for all resources stored in the collection.
a string array containing the names for all Resources in the collection. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur.
Registers a new Service implementation with the collection.
The Service
implementation is queried for the name and version that will be used to
retrieve the service. The Service instance must be a valid service for
this collection or an exception will be raised.
Parameters: serv - the service instance to register. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur. ErrorCodes.INVALID_SERVICE if the Serviceinstance does not have a proper name or version or the instance is null.
Removes the Resource from the database.
Parameters: res - the resource to remove. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur. ErrorCodes.INVALID_RESOURCE if the Resource isnot valid. ErrorCodes.NO_SUCH_RESOURCE if the Resource isnot known to this Collection.
Stores the provided resource into the database. If the resource does not
already exist it will be created. If it does already exist it will be
updated.
Parameters: res - the resource to store in the database. exception: XMLDBException - with expected error codes. ErrorCodes.VENDOR_ERROR for any vendorspecific errors that occur. ErrorCodes.INVALID_RESOURCE if the Resource isnot valid.