|
XML:DB API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmldb.api.DatabaseManager
DatabaseManager
is the entry point for the API and enables you to get the
initial Collection
references necessary to do anything useful with the API.
DatabaseManager
is intended to be
provided as a concrete implementation in a particular programming
language. Individual language mappings should define the exact syntax and
semantics of its use.
Constructor Summary | |
DatabaseManager()
|
Method Summary | |
static void |
deregisterDatabase(Database database)
Deregisters a Database implementation from the DatabaseManager . |
static Collection |
getCollection(java.lang.String uri)
Retrieves a Collection instance from the database for the
given URI. |
static Collection |
getCollection(java.lang.String uri,
java.lang.String username,
java.lang.String password)
Retrieves a Collection instance from the database for the
given URI. |
static java.lang.String |
getConformanceLevel(java.lang.String uri)
Returns the Core Level conformance value for the provided URI. |
static Database[] |
getDatabases()
Returns a list of all available Database implementations
that have been registered with this DatabaseManager . |
static java.lang.String |
getProperty(java.lang.String name)
Retrieves a property that has been set for the DatabaseManager . |
static void |
registerDatabase(Database database)
Registers a new Database implementation with the
DatabaseManager . |
static void |
setProperty(java.lang.String name,
java.lang.String value)
Sets a property for the DatabaseManager . |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DatabaseManager()
Method Detail |
public static Database[] getDatabases()
Database
implementations
that have been registered with this DatabaseManager
.
Database
instances.
One for each Database
registered
with the DatabaseManager
. If no Database
instances exist then an empty array is returned.public static void registerDatabase(Database database) throws XMLDBException
Database
implementation with the
DatabaseManager
.
database
- The database instance to register.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrorCodes.INVALID_DATABASE
if the provided Database
instance is invalid.public static void deregisterDatabase(Database database) throws XMLDBException
Database
implementation from the DatabaseManager
. Once a
Database
has been deregistered it can no longer be used to handle
requests.
database
- The Database
instance to deregister.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public static Collection getCollection(java.lang.String uri) throws XMLDBException
Collection
instance from the database for the
given URI. The format of the majority of the URI is database
implementation specific however the uri must begin with characters xmldb:
and be followed by the name of the database instance as returned by
Database.getName()
and a colon
character. An example would be for the database named "vendordb" the URI
handed to getCollection would look something like the following.
xmldb:vendordb://host:port/path/to/collection
. The xmldb:
prefix will be removed from the URI prior to handing the URI to the
Database
instance for handling.
This method is called when no authentication is necessary for the
database.
uri
- The database specific URI to use to locate the collection.
Collection
instance for the requested collection or
null if the collection could not be found.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrroCodes.INVALID_URI
If the URI is not in a valid format. ErrroCodes.NO_SUCH_DATABASE
If a Database
instance could not be found to handle the provided URI.public static Collection getCollection(java.lang.String uri, java.lang.String username, java.lang.String password) throws XMLDBException
Collection
instance from the database for the
given URI. The format of the majority of the URI is database
implementation specific however the uri must begin with characters xmldb:
and be followed by the name of the database instance as returned by
Database.getName()
and a colon
character. An example would be for the database named "vendordb" the URI
handed to getCollection would look something like the following.
xmldb:vendordb://host:port/path/to/collection
. The xmldb:
prefix will be removed from the URI prior to handing the URI to the
Database
instance for handling.
uri
- The database specific URI to use to locate the collection.username
- The username to use for authentication to the database or
null if the database does not support authentication.password
- The password to use for authentication to the database or
null if the database does not support authentication.
Collection
instance for the requested collection or
null if the collection could not be found.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.ErrroCodes.INVALID_URI
If the URI is not in a valid format. ErrroCodes.NO_SUCH_DATABASE
If a Database
instance could not be found to handle the provided URI.
ErrroCodes.PERMISSION_DENIED
If the username
and password
were not accepted by the database.public static java.lang.String getConformanceLevel(java.lang.String uri) throws XMLDBException
uri
- The database specific URI to use to locate the collection.
XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.
ErrroCodes.INVALID_URI
If the URI is not in a valid format. ErrroCodes.NO_SUCH_DATABASE
If a Database
instance could not be found to handle the provided URI.public static java.lang.String getProperty(java.lang.String name)
DatabaseManager
.
name
- The property name
public static void setProperty(java.lang.String name, java.lang.String value)
DatabaseManager
.
name
- The property namevalue
- The value to set.
|
XML:DB API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |