org.apache.cocoon.components.elementprocessor.impl
Class AbstractElementProcessorFactory

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.elementprocessor.impl.AbstractElementProcessorFactory
All Implemented Interfaces:
Component, LogEnabled, ElementProcessorFactory
Direct Known Subclasses:
HSSFElementProcessorFactory

public abstract class AbstractElementProcessorFactory
extends AbstractLogEnabled
implements ElementProcessorFactory, Component

Create instances of specific ElementProcessor implementations to handle specific XML elements and their content.

Version:
CVS $Id: AbstractElementProcessorFactory.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Marc Johnson (marc_johnson27591@hotmail.com)

Field Summary
 
Fields inherited from interface org.apache.cocoon.components.elementprocessor.ElementProcessorFactory
ROLE
 
Constructor Summary
protected AbstractElementProcessorFactory()
          Protected default constructor
 
Method Summary
protected  void addElementProcessorProgenitor(String name, Object progenitor)
          A method for extending classes to populate the map.
protected  ElementProcessor constructElementProcessor(Constructor progenitor)
          A reference implementation of doCreateElementProcessor that can be used by an extending class whose progenitors are Constructor objects that can create new instances of ElementProcessor implementations.
 ElementProcessor createElementProcessor(String name)
          Given an XML element name, create and return an appropriate ElementProcessor.
protected  ElementProcessor createNewElementProcessorInstance(Class progenitor)
          A reference implementation of doCreateElementProcessor that can be used by an extending class whose progenitors are Class objects for ElementProcessor implementations.
protected abstract  ElementProcessor doCreateElementProcessor(Object progenitor)
          The method that a concrete extension of AbstractElementProcessorFactory must implement.
protected  Object lookupElementProcessorProgenitor(String name)
          A method to get the progenitor value associated with a specified element name.
 
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
 

Constructor Detail

AbstractElementProcessorFactory

protected AbstractElementProcessorFactory()
Protected default constructor

Method Detail

createElementProcessor

public ElementProcessor createElementProcessor(String name)
                                        throws CannotCreateElementProcessorException
Given an XML element name, create and return an appropriate ElementProcessor.

Specified by:
createElementProcessor in interface ElementProcessorFactory
Parameters:
name - element name
Returns:
the specified ElementProcessor
Throws:
CannotCreateElementProcessorException - if there is no ElementProcessor available for the specified name

addElementProcessorProgenitor

protected void addElementProcessorProgenitor(String name,
                                             Object progenitor)
A method for extending classes to populate the map.

Parameters:
name - the element name for this progenitor; cannot be null ot empty
progenitor - an object that can be used to generate an appropriate ElementProcessor; cannot be nukk
Throws:
IllegalArgumentException - if name is already in the map or progenitor is null.

lookupElementProcessorProgenitor

protected Object lookupElementProcessorProgenitor(String name)
A method to get the progenitor value associated with a specified element name.

Parameters:
name - the element name
Returns:
the associated ElementProcessor progenitor; will be null if the element name has not yet been associated with a progenitor.

doCreateElementProcessor

protected abstract ElementProcessor doCreateElementProcessor(Object progenitor)
                                                      throws CannotCreateElementProcessorException
The method that a concrete extension of AbstractElementProcessorFactory must implement. When this method is called, the element name has already been looked up in the map and a progenitor Object has been acquired. The progenitor is guaranteed not to be null.

Parameters:
progenitor - the object from which to create an ElementProcessor
Returns:
freshly created ElementProcessor
Throws:
CannotCreateElementProcessorException - if the specified ElementProcessor cannot be created.

createNewElementProcessorInstance

protected ElementProcessor createNewElementProcessorInstance(Class progenitor)
                                                      throws CannotCreateElementProcessorException
A reference implementation of doCreateElementProcessor that can be used by an extending class whose progenitors are Class objects for ElementProcessor implementations.

Parameters:
progenitor - a Class representing an ElementProcessor
Returns:
the new ElementProcessor instance
Throws:
CannotCreateElementProcessorException - if the ElementProcessor cannot be created.

constructElementProcessor

protected ElementProcessor constructElementProcessor(Constructor progenitor)
                                              throws CannotCreateElementProcessorException
A reference implementation of doCreateElementProcessor that can be used by an extending class whose progenitors are Constructor objects that can create new instances of ElementProcessor implementations.

Parameters:
progenitor - a Constructor of an ElementProcessor
Returns:
the newly created ElementProcessor
Throws:
CannotCreateElementProcessorException - if the ElementProcessor cannot be created.


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