org.apache.torque.generator.control
Class ControllerState

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

public class ControllerState
extends Object

The state of the controller. Contains all stuff the controller needs to track.


Constructor Summary
ControllerState()
           
 
Method Summary
 boolean getBooleanOption(OptionName optionName)
          Convenience method to return the value of an option as boolean.
 boolean getBooleanOption(String name)
          Convenience method to return the value of an option as boolean.
 Object getOption(OptionName optionName)
          Calculates the value of an option in the current outlet's context.
 Object getOption(String name)
          Calculates the value of an option in the current outlet's context.
 Outlet getOutlet()
          Returns the topmost outlet in the stack of outlets.
 Namespace getOutletNamespace()
          Returns the namespace of the outlet which is currently active.
 Output getOutput()
          Returns the output declaration which is currently processed.
 File getOutputFile()
          Returns the currently generated file.
 QualifiedName getQualifiedName(String name)
          Converts a name to a QualifiedName, using the outlet namespace as default namespace is fone is given.
 SourceElement getRootElement()
          Returns the root element of the current source.
 OutletReference getRootOutletReference()
          Returns the reference to the current outlet.
 SourceElement getSourceElement()
          Returns the current source element.
 File getSourceFile()
          Returns the currently used source file.
 SourceProvider getSourceProvider()
          Returns the source provider which is currently in use.
 String getStringOption(OptionName optionName)
          Convenience method to return the value of an option as String.
 String getStringOption(String name)
          Convenience method to return the value of an option as String.
 UnitConfiguration getUnitConfiguration()
          Returns the configuration of the currently processed generation unit.
 VariableStore getVariableStore()
          Returns the VariableStore where generation variables can be set.
 Options getVisibleOptions()
          Returns all options which are visible from the current outlet's namespace.
 Outlet popOutlet()
          Pops the topmost outlets from the stack of outlets.
 void pushOutlet(Outlet outlet)
          Pushes a outlet onto the stack of outlets.
 void setRootElement(SourceElement rootElement)
          Sets the root element of the current source.
 void setSourceElement(SourceElement sourceElement)
          Sets the current source element.
 void setSourceFile(File sourceFile)
          Sets the currently used source file.
 void setSourceProvider(SourceProvider sourceProvider)
          Sets the source provider which is currently in use.
 void setUnitConfiguration(UnitConfiguration unitConfiguration)
          Sets the configuration of the currently processed generation unit.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ControllerState

public ControllerState()
Method Detail

getSourceProvider

public SourceProvider getSourceProvider()
Returns the source provider which is currently in use.

Returns:
the current source provider.

setSourceProvider

public void setSourceProvider(SourceProvider sourceProvider)
Sets the source provider which is currently in use.

Parameters:
sourceProvider - the current source provider.

getOutput

public Output getOutput()
Returns the output declaration which is currently processed.

Returns:
the output declaration which is currently processed, may be null only if no output is processed at the moment.

getOutlet

public Outlet getOutlet()
Returns the topmost outlet in the stack of outlets.

Returns:
the topmost outlet in the stack of outlets, or null if the stack is empty.

pushOutlet

public void pushOutlet(Outlet outlet)
Pushes a outlet onto the stack of outlets.

Parameters:
outlet - the outlet to be added to the stack of outlets, not null.

popOutlet

public Outlet popOutlet()
Pops the topmost outlets from the stack of outlets.

Returns:
the removed outlet, not null.
Throws:
IndexOutOfBoundsException - if the stack is empty.

getSourceElement

public SourceElement getSourceElement()
Returns the current source element. Does not return null during generation.

Returns:
the current source element.

setSourceElement

public void setSourceElement(SourceElement sourceElement)
Sets the current source element.

Parameters:
sourceElement - the new current source element, or null to remove the current source element.

getRootElement

public SourceElement getRootElement()
Returns the root element of the current source.

Returns:
The the root element of the current source; may be null only if no source is currently processed.

setRootElement

public void setRootElement(SourceElement rootElement)
Sets the root element of the current source.

Parameters:
rootElement - the the root element of the current source, or null to remove the current root element.

getRootOutletReference

