org.basex.api.xmldb
Class BXDatabase

java.lang.Object
  extended by org.basex.api.xmldb.BXDatabase
All Implemented Interfaces:
BXXMLDBText, Configurable, Database

public final class BXDatabase
extends java.lang.Object
implements Database, BXXMLDBText

Implementation of the Database Interface for the XMLDB:API.

Author:
Workgroup DBIS, University of Konstanz 2005-08, ISC License, Andreas Weiler

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
BXDatabase()
           
 
Method Summary
 boolean acceptsURI(java.lang.String uri)
          acceptsURI determines whether this Database implementation can handle the URI.
 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 name associated with the Database instance.
 java.lang.String getProperty(java.lang.String key)
          Returns the value of the property identified by name.
 void setProperty(java.lang.String key, java.lang.String value)
          Sets the property name to have the value provided in value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BXDatabase

public BXDatabase()
Method Detail

acceptsURI

public boolean acceptsURI(java.lang.String uri)
                   throws XMLDBException
Description copied from interface: Database
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.

Specified by:
acceptsURI in interface Database
Parameters:
uri - the URI to check for.
Returns:
true if the URI can be handled, false otherwise.
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.

getCollection

public Collection getCollection(java.lang.String uri,
                                java.lang.String username,
                                java.lang.String password)
                         throws XMLDBException
Description copied from interface: Database
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 Database
Parameters:
uri - the URI to use to locate the collection.
username - the Username 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:
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 java.lang.String getConformanceLevel()
Description copied from interface: Database
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 Database
Returns:
the XML:DB API conformance level for this implementation.

getName

public java.lang.String getName()
Description copied from interface: Database
Returns the name associated with the Database instance.

Specified by:
getName in interface Database
Returns:
the name of the object.

getProperty

public java.lang.String getProperty(java.lang.String key)
Description copied from interface: Configurable
Returns the value of the property identified by name.

Specified by:
getProperty in interface Configurable
Parameters:
key - the name of the property to retrieve.
Returns:
the property value or null if no property exists.

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
                 throws XMLDBException
Description copied from interface: Configurable
Sets the property name to have the value provided in value.

Specified by:
setProperty in interface Configurable
Parameters:
key - the name of the property to set.
value - the value to set for the property.
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.