org.apache.xindice.client.xmldb.embed
Class DatabaseImpl
java.lang.Object
|
+--org.apache.xindice.client.xmldb.CommonConfigurable
|
+--org.apache.xindice.client.xmldb.embed.DatabaseImpl
- All Implemented Interfaces:
- org.xmldb.api.base.Configurable, org.xmldb.api.base.Database
- public class DatabaseImpl
- extends CommonConfigurable
- implements org.xmldb.api.base.Database
implements XML:DB's Database
interface providing
embedded access to a Xindice database.
- Version:
- CVS $Revision: 1.21 $, $Date: 2003/12/14 18:02:14 $
- Author:
- Kimbro Staken, James Bates, Vladimir R. Bossicard
Field Summary |
static java.lang.String |
DRIVER_NAME
Prefix used to denote XML:DB URI's that should use this driver |
Method Summary |
boolean |
acceptsURI(java.lang.String uri)
Determines whether this Database implementation can handle
the URI. |
org.xmldb.api.base.Collection |
getCollection(java.lang.String uri,
java.lang.String userName,
java.lang.String password)
Retrieves a Collection instance based on the URI provided
in the uri parameter. |
java.lang.String |
getConformanceLevel()
Returns the XML:DB API Conformance level for the implementation. |
java.lang.String |
getName()
Returns the prefix used in XML:DB to denote URI's that this driver can
handle. |
protected Configuration |
loadConfiguration()
|
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 |
DRIVER_NAME
public static final java.lang.String DRIVER_NAME
- Prefix used to denote XML:DB URI's that should use this driver
DatabaseImpl
public DatabaseImpl()
throws java.io.IOException,
XindiceException
- Creates new
DatabaseImpl
instance. The configuration is
loaded from the file defined in the PROP_XINDICE_CONFIGURATION system
variable.
DatabaseImpl
public DatabaseImpl(CommonConfigurable config)
throws java.io.IOException,
XindiceException
- Create a new DatabaseImpl object with a copy of the properties
from the DatabaseImpl parameter.
This allows to pass properties such as PROP_XINDICE_CONFIGURATION
to this instance. Usually this is done by instantiating not this
class, but
org.apache.xindice.client.xmldb.DatabaseImpl
,
set all the necessary parameters, and then get a collection.
- Parameters:
config
- from which the initial parameters for this
DatabaseImpl object are copied.
loadConfiguration
protected Configuration loadConfiguration()
throws java.io.IOException,
XindiceException
acceptsURI
public boolean acceptsURI(java.lang.String uri)
throws org.xmldb.api.base.XMLDBException
- 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.
- Specified by:
acceptsURI
in interface org.xmldb.api.base.Database
- Parameters:
uri
- the URI to check for.- Returns:
- true if the URI can be handled, false otherwise.
- Throws:
org.xmldb.api.base.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 org.xmldb.api.base.Collection getCollection(java.lang.String uri,
java.lang.String userName,
java.lang.String password)
throws org.xmldb.api.base.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.
- Specified by:
getCollection
in interface org.xmldb.api.base.Database
- Parameters:
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.- Returns:
- A
Collection
instance for the requested collection or
null if the collection could not be found. - Throws:
org.xmldb.api.base.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.
getName
public java.lang.String getName()
throws org.xmldb.api.base.XMLDBException
- Returns the prefix used in XML:DB to denote URI's that this driver can
handle.
- Specified by:
getName
in interface org.xmldb.api.base.Database
- Returns:
- the prefix driver name
- Throws:
org.xmldb.api.base.XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.
getConformanceLevel
public java.lang.String getConformanceLevel()
throws org.xmldb.api.base.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.
- Specified by:
getConformanceLevel
in interface org.xmldb.api.base.Database
- Returns:
- the XML:DB API conformance level for this implementation.
- Throws:
org.xmldb.api.base.XMLDBException
- with expected error codes.
ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.
Copyright (c) 1999-2003 The Apache Software Foundation. All Rights Reserved.