zorba::Zorba Class Reference

The Zorba class is the single point of access to the Zorba engine. More...

#include <zorba/zorba.h>

List of all members.

Public Member Functions

virtual XQuery_t compileQuery (std::istream &aQuery, const StaticContext_t &aContext, const Zorba_CompilerHints_t &aCompilerHints, ErrorHandler *aErrorHandler=0)=0
 Creates and compiles an XQuery object using the given CompilerHints and StaticContext.
virtual XQuery_t compileQuery (std::istream &aQuery, const Zorba_CompilerHints_t &aCompilerHints, ErrorHandler *aErrorHandler=0)=0
 Creates and compiles an XQuery object using the given CompilerHints.
virtual XQuery_t compileQuery (std::istream &aQuery, const StaticContext_t &aContext, ErrorHandler *aErrorHandler=0)=0
 Creates and compiles an XQuery object using a StaticContext.
virtual XQuery_t compileQuery (std::istream &aQuery, ErrorHandler *aErrorHandler=0)=0
 Creates and compiles an XQuery object.
virtual XQuery_t compileQuery (const String &aQuery, const StaticContext_t &aContext, const Zorba_CompilerHints_t &aCompilerHints, ErrorHandler *aErrorHandler=0)=0
 Creates and compiles an XQuery object using the given CompilerHints and StaticContext.
virtual XQuery_t compileQuery (const String &aQuery, const Zorba_CompilerHints_t &aCompilerHints, ErrorHandler *aErrorHandler=0)=0
 Creates and compiles an XQuery object using the given CompilerHints.
virtual XQuery_t compileQuery (const String &aQuery, const StaticContext_t &aContext, ErrorHandler *aErrorHandler=0)=0
 Creates and compiles an XQuery object using a StaticContext.
virtual XQuery_t compileQuery (const String &aQuery, ErrorHandler *aErrorHandler=0)=0
 Creates and compiles an XQuery object.
virtual XQuery_t createQuery (ErrorHandler *aErrorHandler=0)=0
 Creates an XQuery object.
virtual StaticContext_t createStaticContext (ErrorHandler *aErrorHandler=0)=0
 Creates a new StaticContext.
virtual ItemFactorygetItemFactory ()=0
 Gets the singelton instance of the ItemFactory.
virtual XmlDataManagergetXmlDataManager ()=0
 Gets the singleton instance of the XmlDataManager object.
virtual bool registerStatelessGlobalExternalFunction (StatelessExternalFunction *aExternalFunction)=0
 Registers a stateless external function globally.
virtual void shutdown ()=0
 Releases all resources aquired by the Zorba XQuery Engine.
virtual ~Zorba ()
 Destructor.

Static Public Member Functions

static ZorbagetInstance (void *store)
 Gets the singleton instance of the Zorba object.
static const Versionversion ()
 Get information about the used version of Zorba.


Detailed Description

The Zorba class is the single point of access to the Zorba engine.

There exists one instance of the Zorba class per process. It can be used to (1) create and compile queries, (2) create static contexts, (3) provides access to the XmlDataManager, and (4) provides access to the ItemFactory.

Examples:

context.cpp, datamanager.cpp, errors.cpp, external_functions.cpp, sax2.cpp, serialization.cpp, and simple.cpp.

Definition at line 48 of file zorba.h.


Constructor & Destructor Documentation

virtual zorba::Zorba::~Zorba (  )  [virtual]

Destructor.

The destructor is called during static deinitialization if getInstance has been called at least once before.


Member Function Documentation

virtual XQuery_t zorba::Zorba::compileQuery ( std::istream &  aQuery,
const StaticContext_t aContext,
const Zorba_CompilerHints_t aCompilerHints,
ErrorHandler aErrorHandler = 0 
) [pure virtual]

Creates and compiles an XQuery object using the given CompilerHints and StaticContext.

This methods creates an XQuery object and compiles the query that is passed to this method as an input stream. Compilation and optimization is done with respect to the given CompilerHints. Moreover, compilation is done using the information contained in the StaticContext.

Optionally, this method takes an ErrorHandler as parameter. In the case an ErrorHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not ErrorHandler is given, exceptions are thrown for each of these errors.

Parameters:
aQuery the input stream providing the query.
aContext the StaticContext that contains information used for compiling the query.
aCompilerHints the CompilerHints used to compile the query.
aErrorHandler the ErrorHandler to which errors should be reported.
Returns:
XQuery the newly created and compiled XQuery object.

