org.apache.cocoon.components.modules.input
Class AbstractMetaModule

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.modules.input.AbstractInputModule
          extended by org.apache.cocoon.components.modules.input.AbstractMetaModule
All Implemented Interfaces:
Disposable, Component, Composable, Configurable, LogEnabled, InputModule
Direct Known Subclasses:
ChainMetaModule, CollectionMetaModule, DateMetaInputModule, DigestMetaModule, JXPathMetaModule, MapMetaModule, SelectMetaInputModule, SimpleMappingMetaModule, XMLMetaModule

public abstract class AbstractMetaModule
extends AbstractInputModule
implements Composable

AbstractMetaModule gives you the infrastructure for easily deploying more "meta" InputModules i.e. InputModules that are composed of other InputModules. In order to get at the Logger, use getLogger().

Version:
CVS $Id: AbstractMetaModule.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Christian Haul, Jeff Turner

Field Summary
protected  String defaultInput
          The default InputModule name / shorthand.
protected  boolean initialized
          Is this instance initialized?
protected  InputModule input
          The cached default InputModule
protected static String INPUT_MODULE_SELECTOR
           
protected  Configuration inputConf
          The default InputModule configuration
protected  ComponentSelector inputSelector
          The cached InputModule-Selector
protected  ComponentManager manager
          The component manager instance
 
Fields inherited from class org.apache.cocoon.components.modules.input.AbstractInputModule
settings
 
Fields inherited from interface org.apache.cocoon.components.modules.input.InputModule
ROLE
 
Constructor Summary
AbstractMetaModule()
           
 
Method Summary
 void compose(ComponentManager manager)
          Set the current ComponentManager instance used by this Composable.
 void dispose()
          Dispose exactly one cached InputModule.
protected  Iterator getNames(Map objectModel, InputModule staticMod, String staticModName, Configuration staticModConf)
          Get names of available attributes in the specified (usually statically assigned) Input Module.
protected  Iterator getNames(Map objectModel, InputModule staticMod, String staticModName, Configuration staticModConf, InputModule dynamicMod, String dynamicModName, Configuration dynamicModConf)
          Get names of available attributes in one of the specified Input Modules (static or dynamic, dynamic preferred).
protected  Object getValue(String attr, Map objectModel, InputModule staticMod, String staticModName, Configuration staticModConf)
          Get an attribute's value from a (usually statically assigned) Input Module.
protected  Object getValue(String attr, Map objectModel, InputModule staticMod, String staticModName, Configuration staticModConf, InputModule dynamicMod, String dynamicModName, Configuration dynamicModConf)
          Get attribute's value in one of the specified Input Modules (static or dynamic, dynamic preferred).
protected  Object getValue(String attr, Map objectModel, ModuleHolder holder)
           
protected  Object getValue(String attr, Map objectModel, ModuleHolder staticHolder, ModuleHolder dynamicHolder)
           
protected  Object[] getValues(String attr, Map objectModel, InputModule staticMod, String staticModName, Configuration staticModConf)
          Get an attribute's values from a (usually statically assigned) Input Module.
protected  Object[] getValues(String attr, Map objectModel, InputModule staticMod, String staticModName, Configuration staticModConf, InputModule dynamicMod, String dynamicModName, Configuration dynamicModConf)
          Get attribute's values in one of the specified Input Modules (static or dynamic, dynamic preferred).
protected  Object[] getValues(String attr, Map objectModel, ModuleHolder holder)
           
protected  Object[] getValues(String attr, Map objectModel, ModuleHolder staticHolder, ModuleHolder dynamicHolder)
           
 void lazy_initialize()
          Initialize the meta module with exactly one other input module.
protected  InputModule obtainModule(String type)
          Obtain a permanent reference to an InputModule.
protected  void releaseModule(InputModule module)
          release a permanent reference to an InputModule.
 
Methods inherited from class org.apache.cocoon.components.modules.input.AbstractInputModule
configure, getAttribute, getAttributeNames, getAttributeValues
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manager

protected ComponentManager manager
The component manager instance


inputSelector

protected ComponentSelector inputSelector
The cached InputModule-Selector


input

protected InputModule input
The cached default InputModule


defaultInput

protected String defaultInput
The default InputModule name / shorthand. Defaults to 'request-param'


inputConf

protected Configuration inputConf
The default InputModule configuration


initialized

protected boolean initialized
Is this instance initialized?


INPUT_MODULE_SELECTOR

