Xindice API
version 1.2m1

org.apache.xindice.client.xmldb
Class DatabaseImpl

java.lang.Object
  extended byorg.apache.xindice.client.xmldb.CommonConfigurable
      extended byorg.apache.xindice.client.xmldb.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

DatabaseImpl is the XML:DB driver implementation for Xindice. It is the entry point into the Xindice server but is not intended for direct use by users. Users access it indirectly through the XML:DB DatabaseManager implementation.

This API is an implementation of the XML:DB API. More information on this API can be found by looking at http://xmldb-org.sourceforge.net/xapi/index.html

This implementation simply acts as a proxy for the protocol specific API implementations.

Version:
$Revision: 541508 $, $Date: 2007-05-24 21:54:12 -0400 (Thu, 24 May 2007) $

Field Summary
static String CONFORMANCE_LEVEL
          The XML:DB API Core Level Conformance of this implementation.
protected  org.xmldb.api.base.Database driver
           
static String EMBED_URI
           
static String INSTANCE_NAME
          Name used in the uri for collections associated with this instance.
static String MANAGED_URI
           
static String XMLRPC_URI
          These are the URI prefixes this proxy impl understands.
 
Constructor Summary
DatabaseImpl()
          Constructor for the DatabaseImpl object
 
Method Summary
 boolean acceptsURI(String uri)
          Determines whether this Database implementation can handle the URI.
protected  void createDriver(String uri)
           
 org.xmldb.api.base.Collection getCollection(String uri, String username, String password)
          Creates a Collection instance using the URI to locate the collection in the Xindice instance.
 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.
protected  boolean knownPrefix(String uri)
           
 
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

driver

protected org.xmldb.api.base.Database driver

XMLRPC_URI

public static final String XMLRPC_URI
These are the URI prefixes this proxy impl understands. XML-RPC is the default.

See Also:
Constant Field Values

EMBED_URI

public static final String EMBED_URI
See Also:
Constant Field Values

MANAGED_URI

public static final String MANAGED_URI
See Also:
Constant Field Values

INSTANCE_NAME

public static final String INSTANCE_NAME
Name used in the uri for collections associated with this instance.

See Also:
Constant Field Values

CONFORMANCE_LEVEL

public static final String CONFORMANCE_LEVEL
The XML:DB API Core Level Conformance of this implementation.

See Also:
Constant Field Values
Constructor Detail

DatabaseImpl

public DatabaseImpl()
Constructor for the DatabaseImpl object

Method Detail

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.

getCollection

public org.xmldb.api.base.Collection getCollection(String uri,
                                                   String username,
                                                   String password)
                                            throws org.xmldb.api.base.XMLDBException
Creates a Collection instance using the URI to locate the collection in the Xindice instance. Applications should not call this method directly. Instead they should call DatabaseManager.getCollection(String, String, String).

The URI format accepted by this method: xindice://[Database Host]/[Database Instance Name]/[Collection Path]

Database host is optional. This usually looks something like this: xindice:///db/root/ocs or xindice://some.host.com:8309/db/root/ocs

When you pass the URI to DatabaseManager.getCollection(uri) you must prepend an xmldb: to the beginning to make it a valid XML:DB URI. So to normal users of the API URIs will look like this: xmldb:xindice:///db/root/ocs. DatabaseManager will strip the xmldb: before handing the URI to this getCollection implementation.

Specified by:
getCollection in interface org.xmldb.api.base.Database
Parameters:
uri - The URI specifing the location of the collection.
Returns:
The Collection value
Throws:
org.xmldb.api.base.XMLDBException

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.

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.

This method is called by org.xmldb.api.base.DatabaseManager.

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.
See Also:
for a description of the URI's format

createDriver

protected void createDriver(String uri)
                     throws org.xmldb.api.base.XMLDBException
Throws:
org.xmldb.api.base.XMLDBException

knownPrefix

protected boolean knownPrefix(String uri)

Xindice API
version 1.2m1

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