org.xmldb.api.reference
Class DatabaseImpl

java.lang.Object
  extended by org.xmldb.api.sdk.SimpleConfigurable
      extended by org.xmldb.api.sdk.SimpleDatabase
          extended by org.xmldb.api.reference.DatabaseImpl
All Implemented Interfaces:
Configurable, Database

public class DatabaseImpl
extends SimpleDatabase

Reference Database implmentation. The reference Database simply resides on the file system. It isn't speedy but it serves the purpose of illustrating how a driver should work..

The path where the data files are located is specified through the property xmldb.data.dir. If this property is not specified it defaults to a directory named data in the current working directory. If the directory does not exist an attempt will be made to create it.


Field Summary
protected static java.lang.String DATA_PREFIX
          The default directory to look for to find the data files.
protected static java.lang.String DIR_PROP
          The property to look for to set the directory
protected static java.lang.String SEP
          The characters expected to separate the INSTANCE_NAME from the file system path
 
Fields inherited from class org.xmldb.api.sdk.SimpleDatabase
CONFORMANCE_LEVEL, INSTANCE_NAME
 
Constructor Summary
DatabaseImpl()
           
 
Method Summary
 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.
 
Methods inherited from class org.xmldb.api.sdk.SimpleDatabase
acceptsURI, getConformanceLevel, getName
 
Methods inherited from class org.xmldb.api.sdk.SimpleConfigurable
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
 

Field Detail

SEP

protected static final java.lang.String SEP
The characters expected to separate the INSTANCE_NAME from the file system path

See Also:
Constant Field Values

DIR_PROP

protected static final java.lang.String DIR_PROP
The property to look for to set the directory

See Also:
Constant Field Values

DATA_PREFIX

protected static final java.lang.String DATA_PREFIX
The default directory to look for to find the data files.

See Also:
Constant Field Values
Constructor Detail

DatabaseImpl

public DatabaseImpl()
Method Detail

getCollection

public Collection getCollection(java.lang.String uri,
                                java.lang.String username,
                                java.lang.String password)
                         throws XMLDBException
Retrieves a Collection instance based on the URI provided in the uri parameter. The URI format for this implementation is ref:///path where path is a path in the file system. To locate the data files the database expects a directory data to exist in the current directory.

Specified by:
getCollection in interface Database
Overrides:
getCollection in class SimpleDatabase
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:
The Collection instance
Throws:
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.