virtual XQuery_t zorba::Zorba::compileQuery ( std::istream &  aQuery,
const Zorba_CompilerHints_t aCompilerHints,
ErrorHandler aErrorHandler = 0 
) [pure virtual]

Creates and compiles an XQuery object using the given CompilerHints.

This methods creates an XQuery object and compiles the query that is passed to this method as an input stream. Compilation and optimization is done with respect to the given CompilerHints.

Optionally, this method takes an ErrorHandler as parameter. In the case an ErrorHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not ErrorHandler is given, exceptions are thrown for each of these errors.

Parameters:
aQuery the input stream providing the query.
aCompilerHints the CompilerHints used to compile the query.
aErrorHandler the ErrorHandler to which errors should be reported.
Returns:
XQuery the newly created and compiled XQuery object.

virtual XQuery_t zorba::Zorba::compileQuery ( std::istream &  aQuery,
const StaticContext_t aContext,
ErrorHandler aErrorHandler = 0 
) [pure virtual]

Creates and compiles an XQuery object using a StaticContext.

This methods creates an XQuery object and compiles the query that is passed to this method as an input stream. Compilation is done using the information contained in the StaticContext that is passed as parameter.

Optionally, this method takes an ErrorHandler as parameter. In the case an ErrorHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not ErrorHandler is given, exceptions are thrown for each of these errors.

Parameters:
aQuery the input stream providing the query.
aContext the StaticContext that contains information used for compiling the query.
aErrorHandler the ErrorHandler to which errors should be reported.
Returns:
XQuery the newly created and compiled XQuery object.

virtual XQuery_t zorba::Zorba::compileQuery ( std::istream &  aQuery,
ErrorHandler aErrorHandler = 0 
) [pure virtual]

Creates and compiles an XQuery object.

This methods creates an XQuery object and compiles the query that is passed to this method as an input stream.

Optionally, this method takes an ErrorHandler as parameter. In the case an ErrorHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not ErrorHandler is given, exceptions are thrown for each of these errors.

Parameters:
aQuery the input stream providing the query.
aErrorHandler the ErrorHandler to which errors should be reported.
Returns:
XQuery the newly created and compiled XQuery object.

virtual XQuery_t zorba::Zorba::compileQuery ( const String aQuery,
const StaticContext_t aContext,
const Zorba_CompilerHints_t aCompilerHints,
ErrorHandler aErrorHandler = 0 
) [pure virtual]

Creates and compiles an XQuery object using the given CompilerHints and StaticContext.

This methods creates an XQuery object and compiles the query string passed to this method. Compilation and optimization is done with respect to the given CompilerHints. Moreover, compilation is done using the information contained in the StaticContext.

Optionally, this method takes an ErrorHandler as parameter. In the case an ErrorHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not ErrorHandler is given, exceptions are thrown for each of these errors.

Parameters:
aQuery the query string for the new XQuery object.
aContext the StaticContext that contains information used for compiling the query.
aCompilerHints the CompilerHints used to compile the query.
aErrorHandler the ErrorHandler to which errors should be reported.
Returns:
XQuery the newly created and compiled XQuery object.

virtual XQuery_t zorba::Zorba::compileQuery ( const String aQuery,
const Zorba_CompilerHints_t aCompilerHints,
ErrorHandler aErrorHandler = 0 
) [pure virtual]

Creates and compiles an XQuery object using the given CompilerHints.

This methods creates an XQuery object and compiles the query string passed to this method. Compilation and optimization is done with respect to the given CompilerHints.

Optionally, this method takes an ErrorHandler as parameter. In the case an ErrorHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not ErrorHandler is given, exceptions are thrown for each of these errors.

Parameters:
aQuery the query string for the new XQuery object.
aCompilerHints the CompilerHints used to compile the query.
aErrorHandler the ErrorHandler to which errors should be reported.
Returns:
XQuery the newly created and compiled XQuery object.

virtual XQuery_t zorba::Zorba::compileQuery ( const String aQuery,
const StaticContext_t aContext,
ErrorHandler aErrorHandler = 0 
) [pure virtual]

Creates and compiles an XQuery object using a StaticContext.

This methods creates an XQuery object and compiles the query string passed to this method. Compilation is done using the information contained in the StaticContext that is passed as parameter.

Optionally, this method takes an ErrorHandler as parameter. In the case an ErrorHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not ErrorHandler is given, exceptions are thrown for each of these errors.

Parameters:
aQuery the query string for the new XQuery object.
aContext the StaticContext that contains information used for compiling the query.
aErrorHandler the ErrorHandler to which errors should be reported.
Returns:
XQuery the newly created and compiled XQuery object.

