|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.api.xmldb.BXCollection
public final class BXCollection
Implementation of the Collection Interface for the XMLDB:API.
Field Summary |
---|
Fields inherited from interface org.basex.api.xmldb.BXXMLDBText |
---|
CONFORMANCE_LEVEL, DBURI, ERR_BINARY, ERR_CONT, ERR_DOC, ERR_EMPTY, ERR_ID, ERR_INV, ERR_ITER, ERR_NSURI, ERR_PROP, ERR_RES, ERR_TYPE, ERR_UNKNOWN, ERR_URI, LOCALHOST, XMLDB, XMLDBURI |
Constructor Summary | |
---|---|
BXCollection(Context c)
Standard constructor. |
|
BXCollection(java.lang.String name)
Constructor to create a collection for the specified document. |
Method Summary | |
---|---|
void |
close()
Releases all resources consumed by the Collection . |
java.lang.String |
createId()
Creates a random numeric id and check if it's not already contained in the database. |
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. |
java.lang.String |
getName()
Returns the name associated with the Collection instance. |
Collection |
getParentCollection()
Returns the parent collection for this collection or null if no parent collection exists. |
java.lang.String |
getProperty(java.lang.String key)
Returns the value of the property identified by name . |
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 nm,
java.lang.String ver)
Returns a Service instance for the requested service name and version. |
Service[] |
getServices()
Provides a list of all services known to the collection. |
boolean |
isOpen()
Returns true if the Collection is open false otherwise. |
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 |
removeResource(Resource res)
Removes the Resource from the database. |
void |
setProperty(java.lang.String key,
java.lang.String val)
Be aware what you're doing here.. |
void |
storeResource(Resource res)
Stores the provided resource into the database. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BXCollection(Context c)
c
- for Contextpublic BXCollection(java.lang.String name) throws XMLDBException
name
- name of the database
XMLDBException
- exceptionMethod Detail |
---|
public java.lang.String getName()
Collection
getName
in interface Collection
public Service[] getServices() throws XMLDBException
Collection
getServices
in interface Collection
Service
implementations.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public Service getService(java.lang.String nm, java.lang.String ver) throws XMLDBException
Collection
Service
instance for the requested service name and version. If
no Service
exists for those parameters a null value is returned.
getService
in interface Collection
nm
- Description of Parameterver
- Description of Parameter
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public Collection getParentCollection() throws XMLDBException
Collection
getParentCollection
in interface Collection
Collection
instance.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public Collection getChildCollection(java.lang.String name) throws XMLDBException
Collection
Collection
instance for the requested child collection
if it exists.
getChildCollection
in interface Collection
name
- the name of the child collection to retrieve.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public int getChildCollectionCount() throws XMLDBException
Collection
Collection
or 0 if no child collections exist.
getChildCollectionCount
in interface Collection
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public java.lang.String[] listChildCollections() throws XMLDBException
Collection
listChildCollections
in interface Collection
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
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.ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public java.lang.String[] listResources() throws XMLDBException
Collection
listResources
in interface Collection
Resource
s in the collection.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public Resource createResource(java.lang.String id, java.lang.String type) throws XMLDBException
Collection
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.
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.
ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public void removeResource(Resource res) throws XMLDBException
Collection
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
.
ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public void storeResource(Resource res) throws XMLDBException
Collection
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.
ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
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.ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public java.lang.String createId() throws XMLDBException
createId
in interface Collection
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.COLLECTION_CLOSED
if the close
method has been called on the Collection
public boolean isOpen()
Collection
Collection
is open false otherwise.
Calling the close
method on
Collection
will result in isOpen
returning false. It is not safe to use Collection
instances
that have been closed.
isOpen
in interface Collection
Collection
is open, false otherwise.public void close()
Collection
Collection
.
The close
method must
always be called when use of a Collection
is complete. It is
not safe to use a Collection
after the close
method has been called.
close
in interface Collection
public java.lang.String getProperty(java.lang.String key) throws XMLDBException
Configurable
name
.
getProperty
in interface Configurable
key
- the name of the property to retrieve.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public void setProperty(java.lang.String key, java.lang.String val) throws XMLDBException
setProperty
in interface Configurable
key
- the name of the property to set.val
- the value to set for the property.
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 |