Xindice API

org.apache.xindice.core
Class Collection

java.lang.Object
  |
  +--org.apache.xindice.core.CollectionManager
        |
        +--org.apache.xindice.core.Collection
All Implemented Interfaces:
Configurable, DBObject, Disposable, Named
Direct Known Subclasses:
Database, SystemCollection

public class Collection
extends CollectionManager
implements Named, DBObject, Configurable

Collection represents a collection of Documents maintains links to the Filer storage implementation, the Indexes, and any XMLObjects that may be associated with the Collection.


Constructor Summary
Collection(Collection collection)
           
 
Method Summary
 boolean close()
          close closes the DBObject
 boolean create()
          create creates a new DBObject and any associated resources for the new DBObject, such as disk files, etc.
 Collection createCollection(java.lang.String path, Configuration config)
          createCollection creates a new Collection object and any associated system resources that the Collection will need.
 Indexer createIndexer(Configuration config)
          createIndexer creates a new Indexer object and any associated system resources that the Indexer will need.
 Key createNewOID()
          createNewOID allocates a new Object ID to be used as a Key in the Collection.
 XMLObject createXMLObject(Configuration config)
          createXMLObject creates a new XMLObject object and any associated system resources that the XMLObject will need.
 void dispose()
          dispose disposes of the object instance.
 boolean drop()
          drop instructs the DBObjectimplementation to remove itself from existence.
 boolean dropCollection(Collection collection)
          dropCollection physically removes the specified Collection and any associated system resources that the Collection uses.
 boolean dropIndexer(Indexer index)
          dropIndexer physically removes the specified Indexer and any associated system resources that the Indexer uses.
 boolean dropXMLObject(XMLObject xmlObject)
          dropXMLObject physically removes the specified XMLObject and any associated system resources that the XMLObject uses.
 boolean exists()
          exists returns whether or not a physical representation of this DBObject actually exists.
 void flushSymbolTable()
           
 java.lang.String getCanonicalDocumentName(Key key)
          getCanonicalDocumentName returns the canonical name for the specified Key in relation to this Collection.
 java.lang.String getCanonicalName()
          getCanonicalName returns the canonical name for this Object.
 java.io.File getCollectionRoot()
           
 Container getContainer(java.lang.Object docKey)
          getContainer retrieves a Container from the Collection.
 Database getDatabase()
          getDatabase returns the Database owner for this Collection.
 org.w3c.dom.Document getDocument(java.lang.Object docKey)
          getDocument retrieves a Document by Key.
 long getDocumentCount()
          getDocumentCount returns the count of Documents being maintained by this Collection.
 DocumentSet getDocumentSet()
          getDocumentSet returns the set of Documents being maintained by this Collection.
 Filer getFiler()
          getFiler returns the low-level Filer instances underlying the Collection instance.
 Indexer getIndexer(java.lang.String name)
          getIndexer retrieves an Indexer by name.
 IndexManager getIndexManager()
          return the IndexManager being used by this Collection.
 java.lang.String getName()
          getName retrieves the contextually important name of the object
 XMLSerializable getObject(java.lang.Object key)
          getObject instantiates and returns an XMLSerializable object based on the provided Key.
 Collection getParentCollection()
          getParentCollection returns the parent Collection of this Collection.
 QueryEngine getQueryEngine()
          getQueryEngine returns the Database's Query Engine
 SymbolTable getSymbols()
          getSymbols returns the SymbolTable in use by this Collection.
 SystemCollection getSystemCollection()
          getSystemCollection returns the System Collection.
 XMLObject getXMLObject(java.lang.String name)
          getXMLObject retrieves an XMLObject by name.
 XMLObjectManager getXMLObjectManager()
          getXMLObjectManager returns the Object's XMLObjectManager.
 Key insertDocument(org.w3c.dom.Document document)
          insertDocument inserts a new Document into a Xindice Collection.
 void insertDocument(java.lang.Object docKey, org.w3c.dom.Document document)
          insertDocument inserts a new Document into a Xindice Collection.
 void insertObject(java.lang.String key, XMLSerializable obj)
          insertObject inserts an XMLSerializable object into the Collection based on the specified Key.
 Key insertObject(XMLSerializable obj)
          insertObject inserts an XMLSerializable object into the Collection and returns a newly generated Key.
 boolean isOpened()
          isOpened returns whether or not the DBObject is opened for business.
 java.lang.String[] listDocuments()
          listDocuments returns a list of all document keys stored by this collection.
 java.lang.String[] listIndexers()
          listIndexers returns a list of the currently registered Indexers as an array of String.
 java.lang.String[] listXMLObjects()
          listXMLObjects returns a list of the currently registered XMLObjects as an array of String.
 boolean open()
          open opens the DBObject
 NodeSet queryCollection(java.lang.String style, java.lang.String query, NamespaceMap nsMap)
          queryCollection performs a query against the current collection using the specified style and query String.
 NodeSet queryDocument(java.lang.String style, java.lang.String query, NamespaceMap nsMap, java.lang.Object key)
          queryDocument performs a query against a single Document using the specified style, query string, and Document ID.
 void remove(java.lang.Object key)
          remove removes an object from the Collection based on its Key, regardless of it's type.
 void setConfig(Configuration config)
          setConfig sets the configuration information for the Configurable object instance.
 void setDocument(java.lang.Object docKey, org.w3c.dom.Document document)
          setDocument overwrites/updates an existing Document in a Xindice Collection.
 void setObject(java.lang.Object key, XMLSerializable obj)
          setObject sets an XMLSerializable object in the Collection based on the provided Key.
 
Methods inherited from class org.apache.xindice.core.CollectionManager
getCollection, getConfig, listCollections
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.xindice.util.Configurable
getConfig
 

Constructor Detail

Collection

public Collection(Collection collection)
Method Detail

setConfig

public void setConfig(Configuration config)
               throws XindiceException
Description copied from interface: Configurable
setConfig sets the configuration information for the Configurable object instance.
Specified by:
setConfig in interface Configurable
Overrides:
setConfig in class CollectionManager
Following copied from interface: org.apache.xindice.util.Configurable
Parameters:
config - The configuration Node

getName

public final java.lang.String getName()
Description copied from interface: Named
getName retrieves the contextually important name of the object
Specified by:
getName in interface Named
Following copied from interface: org.apache.xindice.util.Named
Returns:
The object's name

getCollectionRoot

public final java.io.File getCollectionRoot()

getParentCollection

public final Collection getParentCollection()
                                     throws DBException
getParentCollection returns the parent Collection of this Collection.
Returns:
The parent Collection (or null)

dropCollection

public final boolean dropCollection(Collection collection)
                             throws DBException
Description copied from class: CollectionManager
dropCollection physically removes the specified Collection and any associated system resources that the Collection uses.
Overrides:
dropCollection in class CollectionManager
Following copied from class: org.apache.xindice.core.CollectionManager
Parameters:
collection - The Collection to drop
Returns:
Whether or not the Collection was dropped

createCollection

public final Collection createCollection(java.lang.String path,
                                         Configuration config)
                                  throws DBException
Description copied from class: CollectionManager
createCollection creates a new Collection object and any associated system resources that the Collection will need.
Overrides:
createCollection in class CollectionManager
Following copied from class: org.apache.xindice.core.CollectionManager
Parameters:
path - The relative path of the Collection
cfg - The Collection's configuration
Returns:
The newly created Collection

getDatabase

public Database getDatabase()
getDatabase returns the Database owner for this Collection.
Returns:
The Database

getSystemCollection

public SystemCollection getSystemCollection()
                                     throws DBException
getSystemCollection returns the System Collection.
Returns:
The System Collection

getQueryEngine

public QueryEngine getQueryEngine()
                           throws DBException
getQueryEngine returns the Database's Query Engine
Returns:
The Query Engine

getIndexer

public final Indexer getIndexer(java.lang.String name)
                         throws DBException
getIndexer retrieves an Indexer by name.
Parameters:
name - The Indexer name
Returns:
The Indexer (or null)

listIndexers

public final java.lang.String[] listIndexers()
                                      throws DBException
listIndexers returns a list of the currently registered Indexers as an array of String.
Returns:
The Indexer list

dropIndexer

public final boolean dropIndexer(Indexer index)
                          throws DBException
dropIndexer physically removes the specified Indexer and any associated system resources that the Indexer uses.
Parameters:
index - The Indexer to drop
Returns:
Whether or not the Indexer was dropped

createIndexer

public final Indexer createIndexer(Configuration config)
                            throws DBException
createIndexer creates a new Indexer object and any associated system resources that the Indexer will need.
Parameters:
config - The Indexer's configuration
Returns:
The newly created Indexer

getFiler

public final Filer getFiler()
getFiler returns the low-level Filer instances underlying the Collection instance.
Returns:
The requested Filer

getIndexManager

public final IndexManager getIndexManager()
                                   throws DBException
return the IndexManager being used by this Collection.
Returns:
The IndexManager

getXMLObjectManager

public final XMLObjectManager getXMLObjectManager()
                                           throws DBException
getXMLObjectManager returns the Object's XMLObjectManager.
Returns:
The XMLObjectManager

getXMLObject

public final XMLObject getXMLObject(java.lang.String name)
                             throws DBException
getXMLObject retrieves an XMLObject by name.
Parameters:
name - The XMLObject's name
Returns:
The XMLObject (or null)

listXMLObjects

public java.lang.String[] listXMLObjects()
                                  throws DBException
listXMLObjects returns a list of the currently registered XMLObjects as an array of String.
Returns:
The XMLObject list

dropXMLObject

public final boolean dropXMLObject(XMLObject xmlObject)
                            throws DBException
dropXMLObject physically removes the specified XMLObject and any associated system resources that the XMLObject uses.
Parameters:
xmlObject - The XMLObject to drop
Returns:
Whether or not the XMLObject was dropped

createXMLObject

public final XMLObject createXMLObject(Configuration config)
                                throws DBException
createXMLObject creates a new XMLObject object and any associated system resources that the XMLObject will need.
Parameters:
config - The XMLObject's configuration
Returns:
The newly created XMLObject

getSymbols

public final SymbolTable getSymbols()
                             throws DBException
getSymbols returns the SymbolTable in use by this Collection.
Returns:
The Symbol Table

getCanonicalName

public final java.lang.String getCanonicalName()
getCanonicalName returns the canonical name for this Object.
ex: /local/test/ocs
Returns:
The canonical name

getCanonicalDocumentName

public final java.lang.String getCanonicalDocumentName(Key key)
getCanonicalDocumentName returns the canonical name for the specified Key in relation to this Collection.
ex: /local/test/ocs/ytd
Parameters:
key - The Key
Returns:
The canonical name

open

public final boolean open()
                   throws DBException
Description copied from interface: DBObject
open opens the DBObject
Specified by:
open in interface DBObject
Following copied from interface: org.apache.xindice.core.DBObject
Returns:
Whether or not the DBObject was opened

isOpened

public boolean isOpened()
                 throws DBException
Description copied from interface: DBObject
isOpened returns whether or not the DBObject is opened for business.
Specified by:
isOpened in interface DBObject
Following copied from interface: org.apache.xindice.core.DBObject
Returns:
The open status of the DBObject

exists

public boolean exists()
               throws DBException
Description copied from interface: DBObject
exists returns whether or not a physical representation of this DBObject actually exists. In the case of a HashFiler, this would check for the file, and in the case of an FTPFiler, it might perform a connection check.
Specified by:
exists in interface DBObject
Following copied from interface: org.apache.xindice.core.DBObject
Returns:
Whether or not the physical resource exists

close

public boolean close()
              throws DBException
Description copied from interface: DBObject
close closes the DBObject
Specified by:
close in interface DBObject
Following copied from interface: org.apache.xindice.core.DBObject
Returns:
Whether or not the DBObject was closed

create

public boolean create()
               throws DBException
Description copied from interface: DBObject
create creates a new DBObject and any associated resources for the new DBObject, such as disk files, etc.
Specified by:
create in interface DBObject
Following copied from interface: org.apache.xindice.core.DBObject
Returns:
Whether or not the DBObject was created

drop

public boolean drop()
             throws DBException
Description copied from interface: DBObject
drop instructs the DBObjectimplementation to remove itself from existence. The DBObject's parent is responsible for removing any references to the DBObject in its own context.
Specified by:
drop in interface DBObject
Following copied from interface: org.apache.xindice.core.DBObject
Returns:
Whether or not the DBObject was dropped

createNewOID