virtual XQuery_t zorba::Zorba::compileQuery ( const String aQuery,
ErrorHandler aErrorHandler = 0 
) [pure virtual]

Creates and compiles an XQuery object.

This methods creates an XQuery object and compiles the query string passed to this method.

Optionally, this method takes an ErrorHandler as parameter. In the case an ErrorHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If not ErrorHandler is given, exceptions are thrown for each of these errors.

Parameters:
aQuery the query string for the new XQuery object.
aErrorHandler the ErrorHandler to which errors should be reported.
Returns:
XQuery the newly created and compiled XQuery object.
Examples:
context.cpp, datamanager.cpp, errors.cpp, external_functions.cpp, sax2.cpp, serialization.cpp, and simple.cpp.

virtual XQuery_t zorba::Zorba::createQuery ( ErrorHandler aErrorHandler = 0  )  [pure virtual]

Creates an XQuery object.

This methods creates an XQuery object without implicitliy assigning it a query. An object returned by this method can be compiled (see compileQuery).

Optionally, this method takes an ErrorHandler as parameter. In the case an ErrorHandler is passed as parameter, each error that occurs during compiling or executing the query, is reported to the passed error handler. If no ErrorHandler is given, exceptions are thrown for each of these errors.

Parameters:
aErrorHandler the ErrorHandler to which errors should be reported.
Returns:
XQuery the newly created XQuery object.
Examples:
simple.cpp.

virtual StaticContext_t zorba::Zorba::createStaticContext ( ErrorHandler aErrorHandler = 0  )  [pure virtual]

Creates a new StaticContext.

The method returns a StaticContext object that can be used for compiling a query. Instances of the StaticContext class are returned as a smart pointer. That is, objects of type StaticContext_t are reference counted object to an dynamically allocated StaticContext object. Hence, each object can h have multiple owners. The object is deleted if nobody holds on to an StaticContext_t object anymore.

Optionally, this method takes an ErrorHandler as parameter. In the case an ErrorHandler is passed as parameter, each error that occurs during setting or getting information out of the StaticContext, is reported to the passed ErrorHandler. If not ErrorHandler is given, exceptions are thrown for each of these errors.

Parameters:
aErrorHandler the ErrorHandler to which errors should be reported.
Returns:
StaticContext_t a new StaticContext object.
Examples:
context.cpp, and external_functions.cpp.

static Zorba* zorba::Zorba::getInstance ( void *  store  )  [static]

Gets the singleton instance of the Zorba object.

The Zorba object provides factory methods for creating and/or compiling XQuery objects, creating StaticContext objects, and accessing components as, for example, the ItemFactory or the XmlDataManager.

The first time this function is called, the Zorba Engine is initialized. Thereby, it initializes all the libraries that are used in the system, i.e. ICU, libxml2, xerces, and libcurl.

Returns:
Zorba the singleton Zorba object

virtual ItemFactory* zorba::Zorba::getItemFactory (  )  [pure virtual]

Gets the singelton instance of the ItemFactory.

Returns:
ItemFactory the singleton instance of the ItemFactory.
Examples:
context.cpp, datamanager.cpp, and simple.cpp.

virtual XmlDataManager* zorba::Zorba::getXmlDataManager (  )  [pure virtual]

Gets the singleton instance of the XmlDataManager object.

Returns:
XmlDataManager the singelton instance of the XmlDataManager.
Examples:
datamanager.cpp.

virtual bool zorba::Zorba::registerStatelessGlobalExternalFunction ( StatelessExternalFunction aExternalFunction  )  [pure virtual]

Registers a stateless external function globally.

Register an external function that can be called within a query, no matter in which context it is. The caller keeps the ownership of the StatelessExternalFunction object passed to this function.

Parameters:
aExternalFunction the stateless external function.
Returns:
true if the function has been set, false otherwise.

virtual void zorba::Zorba::shutdown (  )  [pure virtual]

Releases all resources aquired by the Zorba XQuery Engine.

Also releases resources aquired by the libraries used (i.e. icu, libxml2, xerces, libcurl).

Before calling shutdown, all xquery objects, items, contexts, ... have to be closed or gone out of scope; otherwise this call may fail.

After shutdown has been called, any calls to zorba are invalid.

getInstance may used to reinitialize the engine.

Examples:
context.cpp, datamanager.cpp, errors.cpp, external_functions.cpp, sax2.cpp, serialization.cpp, and simple.cpp.

static const Version& zorba::Zorba::version (  )  [static]

Get information about the used version of Zorba.

Returns:
Version informatino about the used Zorba version.


The documentation for this class was generated from the following file: