Xindice API
version 1.1

org.apache.xindice.client.xmldb.xmlrpc
Class DatabaseImpl

java.lang.Object
  |
  +--org.apache.xindice.client.xmldb.CommonConfigurable
        |
        +--org.apache.xindice.client.xmldb.xmlrpc.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 using XML-RPC to communicate with the Xindice XML-RPC server. Usually, this class is not used directly, but DatabaseImpl is used instead. Note this class is a database driver, and one class of this database could be used to connect to many different databases, on one or different Xindice XML-RPC servers. XML-RPC database driver uses following configuration parameters:

If one of these parameters is not specified, system properties will be used.

Version:
$Revision: 511426 $, $Date: 2007-02-24 22:25:02 -0500 (Sat, 24 Feb 2007) $
Author:
James Bates, Vadim Gritsenko

Field Summary
static String DRIVER_NAME
          Prefix used to denote XML:DB URI's that should use this driver
static String PROP_SERVICE_LOCATION
          Driver property name for the xml-rpc service location.
static String PROP_XMLRPC_DRIVER
          Driver property name for the SAX parser xml-rpc will use.
static String PROP_XMLRPC_PASSWORD
          Driver property name for the basic authentication password.
static String PROP_XMLRPC_USER
          Driver property name for the basic authentication user name.
static String SYSPROP_SERVICE_LOCATION
          System property name for the service location
static String SYSPROP_XMLRPC_DRIVER
          System property name for the SAX parser xml-rpc will use in case there were no configuration property passed
static String SYSPROP_XMLRPC_PASSWORD
          System property name for the basic authentication password in case there were no configuration property passed
static String SYSPROP_XMLRPC_USER
          System property name for the basic authentication user name in case there were no configuration property passed
 
Fields inherited from class org.apache.xindice.client.xmldb.CommonConfigurable
config
 
Constructor Summary
DatabaseImpl()
          Create a new DatabaseImpl object.
DatabaseImpl(CommonConfigurable config)
          Create a new DatabaseImpl object with a copy of the properties from the DatabaseImpl parameter.
 
Method Summary
 boolean acceptsURI(String uri)
          Determines whether this Database implementation can handle the URI.
 org.xmldb.api.base.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 prefix used in XML:DB to denote URI's that this driver can handle.
 String[] getNames()
          Returns an array of names associated with the Database instance.
 
Methods inherited from class org.apache.xindice.client.xmldb.CommonConfigurable
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

PROP_SERVICE_LOCATION

public static final String PROP_SERVICE_LOCATION
Driver property name for the xml-rpc service location.

SYSPROP_SERVICE_LOCATION

public static final String SYSPROP_SERVICE_LOCATION
System property name for the service location

PROP_XMLRPC_DRIVER

public static final String PROP_XMLRPC_DRIVER
Driver property name for the SAX parser xml-rpc will use.

SYSPROP_XMLRPC_DRIVER

public static final String SYSPROP_XMLRPC_DRIVER
System property name for the SAX parser xml-rpc will use in case there were no configuration property passed

PROP_XMLRPC_USER

public static final String PROP_XMLRPC_USER
Driver property name for the basic authentication user name.

SYSPROP_XMLRPC_USER

public static final String SYSPROP_XMLRPC_USER
System property name for the basic authentication user name in case there were no configuration property passed

PROP_XMLRPC_PASSWORD

public static final String PROP_XMLRPC_PASSWORD
Driver property name for the basic authentication password.

SYSPROP_XMLRPC_PASSWORD

public static final String SYSPROP_XMLRPC_PASSWORD
System property name for the basic authentication password in case there were no configuration property passed

DRIVER_NAME

public static final String DRIVER_NAME
Prefix used to denote XML:DB URI's that should use this driver
Constructor Detail

DatabaseImpl

public DatabaseImpl()
Create a new DatabaseImpl object.

DatabaseImpl

public DatabaseImpl(CommonConfigurable config)
Create a new DatabaseImpl object with a copy of the properties from the DatabaseImpl parameter.
Parameters:
config - from which the initial parameters for this DatabaseImpl object are copied.
Method Detail

acceptsURI

public boolean acceptsURI(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(String uri,
                                                   String userName,
                                                   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 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.

getNames

public String[] getNames()
                  throws org.xmldb.api.base.XMLDBException
Returns an array of names associated with the Database instance.
Specified by:
getNames in interface org.xmldb.api.base.Database
Returns:
the array of name of the object.
Throws:
org.xmldb.api.base.XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.

getConformanceLevel

public 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.

Xindice API
version 1.1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.