org.bibop.xml.xforge
Class ProcessElement

java.lang.Object
  |
  +--org.bibop.xml.xforge.AbstractElement
        |
        +--org.bibop.xml.xforge.ProcessElement
All Implemented Interfaces:
org.apache.avalon.framework.component.Composable, org.xml.sax.ContentHandler, Element, org.xml.sax.ext.LexicalHandler, org.apache.avalon.framework.logger.LogEnabled, ParametersListener, PrefixesMonitor, XMLConsumer, XMLProducer

public class ProcessElement
extends AbstractElement
implements ParametersListener, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.logger.LogEnabled

The real thing. given the "using" attribute in the x:forge "process" element looks for the specified component, loads it, handles parameter passing and runs the component.

Version:
1.0
Author:
Alberto Garoffolo

Field Summary
protected  XForgeComponent component
           
protected  org.apache.avalon.framework.component.ComponentManager componentManager
           
protected  java.lang.String componentName
           
protected  org.apache.avalon.framework.component.ComponentSelector cs
           
protected  org.apache.avalon.framework.component.ComponentException lastexception
           
protected  org.apache.avalon.framework.logger.Logger log
           
protected  java.util.Map parameters
           
static java.lang.String XFORGE_ATTR_PROCESSTYPE
           
 
Fields inherited from class org.bibop.xml.xforge.AbstractElement
contentHandler, lexicalHandler, parentPrefixesMonitor, po, saxEvents, xmlCompiler
 
Constructor Summary
ProcessElement(org.xml.sax.Attributes attrs, ProcessingOptions aPO)
          Look for the "using" attribute and queries the component manager for it.
 
Method Summary
 void addParameter(java.lang.String name, ParameterValue value)
          Adds an attribute to the element to be built.
 void compose(org.apache.avalon.framework.component.ComponentManager cm)
          Sets the Component Manager.
 void enableLogging(org.apache.avalon.framework.logger.Logger log)
          Enable logging.
protected  void loadComponent()
          Load the component.
protected  void releaseComponent()
          Explicit component release to the Component Pool
 void toSax()
          Do everything.
 
Methods inherited from class org.bibop.xml.xforge.AbstractElement
characters, comment, end, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, flushSAXCache, getActivePrefixes, ignorableWhitespace, output, output, processingInstruction, setConsumer, setContentHandler, setDocumentLocator, setLexicalHandler, setParent, setParentPrefixesMonitor, skippedEntity, start, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XFORGE_ATTR_PROCESSTYPE

public static final java.lang.String XFORGE_ATTR_PROCESSTYPE
See Also:
Constant Field Values

componentManager

protected org.apache.avalon.framework.component.ComponentManager componentManager

component

protected XForgeComponent component

componentName

protected java.lang.String componentName

parameters

protected java.util.Map parameters

log

protected org.apache.avalon.framework.logger.Logger log

cs

protected org.apache.avalon.framework.component.ComponentSelector cs

lastexception

protected org.apache.avalon.framework.component.ComponentException lastexception
Constructor Detail

ProcessElement

public ProcessElement(org.xml.sax.Attributes attrs,
                      ProcessingOptions aPO)
               throws IllegalElementException
Look for the "using" attribute and queries the component manager for it.

Parameters:
attrs - the Attributes object
Throws:
IllegalElementException - Attribute "using" empty or null
Method Detail

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger log)
Enable logging.

Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled

compose

public void compose(org.apache.avalon.framework.component.ComponentManager cm)
Sets the Component Manager.

Specified by:
compose in interface org.apache.avalon.framework.component.Composable
Parameters:
cm - the Avalon Component Manager

releaseComponent

protected void releaseComponent()
                         throws XForgeException
Explicit component release to the Component Pool

XForgeException

loadComponent

protected void loadComponent()
                      throws XForgeException
Load the component.

Throws:
XForgeException - Something wrong in Component loading

toSax

public void toSax()
           throws org.xml.sax.SAXException
Do everything.

Specified by:
toSax in interface XMLProducer
Specified by:
toSax in class AbstractElement
Throws:
org.xml.sax.SAXException - Generic Exception handling

addParameter

public void addParameter(java.lang.String name,
                         ParameterValue value)
                  throws XForgeException
Adds an attribute to the element to be built. This method is typically called by an ParameterElement object which is responsible for the parameter evaluation

Specified by:
addParameter in interface ParametersListener
Parameters:
name - The name of the parameter
value - The value of the parameter
Throws:
XForgeException - Bad or redeclared name/value


Copyright 2003 Bibop Research International. All Rights Reserved.