Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

XMLProcessor Class Reference

#include <xmlprocessor.hpp>

Collaboration diagram for XMLProcessor:

Collaboration graph
[legend]
List of all members.

Detailed Description

Entry point persistent class. class represents the XDFLengine server. is able to compile and excute clients requests. class is designed to be instanciated only once in an execution environment and to last as long as the host process. calls to execution members are reentrant and thread-safe.

Definition at line 66 of file xmlprocessor.hpp.

Public Methods

 XMLProcessor ()
 Constructor. Sets active URI, creates and attach Handlers to the processor.

 ~XMLProcessor ()
 Destructor. Kills processor handlers.

void setActiveURI (const char *p_pszActiveURI)
 Active URI property setter.

const char * getActiveURI ()
 Returns active URI.

void loadStreamerFactories ()
 Loads all streamer factories.

void loadValuers (XMLFlowContext *p_pContext) const
 Load all valuers.

void addStreamerFactory (XMLStreamerFactory *p_pXMLHandler, const char *p_pszName)
 Adds an XMLStreamerFactory object to the processor.

XMLStreamerFactorygetStreamerFactory (const char *p_pszName) const
 Returns an XMLHandler object, given its name.

void setContext (XMLFlowContext *p_pContext)
XMLFlowContextgetContext () const
void cacheScript (RootStreamNode *p_pRootNode, const char *p_pszCacheName, unsigned int p_uiThreadId=0)
const RootStreamNodegetCachedScript (const char *p_pszCacheName, unsigned int p_uiThreadId=0)
RootStreamNodecompile (XMLStreamProvider *p_pInput, unsigned int p_uiThreadId=0) const
int execute (const RootStreamNode *p_pRootNode, XMLStreamConsumer *p_pOutput, XMLFlowContext *p_pContext=0) const
int process (XMLStreamProvider *p_pInput, XMLStreamConsumer *p_pOutput, XMLFlowContext *p_pContext=0) const
void tick (unsigned long p_ulClock)
 Time ticker method. This method is to be called periodically by a separate thread for the handler to make its state maintenance tasks.


Static Public Methods

void init ()
 Processor initialisation method.
Enforce XMLProcessor prerequities (Xerces init).


void terminate ()
 Processor terminaison method.
Release XMLProcessor prerequities (Xerces terminate).


XMLStreamBuffergetNewBuffer (const char *p_pszBufferType=0, const char *p_pszFileName=0, bool p_fReadOnly=false, unsigned int p_uiBufferSize=0)
 Produces and returns a new XMLStreamBuffer of the given type.

void setThreadCount (unsigned int p_uiThreadCount)
 Sets the number of threads which will use the processor.

unsigned int getThreadCount ()
 Returns the number of threads which will use the processor.


Protected Attributes

char * m_pszActiveURI
 active URI.

VAarray< XMLStreamerFactory * > m_vaStreamerFactories
 Collection of XMLStreamerFactories.

VAarray< RootStreamNode * > m_pvaScriptCache
 Compiled script cache.

XMLFlowContextm_pContext
 Processor static context object.

bool m_fOwnContext
 Has the context been created by the processor ?


Constructor & Destructor Documentation

XMLProcessor::XMLProcessor  
 

Constructor. Sets active URI, creates and attach Handlers to the processor.

Definition at line 150 of file xmlprocessor.cpp.

References DEBUG_CREATE, m_fOwnContext, m_pContext, m_pszActiveURI, setActiveURI(), and XMLFlowContext.

XMLProcessor::~XMLProcessor  
 

Destructor. Kills processor handlers.

Definition at line 166 of file xmlprocessor.cpp.

References DEBUG_DEL, VAarray< RootStreamNode * >::empty(), VAarray< XMLStreamerFactory * >::empty(), m_pContext, m_pszActiveURI, m_pvaScriptCache, m_vaStreamerFactories, VAarray< RootStreamNode * >::pop(), VAarray< XMLStreamerFactory * >::pop(), and releaseCharBuffer().


Member Function Documentation

void XMLProcessor::addStreamerFactory XMLStreamerFactory   p_pXMLHandler,
const char *    p_pszName
 

Adds an XMLStreamerFactory object to the processor.

Remarks:
Setting a XMLStreamerFactory overwrites an existing one with the same name.
Parameters:
p_pXMLHandler The XMLStreamerFactory object to add.
p_pszName The Tag name to attribute to the XMLStreamerFactory.

