org.xmldb.api.base
Interface Database
- Configurable
- DatabaseImpl, SimpleDatabase
public interface Database
Database
is an encapsulation of the database driver
functionality that is
necessary to access an XML database. Each vendor must provide their own
implmentation of the
Database
interface. The implementation
is registered with the
DatabaseManager
to provide access to the resources of the XML database.
In general usage client applications should only access
Database
implementations directly during initialization.
boolean | acceptsURI(String uri) - acceptsURI determines whether this
Database implementation
can handle the URI.
|
Collection | getCollection(String uri, String username, String password) - Retrieves a
Collection instance based on the URI provided
in the uri parameter.
|
String | getConformanceLevel() - Returns the XML:DB API Conformance level for the implementation.
|
String | getName() - Returns the name associated with the Database instance.
|
acceptsURI
public boolean acceptsURI(String uri)
throws XMLDBException
acceptsURI determines whether this Database
implementation
can handle the URI. It should return true
if the Database instance knows how to handle the URI and false otherwise.
uri
- the URI to check for.
- true if the URI can be handled, false otherwise.
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.
getCollection
public Collection getCollection(String uri,
String username,
String password)
throws XMLDBException
Retrieves a
Collection
instance based on the URI provided
in the
uri
parameter. The format of the URI is defined in the
documentation for DatabaseManager.getCollection().
Authentication is handled via username and password however it is not
required that the database support authentication. Databases that do not
support authentication MUST ignore the
username
and
password
if those provided are not
null.
uri
- the URI to use to locate the collection.password
- The password to use for authentication to the database or
null if the database does not support authentication.
- A
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.PERMISSION_DENIED
If the username
and password
were not accepted by the database.
getConformanceLevel
public String getConformanceLevel()
throws XMLDBException
Returns the XML:DB API Conformance level for the implementation. This can
be used by client programs to determine what functionality is available to
them.
- the XML:DB API conformance level for this implementation.
XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.
getName
public String getName()
throws XMLDBException
Returns the name associated with the Database instance.
XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.