Class wobzilla_componentFactory

Object
   |
   +--wobzilla_componentFactory

class wobzilla_componentFactory

Given a configuration and a context and a set of services, a ComponentFactory finds an applicable componenent and instanciates it.

The components class can be specified in the class-attribute of the root-configuration element. If no such attribute exists, the component-factory can try to decide the components class by evaluting the configuration or the context.

WobzillaEngine, for instance, can be provided with a shorcut-list configured in wobzillaConf.xml. Under shortcuts you'll find a mapping between configuration-names and class-names. This information will be used by the wobzilla_componentFactory provided by WobzillaEngine.



 
Method Summary
 function createComponent(componentConfig,logger,context,serviceManager)
           Finds a component for the given configuration and context, creates an uninitialized instance of that component and calls setup.
 function setup(componentInstance, config, logger,context,serviceManager)
           calls all the lifecycle methods: logEnable, contextualize, configure and service ,in the stated oder, on an uninitialized component instance.

Method Detail

createComponent

function createComponent(componentConfig,logger,context,serviceManager)
Finds a component for the given configuration and context, creates an uninitialized instance of that component and calls setup.

Parameters:
componentConfig - the configuration node for the new component instance.

context - the context that is available for the component instance.

serviceManager - the serviceManager, that provides a list of all services that are exposed to the component instance.

logger - the logger that should be used by the component instance.

Returns:
an initialized component instance.

Throws:
- ComponentNotFound if the component class could not be found. The cause can be a missing class-attribue or shortcut, or that the component-code can't be loaded.
- ConfigurationException if the component could not be configured due to an invalid configuration. The component decides wether the configuration is valid or not.
- ServiceException if the component requests a service that is not provided by the passed serviceManager
- ContextException if the component requests a context-entry that is not provided by the passed context.


setup

function setup(componentInstance, config, logger,context,serviceManager)
calls all the lifecycle methods: logEnable, contextualize, configure and service ,in the stated oder, on an uninitialized component instance.

Returns:
an initialized component instance.