Definition at line 267 of file xmlprocessor.cpp.

References VAarray< XMLStreamerFactory * >::add(), DEBUG_ECHO, DEBUG_IN, DEBUG_OUT, m_vaStreamerFactories, and XMLStreamerFactory::setParent().

Referenced by loadStreamerFactories().

void XMLProcessor::cacheScript RootStreamNode   p_pRootNode,
const char *    p_pszCacheName,
unsigned int    p_uiThreadId = 0
 

Definition at line 317 of file xmlprocessor.cpp.

References VAarray< RootStreamNode * >::add(), and m_pvaScriptCache.

RootStreamNode * XMLProcessor::compile XMLStreamProvider   p_pInput,
unsigned int    p_uiThreadId = 0
const
 

Definition at line 335 of file xmlprocessor.cpp.

References CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN, MAKE_XMLFLOW_EXCEPTION, ON_XML_FLOW_ERROR_DO, ON_XML_FLOW_ERROR_THROW, PREP_CATCH_XML_FLOW_ERROR, and WATCH_XML_FLOW_ERROR.

Referenced by FuncDefineStreamer::commitStream(), CacheScriptStreamer::commitStream(), and process().

int XMLProcessor::execute const RootStreamNode   p_pRootNode,
XMLStreamConsumer   p_pOutput,
XMLFlowContext   p_pContext = 0
const
 

Definition at line 389 of file xmlprocessor.cpp.

References CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN, getContext(), loadValuers(), MAKE_XMLFLOW_EXCEPTION, ON_XML_FLOW_ERROR_THROW, PREP_CATCH_XML_FLOW_ERROR, RootStreamNode::streamXML(), WATCH_XML_FLOW_ERROR, and XMLFlowContext.

Referenced by FuncCallStreamer::commitStream(), and process().

const char * XMLProcessor::getActiveURI  
 

Returns active URI.

Returns:
Active URI

Definition at line 197 of file xmlprocessor.cpp.

References exportCharBuffer().

const RootStreamNode * XMLProcessor::getCachedScript const char *    p_pszCacheName,
unsigned int    p_uiThreadId = 0
 

Definition at line 325 of file xmlprocessor.cpp.

References VAarray< RootStreamNode * >::get(), and m_pvaScriptCache.

XMLFlowContext * XMLProcessor::getContext   const
 

Definition at line 307 of file xmlprocessor.cpp.

References m_pContext.

Referenced by XMLFlowBuilder::endElement(), execute(), and XMLFlowBuilder::startElement().

XMLStreamBuffer * XMLProcessor::getNewBuffer const char *    p_pszBufferType = 0,
const char *    p_pszFileName = 0,
bool    p_fReadOnly = false,
unsigned int    p_uiBufferSize = 0
[static]
 

Produces and returns a new XMLStreamBuffer of the given type.

Parameters:
p_pszBufferType Buffer type ( NAMEDBUFSETSTREAMER_FILE, NAMEDBUFSETSTREAMER_STRING, NAMEDBUFSETSTREAMER_ZIP)
p_pszFileName If provided, name of the file which provides buffer's data.
p_fReadOnly TRUE if the file must be read only.
p_uiBufferSize Size of the buffer to be created.
Returns:
The requested buffer

Definition at line 96 of file xmlprocessor.cpp.

References DEBUG_FUNC, THROW_XMLFLOW_EXCEPTION, and XMLPROCESSOR_STRING.

XMLStreamerFactory * XMLProcessor::getStreamerFactory const char *    p_pszName const
 

Returns an XMLHandler object, given its name.

Remarks:
If the XMLHandler does not exists, an error is raised.
Parameters:
p_pszName (const char*) The name of the parameter.
Returns:
(XMLHandler*) A pointer to the XMLHandler object

Definition at line 282 of file xmlprocessor.cpp.

References DEBUG_FUNC, VAarray< XMLStreamerFactory * >::get(), and m_vaStreamerFactories.

Referenced by FuncDefineStreamer::commitStream(), and XMLFlowBuilder::startElement().

unsigned int XMLProcessor::getThreadCount   [static]
 

Returns the number of threads which will use the processor.

Returns:
The number of threads.

Definition at line 139 of file xmlprocessor.cpp.

References DEBUG_FUNC.

