|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ozoneDB.xml.cli.AbstractConfigurable | +--org.ozoneDB.xml.cli.CollectionImpl
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
.
Constructor Summary | |
protected |
CollectionImpl(org.ozoneDB.ExternalDatabase database,
XMLCollection collection)
Constuctor |
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. |
protected static Collection |
forName(org.ozoneDB.ExternalDatabase database,
java.lang.String collectionName)
gets the Collection using the corresponding name from the given
database |
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. |
java.lang.String |
getName()
Returns the name of this Collection. |
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 the Service with the provided 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. |
protected static Collection |
newCollection(org.ozoneDB.ExternalDatabase database,
java.lang.String collectionName)
creates a new Collection and stores it in the database |
void |
registerService(Service service)
Registers the provided Service for this 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 class org.ozoneDB.xml.cli.AbstractConfigurable |
getProperty, setProperty |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.xmldb.api.base.Configurable |
getProperty, setProperty |
Constructor Detail |
protected CollectionImpl(org.ozoneDB.ExternalDatabase database, XMLCollection collection)
Method Detail |
protected static Collection forName(org.ozoneDB.ExternalDatabase database, java.lang.String collectionName) throws java.lang.Exception
Collection
using the corresponding name from the given
database
java.lang.Exception
protected static Collection newCollection(org.ozoneDB.ExternalDatabase database, java.lang.String collectionName) throws java.lang.Exception
Collection
and stores it in the database
java.lang.Exception
public java.lang.String getName() throws XMLDBException
getName
in interface Configurable
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public Service[] getServices() throws XMLDBException
Collection
getServices
in interface Collection
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
getService
in interface Collection
name
- the name of the requested Serviceversion
- the version of the requested Service if any
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public void registerService(Service service) throws XMLDBException
registerService
in interface Collection
service
- The Service to be registered for this Collection.
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
getParentCollection
in interface Collection
XMLDBException
public int getChildCollectionCount() throws XMLDBException
getChildCollectionCount
in interface Collection
XMLDBException
public java.lang.String[] listChildCollections() throws XMLDBException
listChildCollections
in interface Collection
XMLDBException
public Collection getChildCollection(java.lang.String name) throws XMLDBException
getChildCollection
in interface Collection
name
- the name of the child collection to retrieve.
XMLDBException
public int getResourceCount() throws XMLDBException
Collection
getResourceCount
in interface Collection
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public java.lang.String[] listResources() throws XMLDBException
listResources
in interface Collection
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.
createResource
in interface Collection
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.
removeResource
in interface Collection
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
storeResource
in interface Collection
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
Collection
Resource
from the database. If the
Resource
could not be
located a null value will be returned.
getResource
in interface Collection
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
createId
in interface 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.
close
in interface Collection
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 |