protected static final String INPUT_MODULE_SELECTOR
Constructor Detail

AbstractMetaModule

public AbstractMetaModule()
Method Detail

compose

public void compose(ComponentManager manager)
             throws ComponentException
Set the current ComponentManager instance used by this Composable.

Specified by:
compose in interface Composable
Throws:
ComponentException

lazy_initialize

public void lazy_initialize()
Initialize the meta module with exactly one other input module. Since "meta" modules require references to components of the same role, initialization cannot be done in initialize() when also implementing ThreadSafe since at that point the component selector is not yet initialized it would trigger the creation of a new one resulting in an endless loop of initializations. Therefore, every module needs to call this method when it first requires access to another module if the module itself has not been initialized. Override this method and dispose() to keep references to more than one module.


dispose

public void dispose()
Dispose exactly one cached InputModule. To work on more than one, override this method and initialize().

Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractInputModule

obtainModule

protected InputModule obtainModule(String type)
Obtain a permanent reference to an InputModule.


releaseModule

protected void releaseModule(InputModule module)
release a permanent reference to an InputModule.


getNames

protected Iterator getNames(Map objectModel,
                            InputModule staticMod,
                            String staticModName,
                            Configuration staticModConf)
                     throws ConfigurationException
Get names of available attributes in the specified (usually statically assigned) Input Module.

Throws:
ConfigurationException
See Also:
InputModule.getAttributeNames(Configuration, Map)

getNames

protected Iterator getNames(Map objectModel,
                            InputModule staticMod,
                            String staticModName,
                            Configuration staticModConf,
                            InputModule dynamicMod,
                            String dynamicModName,
                            Configuration dynamicModConf)
                     throws ConfigurationException
Get names of available attributes in one of the specified Input Modules (static or dynamic, dynamic preferred). Dynamic IM may be null.

Throws:
ConfigurationException
See Also:
InputModule.getAttributeNames(Configuration, Map)

getValue

protected Object getValue(String attr,
                          Map objectModel,
                          ModuleHolder holder)
                   throws ConfigurationException
Throws:
ConfigurationException

getValue

protected Object getValue(String attr,
                          Map objectModel,
                          ModuleHolder staticHolder,
                          ModuleHolder dynamicHolder)
                   throws ConfigurationException
Throws:
ConfigurationException

getValues

protected Object[] getValues(String attr,
                             Map objectModel,
                             ModuleHolder holder)
                      throws ConfigurationException
Throws:
ConfigurationException

getValues

protected Object[] getValues(String attr,
                             Map objectModel,
                             ModuleHolder staticHolder,
                             ModuleHolder dynamicHolder)
                      throws ConfigurationException
Throws:
ConfigurationException

getValue

protected Object getValue(String attr,
                          Map objectModel,
                          InputModule staticMod,
                          String staticModName,
                          Configuration staticModConf)
                   throws ConfigurationException
Get an attribute's value from a (usually statically assigned) Input Module.

Throws:
ConfigurationException
See Also:
InputModule.getAttribute(String, Configuration, Map)

getValue

protected Object getValue(String attr,
                          Map objectModel,
                          InputModule staticMod,
                          String staticModName,
                          Configuration staticModConf,
                          InputModule dynamicMod,
                          String dynamicModName,
                          Configuration dynamicModConf)
                   throws ConfigurationException
Get attribute's value in one of the specified Input Modules (static or dynamic, dynamic preferred). Dynamic IM may be null.

Throws:
ConfigurationException
See Also:
InputModule.getAttribute(String, Configuration, Map)

getValues

protected Object[] getValues(String attr,
                             Map objectModel,
                             InputModule staticMod,
                             String staticModName,
                             Configuration staticModConf)
                      throws ConfigurationException
Get an attribute's values from a (usually statically assigned) Input Module.

Throws:
ConfigurationException
See Also:
InputModule.getAttributeValues(String, Configuration, Map)

getValues

protected Object[] getValues(String attr,
                             Map objectModel,
                             InputModule staticMod,
                             String staticModName,
                             Configuration staticModConf,
                             InputModule dynamicMod,
                             String dynamicModName,
                             Configuration dynamicModConf)
                      throws ConfigurationException
Get attribute's values in one of the specified Input Modules (static or dynamic, dynamic preferred). Dynamic IM may be null.

Throws:
ConfigurationException
See Also:
InputModule.getAttributeValues(String, Configuration, Map)


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.