Class ControllerState
java.lang.Object
org.apache.torque.generator.control.ControllerState
The state of the controller. Contains all stuff the controller needs to
track.
Initialization steps in
Controller.run(List):
- First
unitConfigurationUnitConfigurationis set inController.processGenerationUnit(ControllerState, UnitConfiguration) - Second
outputOutputandsourceProviderSourceProvideris set and reset in private method processOutput ofController. - Third
sourceFile,modelRootandmodelis set in private method processSourceInOutput ofController. - Fourth
outputFile,outletNamespace,rootOutletReferenceis set in private method processModel ofController.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBooleanOption(String name) Convenience method to return the value of an option as boolean.booleangetBooleanOption(OptionName optionName) Convenience method to return the value of an option as boolean.Returns the checksums of the source files for the last generation run.getModel()Returns the current model object within the source.Returns the root object of the current source.Calculates the value of an option in the current outlet's context.getOption(OptionName optionName) Calculates the value of an option in the current outlet's context.Returns the topmost outlet in the stack of outlets.Returns the namespace of the outlet which is currently active.Returns the output declaration which is currently processed.Returns the currently generated file.Returns the path from the model root to the current model.getQualifiedName(String name) Converts a name to a QualifiedName, using the outlet namespace as default namespace is none is given.Returns the reference to the current outlet.Returns the currently used source file.Returns the source provider which is currently in use.getStringOption(String name) Convenience method to return the value of an option as String.getStringOption(OptionName optionName) Convenience method to return the value of an option as String.Returns the checksums of the source files for this generation run.Returns the configuration of the currently processed generation unit.Returns the VariableStore where generation variables can be set.Returns all options which are visible from the current outlet's namespace.Pops the topmost outlets from the stack of outlets.voidpushOutlet(Outlet outlet) Pushes a outlet onto the stack of outlets.voidSets the current source model object.voidsetModelRoot(Object modelRoot) Sets the root object of the current source.voidsetPathToModel(String pathToModel) Sets the path from the model root to the current model.voidsetSourceFile(File sourceFile) Sets the currently used source file.voidsetSourceProvider(SourceProvider sourceProvider) Sets the source provider which is currently in use.voidsetUnitConfiguration(UnitConfiguration unitConfiguration) Sets the configuration of the currently processed generation unit.toString()
-
Constructor Details
-
ControllerState
public ControllerState()
-
-
Method Details
-
getSourceProvider
Returns the source provider which is currently in use.- Returns:
- the current source provider.
-
setSourceProvider
Sets the source provider which is currently in use.- Parameters:
sourceProvider- the current source provider.
-
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
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
Pushes a outlet onto the stack of outlets.- Parameters:
outlet- the outlet to be added to the stack of outlets, not null.
-
popOutlet
Pops the topmost outlets from the stack of outlets.- Returns:
- the removed outlet, not null.
- Throws:
IndexOutOfBoundsException- if the stack is empty.
-
getModel
Returns the current model object within the source. Does not return null during generation.- Returns:
- the current model object.
-
setModel
Sets the current source model object.- Parameters:
model- the new current source model object, or null to remove the current source model object.newPathToModel- the path from root to the new model, or null to leave the path unchanged.
-
getPathToModel
Returns the path from the model root to the current model.- Returns:
- the path from the model root to the current model, not null.
-
setPathToModel
Sets the path from the model root to the current model.- Parameters:
pathToModel- the path from the model root to the current model, not null.
-
getModelRoot
Returns the root object of the current source.- Returns:
- The the root object of the current source; may be null only if no source is currently processed.
-
setModelRoot
Sets the root object of the current source.- Parameters:
modelRoot- the the root object of the current source, or null to remove the current root object.
-
getRootOutletReference
Returns the reference to the current outlet.- Returns:
- the reference to the current outlet, or null if no outlet is currently active.
-
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
Calculates the value of an option in the current outlet's context. The default namespace which is used when no namespace is given innameis 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
Calculates the value of an option in the current outlet's context. The default namespace which is used when no namespace is given innameis the namespace of the currently used outlet.- Parameters:
optionName- 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
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
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:
NullPointerException- if optionName is null.
-
getStringOption
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
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:
NullPointerException- if optionName is null.
-
getVisibleOptions
Returns all options which are visible from the current outlet's namespace.- Returns:
- all visible options, not null.
-
getVariableStore
Returns the VariableStore where generation variables can be set.- Returns:
- the variableStore, never null.
-
getQualifiedName
Converts a name to a QualifiedName, using the outlet namespace as default namespace is none is given.- Parameters:
name- the name to convert to a qualifiedName, not null.- Returns:
- the corresponding qualifiedName.
- Throws:
NullPointerException- if name is nullIllegalArgumentException- if name is no valid qualifiedName.
-
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
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
Sets the currently used source file.- Parameters:
sourceFile- the current source file, or null to remove the source file.
-
getUnitConfiguration
Returns the configuration of the currently processed generation unit.- Returns:
- the configuration of the currently processed generation unit.
-
setUnitConfiguration
Sets the configuration of the currently processed generation unit.- Parameters:
unitConfiguration- the configuration of the currently processed generation unit.
-
getLastGeneratedSourceChecksums
Returns the checksums of the source files for the last generation run.- Returns:
- the checksums, not null.
-
getThisGenerationSourceChecksums
Returns the checksums of the source files for this generation run.- Returns:
- the checksums, not null.
-
toString
-