Public Member Functions | List of all members
StaticCollectionManager Class Reference

Using the StaticCollectionManager one can retrieve information about statically declared collections and indexes as well as manage them. More...

Public Member Functions

ItemSequence availableCollections ()
 This function returns a sequence of names of the collections that are available.
ItemSequence availableIndexes ()
 This function returns a sequence of names of the indexes that are available.
void createCollection (const Item &aName)
 This function creates the collection with the given name.
void createCollection (const Item &aName, const ItemSequence &aContents)
 This function creates the collection with the given name.
void createIndex (const Item &aQName)
 Create the index with the given name.
ItemSequence declaredCollections ()
 List all the collections that are declared in the XQuery or the StaticContext that was used to retrieve this StaticCollectionManager.
ItemSequence declaredIndexes ()
 List all the indexes that are declared in the XQuery or the StaticContext that was used to retrieve this StaticCollectionManager.
void deleteCollection (const Item &aName)
 This function removes the collection with the given name.
void deleteIndex (const Item &aQName)
 Create the index with the given name.
Collection getCollection (const Item &aName)
 Returns a instance of the Collection class which can be used to modify and retrieve the contents of the collection identified by the given name.
bool isAvailableCollection (const Item &aName)
 This function returns true if a collection with the given name is available.
bool isAvailableIndex (const Item &aQName)
 This function returns true if a index with the given name is available.
bool isDeclaredCollection (const Item &aQName)
 Checks if a collection with a given QName is declared in the XQuery or the StaticContext that was used to retrieve this StaticCollectionManager.
bool isDeclaredIndex (const Item &aQName)
 Checks if a index with a given QName is declared in the XQuery or the StaticContext that was used to retrieve this StaticCollectionManager.
void registerDiagnosticHandler (DiagnosticHandler *aDiagnosticHandler)
 Register a DiagnosticHandler to which errors occuring during the management of collections are reported.
 StaticCollectionManager (const StaticCollectionManager &aMgr)
 StaticCollectionManager (zorba::StaticCollectionManager *aMgr)

Detailed Description

Using the StaticCollectionManager one can retrieve information about statically declared collections and indexes as well as manage them.

The StaticCollectionManager can be retrieved from (1) a compiled XQuery or (2) a StaticContext object. In both cases, this class provides access to information for the collections and indexes that are declared in (1) all the modules (transitively) imported by the main query or (2) the module that resulted in the compilation of the StaticContext, respectively. Moreover, this class allows to create or delete such collections and indexes.

Definition at line 30 of file StaticCollectionManager.h.

Constructor & Destructor Documentation

StaticCollectionManager::StaticCollectionManager ( const StaticCollectionManager aMgr)

Definition at line 36 of file StaticCollectionManager.h.

StaticCollectionManager::StaticCollectionManager ( zorba::StaticCollectionManager *  aMgr)

Definition at line 37 of file StaticCollectionManager.h.

Member Function Documentation

ItemSequence StaticCollectionManager::availableCollections ( )

This function returns a sequence of names of the collections that are available.

If this is an instance of the StaticCollectionManager class (i.e. returned by any of the getStaticCollectionManager methods), the collections returned by this function are also statically declared.

Returns
The list of names of the available collections.
ItemSequence StaticCollectionManager::availableIndexes ( )

This function returns a sequence of names of the indexes that are available.

Returns
The list of names of the available indexes.
void StaticCollectionManager::createCollection ( const Item aName)

This function creates the collection with the given name.

Parameters
aNameThe name of the collection to create.
Exceptions
XDDY0002if a collection with the given name already exists.
void StaticCollectionManager::createCollection ( const Item aName,
const ItemSequence aContents 
)

This function creates the collection with the given name.

Moreover, it adds copies of the sequence aContents to the new collection.

Parameters
aNameThe name of the collection to create.
aContentsThe sequence of items.
Exceptions
XDDY0002if a collection with the given name already exists.
void StaticCollectionManager::createIndex ( const Item aQName)

Create the index with the given name.

Parameters
aQNameThe name of the index to create.
Exceptions
zerr:ZDDY0021if a index with the given name is not declared.
zerr:ZDDY0022if a index with the given name already exists.
ItemSequence StaticCollectionManager::declaredCollections ( )

List all the collections that are declared in the XQuery or the StaticContext that was used to retrieve this StaticCollectionManager.

Returns
a sequence of QNames of all said collections
ItemSequence StaticCollectionManager::declaredIndexes ( )

List all the indexes that are declared in the XQuery or the StaticContext that was used to retrieve this StaticCollectionManager.

Returns
a sequence of QNames of all said indexes
void StaticCollectionManager::deleteCollection ( const Item aName)

This function removes the collection with the given name.

Parameters
aNameThe name of the collection to delete.
Exceptions
XDDY0003if the collection does not exist.
void StaticCollectionManager::deleteIndex ( const Item aQName)

Create the index with the given name.

Parameters
aQNameThe name of the index to create.
Exceptions
zerr:ZDDY0021if a index with the given name is not declared.
zerr:ZDDY0009if a index with the given name does not exist
Collection StaticCollectionManager::getCollection ( const Item aName)

Returns a instance of the Collection class which can be used to modify and retrieve the contents of the collection identified by the given name.

Parameters
aNameThe name of the collection to retrieve.
Exceptions
XDDY0003if the collection does not exist.
bool StaticCollectionManager::isAvailableCollection ( const Item aName)

This function returns true if a collection with the given name is available.

If this is an instance of the StaticCollectionManager class (i.e. returned by any of the getStaticCollectionManager() methods), the collection also needs to be statically declared.

Parameters
aNameThe name of the collection that is being checked.
Returns
true if the collection is available and false otherwise.
bool StaticCollectionManager::isAvailableIndex ( const Item aQName)

This function returns true if a index with the given name is available.

Parameters
aQNameThe name of the index that is being checked.
Returns
true if the index is available and false otherwise.
bool StaticCollectionManager::isDeclaredCollection ( const Item aQName)

Checks if a collection with a given QName is declared in the XQuery or the StaticContext that was used to retrieve this StaticCollectionManager.

Returns
true if a collection with the given name is declared, false otherwise.
bool StaticCollectionManager::isDeclaredIndex ( const Item aQName)

Checks if a index with a given QName is declared in the XQuery or the StaticContext that was used to retrieve this StaticCollectionManager.

Returns
true if a collection with the given name is declared, false otherwise.
void StaticCollectionManager::registerDiagnosticHandler ( DiagnosticHandler aDiagnosticHandler)

Register a DiagnosticHandler to which errors occuring during the management of collections are reported.

If no DiagnosticHandler has been set using this function or the corresponding function of the XmlDataManager then subclasses of the ZorbaException class are thrown to report errors.

Parameters
aDiagnosticHandlerDiagnosticHandler to which errors are reported. The caller retains ownership over the DiagnosticHandler passed as parameter.

The documentation for this class was generated from the following file:
blog comments powered by Disqus