org.apache.torque.generator.outlet
Class DebuggingOutletWrapper

java.lang.Object
  extended by org.apache.torque.generator.outlet.DebuggingOutletWrapper
All Implemented Interfaces:
Outlet

public class DebuggingOutletWrapper
extends Object
implements Outlet

An outlet wrapper which adds debug information to the outlet.

Version:
$Id: $

Constructor Summary
DebuggingOutletWrapper(Outlet delegate)
          Constructor.
 
Method Summary
 void addMergepointMapping(MergepointMapping mergepointMapping)
          Adds the mergepoint mapping to the delegate.
 void afterExecute(ControllerState controllerState)
          Calls the afterExecute method in the delegate.
 void beforeExecute(ControllerState controllerState)
          Calls the beforeExecute method in the delegate.
 OutletResult execute(ControllerState controllerState)
          Executes the delegate generation and adds debugging output before and after the generated content, if the result is a String result.
protected  String getCommentAtEnd(ControllerState controllerState)
          Returns the debug information to be added at the end of the outlet's output.
protected  String getCommentAtStart(ControllerState controllerState)
          Returns the debug information to be added at the start of the outlet's output.
 String getInputElementName()
          Returns the name of the input root element from the delegate.
 MergepointMapping getMergepointMapping(String name)
          Retrieves the mergepoint mapping for the given mergepoint name from the delegate and returns it.
 Map<String,MergepointMapping> getMergepointMappings()
          Returns the map of all mergepoint mappings in the delegate, keyed by their name.
 QualifiedName getName()
          Returns the name of the delegate.
 void setInputElementName(String inputName)
          Sets the name of the input root element in the delegate.
 MergepointMapping setMergepointMapping(MergepointMapping mergepointMapping)
          Sets an mergepoint mapping in the delegate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebuggingOutletWrapper

public DebuggingOutletWrapper(Outlet delegate)
Constructor.

Parameters:
delegate - the wrapped outlet, not null.
Method Detail

getName

public QualifiedName getName()
Returns the name of the delegate.

Specified by:
getName in interface Outlet
Returns:
the name of the delegate, not null.

addMergepointMapping

public void addMergepointMapping(MergepointMapping mergepointMapping)
                          throws ConfigurationException
Adds the mergepoint mapping to the delegate.

Specified by:
addMergepointMapping in interface Outlet
Parameters:
mergepointMapping - the mergepoint mapping to add, not null.
Throws:
NullPointerException - if mergepointMapping is null.
ConfigurationException - if an mergepointMapping for the given name already exists.

setMergepointMapping

public MergepointMapping setMergepointMapping(MergepointMapping mergepointMapping)
Sets an mergepoint mapping in the delegate.

Specified by:
setMergepointMapping in interface Outlet
Parameters:
mergepointMapping - the mergepointMapping to add, not null.
Returns:
the replaced mergepoint mapping, not null.
Throws:
NullPointerException - if mergepointMapping is null.

getMergepointMapping

public MergepointMapping getMergepointMapping(String name)
Retrieves the mergepoint mapping for the given mergepoint name from the delegate and returns it.

Specified by:
getMergepointMapping in interface Outlet
Parameters:
name - the name of the mergepoint mapping.
Returns:
the mergepoint mapping for the given name, or null if no mergepoint mapping exists for this name.

getMergepointMappings

public Map<String,MergepointMapping> getMergepointMappings()
Returns the map of all mergepoint mappings in the delegate, keyed by their name.

Specified by:
getMergepointMappings in interface Outlet
Returns:
the map of mergepoint mappings, not null.

setInputElementName

public void setInputElementName(String inputName)
Sets the name of the input root element in the delegate.

Specified by:
setInputElementName in interface Outlet
Parameters:
inputName - the name of the root element of the source, or null to accept any input name.

getInputElementName

public String getInputElementName()
Returns the name of the input root element from the delegate.

Specified by:
getInputElementName in interface Outlet
Returns:
inputName the name of the root element of the source, or if any input name is accepted.

beforeExecute

public void beforeExecute(ControllerState controllerState)
                   throws GeneratorException
Calls the beforeExecute method in the delegate.

Specified by:
beforeExecute in interface Outlet
Parameters:
controllerState - the current controller state, not null.
Throws:
GeneratorException - if adjusting the controller state fails.

afterExecute

public void afterExecute(ControllerState controllerState)
                  throws GeneratorException
Calls the afterExecute method in the delegate.

Specified by:
afterExecute in interface Outlet
Parameters:
controllerState - the current controller state, not null.
Throws:
GeneratorException - if adjusting the controller state fails.

execute

public OutletResult execute(ControllerState controllerState)
                     throws GeneratorException
Executes the delegate generation and adds debugging output before and after the generated content, if the result is a String result.

Specified by:
execute in interface Outlet
Parameters:
controllerState - the current controller state, not null.
Returns:
the result of the generation plus possibly debugging information.
Throws:
GeneratorException - if adjusting the controller state fails.

getCommentAtStart

protected String getCommentAtStart(ControllerState controllerState)
Returns the debug information to be added at the start of the outlet's output.

Parameters:
controllerState - The current controller state, not null.
Returns:
the debug information, not null.

getCommentAtEnd

protected String getCommentAtEnd(ControllerState controllerState)
Returns the debug information to be added at the end of the outlet's output.

Parameters:
controllerState - The current controller state, not null.
Returns:
the debug information, not null.


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