org.apache.torque.generator.control
Class Controller

java.lang.Object
  extended by org.apache.torque.generator.control.Controller

public class Controller
extends Object

Reads the configuration and generates the output accordingly.


Constructor Summary
Controller()
           
 
Method Summary
protected  void createOutputFilename(Output output, ControllerState controllerState)
          Creates the output file name and sets it in the output.
protected  void initLogging()
          Initializes the Logging.
protected  void processGenerationUnit(ControllerState controllerState, UnitConfiguration unitConfiguration)
          Processes a unit of generation.
 void run(List<UnitDescriptor> unitDescriptors)
          Executes the controller action.
 SourceElement transformSource(SourceElement rootElement, List<SourceTransformerDefinition> transformerDefinitions, ControllerState controllerState)
          Applies all tarnsformer definitions to the current source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Controller

public Controller()
Method Detail

run

public void run(List<UnitDescriptor> unitDescriptors)
         throws GeneratorException
Executes the controller action.

Parameters:
unitDescriptors - the units of generation to execute.
Throws:
ControllerException - if a ControllerException occurs during processing.
ConfigurationException - if a ConfigurationException occurs during processing.
GeneratorException - if a OutletException occurs during processing.
IOException - if a IOException occurs during processing.

initLogging

protected void initLogging()
Initializes the Logging.


processGenerationUnit

protected void processGenerationUnit(ControllerState controllerState,
                                     UnitConfiguration unitConfiguration)
                              throws GeneratorException
Processes a unit of generation.

Parameters:
controllerState - the controller state, not null.
unitConfiguration - the configuration of the generation unit to process, not null.
Throws:
GeneratorException - if a generation error occurs.

createOutputFilename

protected void createOutputFilename(Output output,
                                    ControllerState controllerState)
                             throws GeneratorException
Creates the output file name and sets it in the output. The filename is calculated either by the filenameConfigurator in output or is given explicitly (in the latter case nothing needs to be done).

Parameters:
controllerState - the controller state, not null.
output - The output to process, not null.
Throws:
ConfigurationException - if an incorrect configuration is encountered, e.g. if neither filename nor filenameOutlet is set in output.
GeneratorException - if an error occurs during generation of the output filename.

transformSource

public SourceElement transformSource(SourceElement rootElement,
                                     List<SourceTransformerDefinition> transformerDefinitions,
                                     ControllerState controllerState)
                              throws SourceTransformerException,
                                     SourceException
Applies all tarnsformer definitions to the current source.

Parameters:
rootElement - the root element of the source to transform, not null.
transformerDefinitions - the transformer definitions to apply, not null.
controllerState - the current controller state, not null.
Returns:
the transformed root element, not null.
Throws:
SourceTransformerException
SourceException


Copyright © 2000-2012 The Apache Software Foundation. All Rights Reserved.