public OutletReference getRootOutletReference()
Returns the reference to the current outlet.

Returns:
the reference to the current outlet, or null if no outlet is currently active.

getOutletNamespace

public Namespace getOutletNamespace()
Returns the namespace of the outlet which is currently active.

Returns:
the name space of the active outlet. May be null only if no generation is in progress.

getOption

public Object getOption(String name)
Calculates the value of an option in the current outlet's context. The default namespace which is used when no namespace is given in name is the namespace of the currently used outlet.

Parameters:
name - the name of the option, can contain a namespace.
Returns:
The value of the option, or null if no option with that name is visible from the given namespace.

getOption

public Object getOption(OptionName optionName)
Calculates the value of an option in the current outlet's context. The default namespace which is used when no namespace is given in name is the namespace of the currently used outlet.

Parameters:
name - the object containing the name of the option, which can contain a namespace, not null.
Returns:
The value of the option, or null if no option with that name is visible from the given namespace.
Throws:
NullPointerException - if optionName is null.

getBooleanOption

public boolean getBooleanOption(String name)
Convenience method to return the value of an option as boolean. The option is evaluated in the current outlet's context, see getOption(String).
Uses Boolean.paseBoolean() for String->Boolean conversion.

Parameters:
name - the name of the option, can contain a namespace.
Returns:
The value of the option as boolean, or false if no option with that name is visible from the given namespace,

getBooleanOption

public boolean getBooleanOption(OptionName optionName)
Convenience method to return the value of an option as boolean. The option is evaluated in the current outlet's context, see getOption(String).
Uses Boolean.paseBoolean() for String->Boolean conversion.

Parameters:
optionName - the object containing the name of the option, which can contain a namespace.
Returns:
The value of the option as boolean, or false if no option with that name is visible from the given namespace.
Throws:
NullPointerExeption - if optionName is null.

getStringOption

public String getStringOption(String name)
Convenience method to return the value of an option as String. The option is evaluated in the current outlet's context, see getOption(String).

Parameters:
name - the name of the option, can contain a namespace.
Returns:
The value of the option as boolean, or false if no option with that name is visible from the given namespace,

getStringOption

public String getStringOption(OptionName optionName)
Convenience method to return the value of an option as String. The option is evaluated in the current outlet's context, see getOption(String).

Parameters:
optionName - the object containing the name of the option, which can contain a namespace.
Returns:
The value of the option as String, or null if no option with that name is visible from the given namespace,
Throws:
NullPointerExeption - if optionName is null.

getVisibleOptions

public Options getVisibleOptions()
Returns all options which are visible from the current outlet's namespace.

Returns:
all visible options, not null.

getVariableStore

public VariableStore getVariableStore()
Returns the VariableStore where generation variables can be set.

Returns:
the variableStore, never null.

getQualifiedName

public QualifiedName getQualifiedName(String name)
Converts a name to a QualifiedName, using the outlet namespace as default namespace is fone is given.

Parameters:
name - the name to convert to a qualifiedName, not null.
Returns:
the corresponding qualifiedName.
Throws:
NullPointerException - if name is null
IllegalArgumentException - if name is no valid qualifiedName.

getOutputFile

public File getOutputFile()
Returns the currently generated file.

Returns:
the current output file. May only be null if no output file is currently generated (e.g. if the file name is currently generated).

getSourceFile

public File getSourceFile()
Returns the currently used source file.

Returns:
the current source file. May be null if no source file is currently used (e.g. if the source is created by other means than reading a file).

setSourceFile

public void setSourceFile(File sourceFile)
Sets the currently used source file.

Parameters:
sourceFile - the current source file, or null to remove the source file.

getUnitConfiguration

public UnitConfiguration getUnitConfiguration()
Returns the configuration of the currently processed generation unit.

Returns:
the configuration of the currently processed generation unit.

setUnitConfiguration

public void setUnitConfiguration(UnitConfiguration unitConfiguration)
Sets the configuration of the currently processed generation unit.

Parameters:
unitConfiguration - the configuration of the currently processed generation unit.

toString

public String toString()
Overrides:
toString in class Object


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