org.backsource.xindice
Class XindiceAdapter

java.lang.Object
  extended byorg.backsource.xindice.XindiceAdapter

public class XindiceAdapter
extends java.lang.Object

An adapter agains Xincice.

Farefully a ripp of from XmlBlaster: org.xmlBlaster.engine.persistence.xmldb.xindice.XindiceProxy.

Version:
$Revision: 1.1.1.1 $
Author:
Peter Antman

Constructor Summary
XindiceAdapter(java.lang.String url, java.lang.String col)
           
 
Method Summary
 void addDocument(org.w3c.dom.Node data, java.lang.String id)
           
 void addDocument(org.w3c.dom.Node data, java.lang.String id, boolean update)
          Adds a document to the database.
 void addDocument(java.lang.String data, java.lang.String id)
          Allows to add a document to the collection

The database needs to be running see Xindice for details.

 void closeCollection()
          Allows to close a collection

The database needs to be running see Xindice for details.

 void createCollection(java.lang.String colName)
          Allows to create a collection

The database needs to be running see Xindice for details.

 void deleteCollection(java.lang.String colName)
          Allows to delete a collection

The database needs to be running see Xindice for details.

 void deleteDocument(java.lang.String id)
          Allows to delete a document in the collection

The database needs to be running see Xindice for details.

 java.lang.String getCollection()
          Allows to get the name of a collection

 java.lang.String getCollectionName()
          Get the collection name, not including the base url.
 boolean hasDocument(java.lang.String id)
          Checks if this collection has a document matching the specified key.
 java.lang.String[] listCollection()
          Allows to list a collection

The database needs to be running see Xindice for details.

 java.lang.String[] listDocuments()
          Allows to list all document of the collection

The database needs to be running see Xindice for details.

 void openCollection()
          Allows to open a collection.
 void openCollection(java.lang.String path)
          Allows to set the path of a collection and to open it.
 org.xmldb.api.base.ResourceSet query(java.lang.String xpath)
           
 org.xmldb.api.base.ResourceSet query(java.lang.String id, java.lang.String xpath)
           
 java.lang.String retrieveDocument(java.lang.String id)
          Allows to retrieve a document from the collection

The database needs to be running see Xindice for details.

 void setCollection(java.lang.String path)
          Allows to set the name of the collection

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XindiceAdapter

public XindiceAdapter(java.lang.String url,
                      java.lang.String col)
               throws XindiceException
Method Detail

createCollection

public void createCollection(java.lang.String colName)
                      throws XindiceException
Allows to create a collection

The database needs to be running see Xindice for details.

This method stops with an log.error, if the database isn't open already.

Parameters:
colName - The Name of the collection
Throws:
XindiceException

deleteCollection

public void deleteCollection(java.lang.String colName)
                      throws XindiceException
Allows to delete a collection

The database needs to be running see Xindice for details.

This method stops with an log.error, if the database isn't open already.

Parameters:
colName - The Name of the collection
Throws:
XindiceException

openCollection

public void openCollection(java.lang.String path)
                    throws XindiceException
Allows to set the path of a collection and to open it.

The database needs to be running see Xindice for details.

This method stops with an log.error, if the database is open already.

Parameters:
path - The Path of the collection i.e. xmldb:xindice:///db/xmlBlaster
Throws:
XindiceException

openCollection

public void openCollection()
                    throws XindiceException
Allows to open a collection.

The database needs to be running see Xindice for details.

This method stops with an log.error, if the database is open already.

Throws:
XindiceException

closeCollection

public void closeCollection()
                     throws XindiceException
Allows to close a collection

The database needs to be running see Xindice for details.

This method stops with an log.error, if the database isn't open already.

Throws:
XindiceException

listCollection

public java.lang.String[] listCollection()
                                  throws XindiceException
Allows to list a collection

The database needs to be running see Xindice for details.

This method stops with an log.error, if the database isn't open already.

Throws:
XindiceException

setCollection

public void setCollection(java.lang.String path)
Allows to set the name of the collection

Parameters:
path - The Path of the collection i.e. xmldb:xindice:///db/xmlBlaster

getCollection

public java.lang.String getCollection()
Allows to get the name of a collection

Returns:
The Name of the collection

getCollectionName

public java.lang.String getCollectionName()
Get the collection name, not including the base url.


addDocument

public void addDocument(java.lang.String data,
                        java.lang.String id)
                 throws XindiceException
Allows to add a document to the collection

The database needs to be running see Xindice for details.

This method stops with an log.error, if the database isn't open already.

Parameters:
data - The data to be stored
id - The unique id of the stored data
Throws:
XindiceException

addDocument

public void addDocument(org.w3c.dom.Node data,
                        java.lang.String id)
                 throws XindiceException
Throws:
XindiceException

addDocument

public void addDocument(org.w3c.dom.Node data,
                        java.lang.String id,
                        boolean update)
                 throws XindiceException
Adds a document to the database. If update is true and the document exist, it is updated, if it does not exist it is added. If update is dalse and the document exist the method simply returns.

Parameters:
data - is the document
id - is the Xindice key
update - indicates whether to update the document or not.
Throws:
XindiceException

hasDocument

public boolean hasDocument(java.lang.String id)
                    throws XindiceException
Checks if this collection has a document matching the specified key.

Parameters:
id - is the document key
Throws:
XindiceException

retrieveDocument

public java.lang.String retrieveDocument(java.lang.String id)
                                  throws XindiceException
Allows to retrieve a document from the collection

The database needs to be running see Xindice for details.

This method stops with an log.error, if the database isn't open already.

Parameters:
id - The unique id of the stored data
Returns:
The stored data belonging to the id, null otherwise
Throws:
XindiceException

query

public org.xmldb.api.base.ResourceSet query(java.lang.String xpath)
                                     throws XindiceException
Throws:
XindiceException

query

public org.xmldb.api.base.ResourceSet query(java.lang.String id,
                                            java.lang.String xpath)
                                     throws XindiceException
Throws:
XindiceException

deleteDocument

public void deleteDocument(java.lang.String id)
                    throws XindiceException
Allows to delete a document in the collection

The database needs to be running see Xindice for details.

This method stops with an log.error, if the database isn't open already.

Parameters:
id - The unique id of the document to delete
Throws:
XindiceException

listDocuments

public java.lang.String[] listDocuments()
                                 throws XindiceException
Allows to list all document of the collection

The database needs to be running see Xindice for details.

This method stops with an log.error, if the database isn't open already.

Returns:
String[] Array containing the id's (unique key's) of all stored data
Throws:
XindiceException


Copyright © 2003-2004 Backsource. All Rights Reserved.