Referenced by DBStreamerFactory::DBStreamerFactory(), DBStreamerFactory::tick(), and DBStreamerFactory::~DBStreamerFactory().

BEGIN_XDFLENGINE_NS void XMLProcessor::init   [static]
 

Processor initialisation method.
Enforce XMLProcessor prerequities (Xerces init).

Definition at line 59 of file xmlprocessor.cpp.

References DEBUG_IN, DEBUG_INIT, and setThreadCount().

void XMLProcessor::loadStreamerFactories  
 

Loads all streamer factories.

Definition at line 208 of file xmlprocessor.cpp.

References addStreamerFactory(), DEBUG_IN, and DEBUG_OUT.

void XMLProcessor::loadValuers XMLFlowContext   p_pContext const
 

Load all valuers.

Definition at line 252 of file xmlprocessor.cpp.

References XMLValuable::addValuer().

Referenced by execute().

int XMLProcessor::process XMLStreamProvider   p_pInput,
XMLStreamConsumer   p_pOutput,
XMLFlowContext   p_pContext = 0
const
 

Definition at line 451 of file xmlprocessor.cpp.

References CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN, compile(), execute(), XMLFlowContext::getThreadId(), ON_XML_FLOW_ERROR_THROW, PREP_CATCH_XML_FLOW_ERROR, and WATCH_XML_FLOW_ERROR.

void XMLProcessor::setActiveURI const char *    p_pszActiveURI
 

Active URI property setter.

Remarks:
The active URI the URI which nodes are interpreted as handlers nodes (ie:active nodes).
Parameters:
p_pszActiveURI The name of the URI to set. Default value is given by XMLPROCESSOR_ACTIVEURI.

Definition at line 188 of file xmlprocessor.cpp.

References DEBUG_FUNC, importCharBuffer(), and m_pszActiveURI.

Referenced by XMLProcessor().

void XMLProcessor::setContext XMLFlowContext   p_pContext
 

Definition at line 294 of file xmlprocessor.cpp.

References DEBUG_FUNC, and m_pContext.

void XMLProcessor::setThreadCount unsigned int    p_uiThreadCount [static]
 

Sets the number of threads which will use the processor.

Parameters:
p_uiThreadCount The number of threads.

Definition at line 130 of file xmlprocessor.cpp.

References DEBUG_FUNC.

Referenced by init().

void XMLProcessor::terminate   [static]
 

Processor terminaison method.
Release XMLProcessor prerequities (Xerces terminate).

Definition at line 80 of file xmlprocessor.cpp.

References DEBUG_END, and DEBUG_OUT.

void XMLProcessor::tick unsigned long    p_ulClock
 

Time ticker method. This method is to be called periodically by a separate thread for the handler to make its state maintenance tasks.

Parameters:
p_ulClock (unsigned long) current time, in tick counts.

Definition at line 480 of file xmlprocessor.cpp.

References VAarray< XMLStreamerFactory * >::get(), m_vaStreamerFactories, VAarray< XMLStreamerFactory * >::size(), and XMLStreamerFactory::tick().


Member Data Documentation

bool XMLProcessor::m_fOwnContext [protected]
 

Has the context been created by the processor ?

Definition at line 76 of file xmlprocessor.hpp.

Referenced by XMLProcessor().

XMLFlowContext* XMLProcessor::m_pContext [protected]
 

Processor static context object.

Definition at line 75 of file xmlprocessor.hpp.

Referenced by getContext(), setContext(), XMLProcessor(), and ~XMLProcessor().

char* XMLProcessor::m_pszActiveURI [protected]
 

active URI.

Definition at line 72 of file xmlprocessor.hpp.

Referenced by setActiveURI(), XMLProcessor(), and ~XMLProcessor().

VAarray< RootStreamNode*> XMLProcessor::m_pvaScriptCache [protected]
 

Compiled script cache.

Definition at line 74 of file xmlprocessor.hpp.

Referenced by cacheScript(), getCachedScript(), and ~XMLProcessor().

VAarray< XMLStreamerFactory*> XMLProcessor::m_vaStreamerFactories [protected]
 

Collection of XMLStreamerFactories.

Definition at line 73 of file xmlprocessor.hpp.

Referenced by addStreamerFactory(), getStreamerFactory(), tick(), and ~XMLProcessor().


The documentation for this class was generated from the following files:
Generated on Sat Oct 4 13:25:01 2003 for XDFLengine by doxygen1.3-rc2