public final Key createNewOID()
createNewOID allocates a new Object ID to be used as a Key in the Collection.
Returns:
The newly generated Key

flushSymbolTable

public final void flushSymbolTable()
                            throws DBException

insertDocument

public final Key insertDocument(org.w3c.dom.Document document)
                         throws DBException
insertDocument inserts a new Document into a Xindice Collection.
Parameters:
document - The Document
Returns:
The new Object Identifier

insertDocument

public final void insertDocument(java.lang.Object docKey,
                                 org.w3c.dom.Document document)
                          throws DBException
insertDocument inserts a new Document into a Xindice Collection.
Parameters:
docKey - The document Key
value - The Document

setDocument

public final void setDocument(java.lang.Object docKey,
                              org.w3c.dom.Document document)
                       throws DBException
setDocument overwrites/updates an existing Document in a Xindice Collection.
Parameters:
docKey - The Document Key
document - The Document

remove

public final void remove(java.lang.Object key)
                  throws DBException
remove removes an object from the Collection based on its Key, regardless of it's type.
Parameters:
key - The Object's Key

getDocument

public final org.w3c.dom.Document getDocument(java.lang.Object docKey)
                                       throws DBException
getDocument retrieves a Document by Key.
Parameters:
docKey - The Document Key
Returns:
The Document

getContainer

public final Container getContainer(java.lang.Object docKey)
                             throws DBException
getContainer retrieves a Container from the Collection. The Container encapsulates all information needed in dealing with a Document outside of the context of a Collection (ex: DocumentContext).
Parameters:
docKey - The Document Key
Returns:
The Container

getObject

public final XMLSerializable getObject(java.lang.Object key)
                                throws DBException
getObject instantiates and returns an XMLSerializable object based on the provided Key. Xindice takes care of instantiating the correct class, but only if a class was registered with the Document in the first place.
Parameters:
key - The Document Key
Returns:
an Castable XMLSerializable Instance

setObject

public final void setObject(java.lang.Object key,
                            XMLSerializable obj)
                     throws DBException
setObject sets an XMLSerializable object in the Collection based on the provided Key. Xindice takes care of associating the implementation class with the XMLSerializable object.
Parameters:
key - The Key to use
obj - The Object to set

insertObject

public final Key insertObject(XMLSerializable obj)
                       throws DBException
insertObject inserts an XMLSerializable object into the Collection and returns a newly generated Key. Xindice takes care of associating the implementation class with the XMLSerializable object.
Parameters:
obj - The Object to insert
Returns:
The newly generated Key

insertObject

public final void insertObject(java.lang.String key,
                               XMLSerializable obj)
                        throws DBException
insertObject inserts an XMLSerializable object into the Collection based on the specified Key. Xindice takes care of associating the implementation class with the XMLSerializable object.
Parameters:
key - The Key to use
obj - The Object to insert

queryCollection

public final NodeSet queryCollection(java.lang.String style,
                                     java.lang.String query,
                                     NamespaceMap nsMap)
                              throws DBException
queryCollection performs a query against the current collection using the specified style and query String.
Parameters:
style - The query style to use (ex: XPath)
query - The query to execute
nsMap - The namespace Map (if any)
Returns:
The resulting NodeSet

queryDocument

public final NodeSet queryDocument(java.lang.String style,
                                   java.lang.String query,
                                   NamespaceMap nsMap,
                                   java.lang.Object key)
                            throws DBException
queryDocument performs a query against a single Document using the specified style, query string, and Document ID.
Parameters:
style - The query style to use (ex: XPath)
query - The query to execute
nsMap - The namespace Map (if any)
key - The Document to query
Returns:
The resulting NodeSet

getDocumentSet

public final DocumentSet getDocumentSet()
                                 throws DBException
getDocumentSet returns the set of Documents being maintained by this Collection.
Returns:
The DocumentSet

listDocuments

public final java.lang.String[] listDocuments()
                                       throws DBException
listDocuments returns a list of all document keys stored by this collection.
Returns:
the list of document keys

getDocumentCount

public final long getDocumentCount()
                            throws DBException
getDocumentCount returns the count of Documents being maintained by this Collection.
Returns:
The Document count

dispose

public void dispose()
Description copied from interface: Disposable
dispose disposes of the object instance.
Overrides:
dispose in class CollectionManager

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation