Package org.apache.torque.generator.configuration

# Class UnitConfiguration

java.lang.Object
org.apache.torque.generator.configuration.UnitConfiguration

public class UnitConfiguration extends Object
Contains all information to run a generation unit. Provides state checking, i.e. getters can only be called after all setters has been called.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UnitConfiguration()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `File`
  `getCacheDirectory()`
  Returns the cache directory where the generator can store internal files.
  `ClassLoader`
  `getClassLoader()`
  Returns the class loader to use by the generator when accessing the templates or classes defined within the templates.
  `ConfigurationHandlers`
  `getConfigurationHandlers()`
  Returns the configuration handlers used to parse the configuration of this generation unit.
  `Charset`
  `getDefaultOutputEncoding()`
  Returns the output CharSet if no specific encoding has been set in the output.
  `EntityReferences`
  `getEntityReferences()`
  Returns the entityReferences of the associated configuration unit.
  `Loglevel`
  `getLoglevel()`
  Returns the Loglevel during generation.
  `Options`
  `getOptions()`
  Returns the options of the associated configuration unit.
  `OutletConfiguration`
  `getOutletConfiguration()`
  Returns the configuration of the outlets in this generation unit.
  `File`
  `getOutputDirectory(String outputDirKey)`
  Returns the output directory for a given output directory key.
  `Map<String,File>`
  `getOutputDirectoryMap()`
  Returns the output directory map which contains the mapping from output directory key to output directory.
  `List<Output>`
  `getOutputList()`
  Returns the list of output definitions of the associated configuration unit.
  `SourceProvider`
  `getOverrideSourceProvider()`
  Returns the source provider which overrides the source provider defined in the control file.
  `String`
  `getTemplateSetName()`
  Returns the name of the template set.
  `File`
  `getWorkDirectory()`
  Returns the work directory where the generator can store internal files.
  `boolean`
  `isAddDebuggingInfoToOutput()`
  Returns whether to add debug information to the output.
  `boolean`
  `isInit()`
  Checks whether the unit configuration is fully initialized.
  `boolean`
  `isRunOnlyOnSourceChange()`
  Returns true if only the sources should be processed which have changed since last generation.
  `void`
  `setAddDebuggingInfoToOutput(boolean addDebuggingInfoToOutput)`
  Sets whether to add debug information to the output.
  `void`
  `setCacheDirectory(File cacheDirectory)`
  Sets the cache directory where the generator can store internal files.
  `void`
  `setClassLoader(ClassLoader classLoader)`
  Sets the class loader to use by the generator when accessing the templates or classes defined within the templates.
  `void`
  `setConfigurationHandlers(ConfigurationHandlers configurationHandlers)`
  Sets the configuration handlers used to parse the configuration of this generation unit.
  `void`
  `setDefaultOutputEncoding(Charset defaultOutputCharset)`
  Sets the output encoding if no specificdefaultOutputCharsetg has been set in the output.
  `void`
  `setEntityReferences(EntityReferences entityReferences)`
  Sets the entityReferences of the associated configuration unit.
  `void`
  `setLoglevel(Loglevel loglevel)`
  Sets the Loglevel during generation.
  `void`
  `setOptions(Options options)`
  Sets the options of the associated configuration unit.
  `void`
  `setOutletConfiguration(OutletConfiguration outletConfiguration)`
  Sets the outlet configuration of the associated configuration unit.
  `void`
  `setOutputDirectoryMap(Map<String,File> outputDirectoryMap)`
  Sets the output directory map which contains the mapping from output directory key to output directory.
  `void`
  `setOutputList(List<Output> outputList)`
  Sets the output activities of the associated configuration unit.
  `void`
  `setOverrideSourceProvider(SourceProvider overrideSourceProvider)`
  Sets the source provider which overrides the source provider defined in the control file.
  `void`
  `setRunOnlyOnSourceChange(boolean runOnlyOnSourceChange)`
  Sets whether only the sources should be processed which have changed since last generation.
  `void`
  `setTemplateSetName(String name)`
  Sets the name of the template set.
  `void`
  `setWorkDirectory(File workDirectory)`
  Sets the work directory where the generator can store internal files.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### UnitConfiguration

    public UnitConfiguration()

- ## Method Details

  - ### getOutletConfiguration

    public OutletConfiguration getOutletConfiguration()
    Returns the configuration of the outlets in this generation unit.
    Returns:
      the outlet configuration, not null.
    Throws:
      `IllegalStateException` - if outletConfiguration was not set.

  - ### setOutletConfiguration

    public void setOutletConfiguration(OutletConfiguration outletConfiguration)
    Sets the outlet configuration of the associated configuration unit.
    Parameters:
      `outletConfiguration` - the outlet configuration, not null.
    Throws:
      `NullPointerException` - if outletConfiguration is null.

  - ### getOptions

    public Options getOptions()
    Returns the options of the associated configuration unit.
    Returns:
      the options, not null.
    Throws:
      `IllegalStateException` - if options were not yet set.

  - ### setOptions

    public void setOptions(Options options)
    Sets the options of the associated configuration unit.
    Parameters:
      `options` - the options, not null.
    Throws:
      `NullPointerException` - if options is null.

  - ### getOutputDirectory

    public File getOutputDirectory(String outputDirKey)
    Returns the output directory for a given output directory key.
    Parameters:
      `outputDirKey` - the key which output directory should be returned. Null represents the default output directory and is always mapped to a non-null value.
    Returns:
      the output directory for the key, not null.
    Throws:
      `IllegalStateException` - if the default output directory was not yet set.

  - ### getOutputDirectoryMap

    public Map<String,File> getOutputDirectoryMap()
    Returns the output directory map which contains the mapping from output directory key to output directory.
    Returns:
      the immutable output directory map, not null, contains at least a mapping for the key null.
    Throws:
      `IllegalStateException` - if no mapping is contained for the key null.

  - ### setOutputDirectoryMap

    public void setOutputDirectoryMap(Map<String,File> outputDirectoryMap)
    Sets the output directory map which contains the mapping from output directory key to output directory.
    Parameters:
      `outputDirectoryMap` - the new output directory map, must contain at least a mapping for the key null.
    Throws:
      `NullPointerException` - if outputDirectoryMap is null.
      `IllegalStateException` - if the target directory was not yet set.

  - ### getWorkDirectory

    public File getWorkDirectory()
    Returns the work directory where the generator can store internal files.
    Returns:
      the directory where the generator can store internal files, not null.
    Throws:
      `IllegalStateException` - if the target directory was not yet set.

  - ### setWorkDirectory

    public void setWorkDirectory(File workDirectory)
    Sets the work directory where the generator can store internal files.
    Parameters:
      `workDirectory` - the work directory, not null.
    Throws:
      `NullPointerException` - if workDirectory is null.

  - ### getCacheDirectory

    public File getCacheDirectory()
    Returns the cache directory where the generator can store internal files.
    Returns:
      the directory where the generator can store internal files, not null.
    Throws:
      `IllegalStateException` - if the target directory was not yet set.

  - ### setCacheDirectory

    public void setCacheDirectory(File cacheDirectory)
    Sets the cache directory where the generator can store internal files.
    Parameters:
      `cacheDirectory` - the work directory, not null.
    Throws:
      `NullPointerException` - if workDirectory is null.

  - ### setOutputList

    public void setOutputList(List<Output> outputList)
    Sets the output activities of the associated configuration unit.
    Parameters:
      `outputList` - the output activities, not null.
    Throws:
      `NullPointerException` - if outputFiles is null.

  - ### getOutputList

    public List<Output> getOutputList()
    Returns the list of output definitions of the associated configuration unit.
    Returns:
      the output definitions, not null.
    Throws:
      `IllegalStateException` - if the output definitions were not yet set.

  - ### getLoglevel

    public Loglevel getLoglevel()
    Returns the Loglevel during generation.
    Returns:
      the Loglevel, not null.
    Throws:
      `IllegalStateException` - if the loglevel is not yet set.

  - ### setLoglevel

    public void setLoglevel(Loglevel loglevel)
    Sets the Loglevel during generation.
    Parameters:
      `loglevel` - the Loglevel, not null.
    Throws:
      `NullPointerException` - if loglevel is set to null.

  - ### isAddDebuggingInfoToOutput

    public boolean isAddDebuggingInfoToOutput()
    Returns whether to add debug information to the output.
    Returns:
      true if debug information should be added, false otherwise.

  - ### setAddDebuggingInfoToOutput

    public void setAddDebuggingInfoToOutput(boolean addDebuggingInfoToOutput)
    Sets whether to add debug information to the output.
    Parameters:
      `addDebuggingInfoToOutput` - true if debug information should be added, false otherwise.

  - ### getConfigurationHandlers

    public ConfigurationHandlers getConfigurationHandlers()
    Returns the configuration handlers used to parse the configuration of this generation unit.
    Returns:
      the configuration handlers, not null.
    Throws:
      `IllegalStateException` - if configurationHandlers was not set.

  - ### setConfigurationHandlers

    public void setConfigurationHandlers(ConfigurationHandlers configurationHandlers)
    Sets the configuration handlers used to parse the configuration of this generation unit.
    Parameters:
      `configurationHandlers` - the configuration handlers, not null.
    Throws:
      `NullPointerException` - if configurationHandlers is null.

  - ### getOverrideSourceProvider

    public SourceProvider getOverrideSourceProvider()
    Returns the source provider which overrides the source provider defined in the control file.
    Returns:
      the overriding source provider, or null to use the source provider defined in the control file.
    Throws:
      `NullPointerException` - if overrideSourceFileset was not yet set.

  - ### setOverrideSourceProvider

    public void setOverrideSourceProvider(SourceProvider overrideSourceProvider)
    Sets the source provider which overrides the source provider defined in the control file.
    Parameters:
      `overrideSourceProvider` - the override source provider, or null to use the source provider defined in the control file.

  - ### getEntityReferences

    public EntityReferences getEntityReferences()
    Returns the entityReferences of the associated configuration unit.
    Returns:
      the entityReferences, not null.
    Throws:
      `IllegalStateException` - if entityReferences were not yet set.

  - ### setEntityReferences

    public void setEntityReferences(EntityReferences entityReferences)
    Sets the entityReferences of the associated configuration unit.
    Parameters:
      `entityReferences` - the entityReferences, not null.
    Throws:
      `NullPointerException` - if entityReferences is null.

  - ### getDefaultOutputEncoding

    public Charset getDefaultOutputEncoding()
    Returns the output CharSet if no specific encoding has been set in the output.
    Returns:
      the default output encoding, null for the default platform encoding.

  - ### setDefaultOutputEncoding

    public void setDefaultOutputEncoding(Charset defaultOutputCharset)
    Sets the output encoding if no specificdefaultOutputCharsetg has been set in the output.
    Parameters:
      `defaultOutputCharset` - the default output encoding, null for the default platform encoding.

  - ### getClassLoader

    public ClassLoader getClassLoader()
    Returns the class loader to use by the generator when accessing the templates or classes defined within the templates.
    Returns:
      the class loader for the templates, or null if the standard class loader of the torque generator classes is used.

  - ### setClassLoader

    public void setClassLoader(ClassLoader classLoader)
    Sets the class loader to use by the generator when accessing the templates or classes defined within the templates.
    Parameters:
      `classLoader` - the class loader for the templates, or null if the standard class loader of the torque generator classes should be used.

  - ### isRunOnlyOnSourceChange

    public boolean isRunOnlyOnSourceChange()
    Returns true if only the sources should be processed which have changed since last generation.
    Returns:
      false if the controller should be run irrespective of changes in the source files, true if the controller should be run for source files which have changed during last generation.

  - ### setRunOnlyOnSourceChange

    public void setRunOnlyOnSourceChange(boolean runOnlyOnSourceChange)
    Sets whether only the sources should be processed which have changed since last generation.
    Parameters:
      `runOnlyOnSourceChange` - false if the controller should be run irrespective of changes in the source files, true if the controller should be run for source files which have changed during last generation.

  - ### getTemplateSetName

    public String getTemplateSetName()
    Returns the name of the template set.
    Returns:
      the name of the template set.

  - ### setTemplateSetName

    public void setTemplateSetName(String name)
    Sets the name of the template set.
    Parameters:
      `name` - the name of the template set.

  - ### isInit

    public boolean isInit()
    Checks whether the unit configuration is fully initialized.
    Returns:
      true if the unit configuration is fully initialized, false otherwise.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`