|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Collection
represents a collection of Resource
s
stored within an XML
database. An XML
database MAY expose collections as a hierarchical set of parent and child
collections.
Collection
provides access to the Resource
s
stored by the Collection
and to Service
instances
that can operate against the Collection
and the
Resource
s 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 . |
java.lang.String |
createId()
Creates a new unique ID within the context of the Collection |
Resource |
createResource(java.lang.String id,
java.lang.String type)
Creates a new empty Resource with the provided id. |
Collection |
getChildCollection(java.lang.String name)
Returns a Collection instance for the requested child collection
if it exists. |
int |
getChildCollectionCount()
Returns the number of child collections under this Collection or 0 if no child collections exist. |
Collection |
getParentCollection()
Returns the parent collection for this collection or null if no parent collection exists. |
Resource |
getResource(java.lang.String id)
Retrieves a Resource from the database. |
int |
getResourceCount()
Returns the number of resources currently stored in this collection or 0 if the collection is empty. |
Service |
getService(java.lang.String name,
java.lang.String version)
Returns a Service instance for the requested service name and version. |
Service[] |
getServices()
Provides a list of all services known to the collection. |
java.lang.String[] |
listChildCollections()
Returns a list of collection names naming all child collections of the current collection. |
java.lang.String[] |
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. |
void |
removeResource(Resource res)
Removes the Resource from the database. |
void |
storeResource(Resource res)
Stores the provided resource into the database. |
Methods inherited from interface org.xmldb.api.base.Configurable |
getName, getProperty, setProperty |
Method Detail |
public Service[] getServices() throws XMLDBException
Service
implementations.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public Service getService(java.lang.String name, java.lang.String version) throws XMLDBException
Service
instance for the requested service name and version. If
no Service
exists for those parameters a null value is returned.
name
- Description of Parameterversion
- Description of Parameter
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public void registerService(Service serv) throws XMLDBException
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.
serv
- the service instance to register.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.INVALID_SERVICE
if the Service
instance does not have a proper name or version or the instance is null.public Collection getParentCollection() throws XMLDBException
Collection
instance.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public int getChildCollectionCount() throws XMLDBException
Collection
or 0 if no child collections exist.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public java.lang.String[] listChildCollections() throws XMLDBException
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public Collection getChildCollection(java.lang.String name) throws XMLDBException
Collection
instance for the requested child collection
if it exists.
name
- the name of the child collection to retrieve.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public int getResourceCount() throws XMLDBException
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public java.lang.String[] listResources() throws XMLDBException
Resource
s in the collection.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public Resource createResource(java.lang.String id, java.lang.String type) throws XMLDBException
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.
id
- the unique id to associate with the created Resource
.type
- the Resource
type to create.
Resource
instance.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.UNKNOWN_RESOURCE_TYPE
if the type
parameter is not a known Resource
type.public void removeResource(Resource res) throws XMLDBException
Resource
from the database.
res
- the resource to remove.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.INVALID_RESOURCE
if the Resource
is
not valid.ErrorCodes.NO_SUCH_RESOURCE
if the Resource
is
not known to this Collection
.public void storeResource(Resource res) throws XMLDBException
res
- the resource to store in the database.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.INVALID_RESOURCE
if the Resource
is
not valid.public Resource getResource(java.lang.String id) throws XMLDBException
Resource
from the database. If the
Resource
could not be
located a null value will be returned.
id
- the unique id for the requested resource.
Resource
instance.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public java.lang.String createId() throws XMLDBException
Collection
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public void close() throws XMLDBException
Collection
.
The close
method must
always be called when use of a Collection
is complete.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |