org.apache.torque.generator.configuration.paths
Class CustomProjectPaths

java.lang.Object
  extended by org.apache.torque.generator.configuration.paths.CustomProjectPaths
All Implemented Interfaces:
ProjectPaths

public class CustomProjectPaths
extends Object
implements ProjectPaths

Implementation of ProjectPaths with custom paths.


Constructor Summary
CustomProjectPaths(File configurationDir, String configurationPackage, File sourceDir, Map<String,File> outputDirectoryMap, File workDir)
          Constructor.
CustomProjectPaths(ProjectPaths toCopy)
          Copy-constructor.
 
Method Summary
 String getConfigurationPackage()
          Returns the root package of the Torque generator files.
 File getConfigurationPath()
          Returns the root directory for the Torque generator files, relative to the project root.
 File getDefaultSourcePath()
          Returns the default directory for the source files, relative to the project root.
 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.
 File getWorkDirectory()
          Returns the directory where the torque generator can store internal files, relative to the project root.
 boolean isInit()
          returns whether the current settings are valid.
 void setConfigurationDir(File configurationDir)
          Sets the root directory for the Torque generator configuration files, absolute or relative to the project root.
 void setConfigurationPackage(String configurationPackage)
          Sets the root package for the Torque generator files, relative to the project root.
 void setOutputDirectory(String outputDirKey, File outputDir)
          Sets the output directory for a given output directory key.
 void setOutputDirectoryMap(Map<String,File> outputDirectoryMap)
          Sets the contents of the output directory map.
 void setSourceDir(File sourceDir)
          Sets the default directory for the source files, relative to the current directory, or absolute.
 void setWorkDir(File workDir)
          Sets the directory where the torque generator can store internal files, relative to the current directory, or absolute.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CustomProjectPaths

public CustomProjectPaths(ProjectPaths toCopy)
Copy-constructor.

Parameters:
toCopy - the default project paths to copy, not null.
Throws:
NullPointerException - if toCopy is null.

CustomProjectPaths

public CustomProjectPaths(File configurationDir,
                          String configurationPackage,
                          File sourceDir,
                          Map<String,File> outputDirectoryMap,
                          File workDir)
Constructor.

Parameters:
configurationDir - the configuration directory for the Torque generator configuration files, or null if the configuration files are loaded from the classpath.
configurationPackage - the package containing the Torque generator configuration files, or null if the configuration files are loaded from the file system.
sourceDir - the default directory for the source files, or null.
outputDirectoryMap - The output directories for the files, keyed by the output directory key. The directory with the key null is the default output directory.
workDir - directory where the torque generator can store internal files.
Method Detail

setConfigurationDir

public void setConfigurationDir(File configurationDir)
Sets the root directory for the Torque generator configuration files, absolute or relative to the project root.

Parameters:
configurationDir - the configuration directory for the Torque generator configuration files, null to invalidate the current setting.

setConfigurationPackage

public void setConfigurationPackage(String configurationPackage)
Sets the root package for the Torque generator files, relative to the project root.

Parameters:
configurationPackage - the configuration root package for the Torque generator files.

setSourceDir

public void setSourceDir(File sourceDir)
Sets the default directory for the source files, relative to the current directory, or absolute. "Default" means that the setting can be overridden in a unit of generation.

Parameters:
sourceDir - the default directory for the source files, null to invalidate the current setting.

setOutputDirectory

public void setOutputDirectory(String outputDirKey,
                               File outputDir)
Sets the output directory for a given output directory key.

Parameters:
outputDirKey - the output directory key, or null for the default output directory.
outputDir - the output directory for the key, relative to the current directory, or absolute. Use null to remove the output directory for the key.

setOutputDirectoryMap

public void setOutputDirectoryMap(Map<String,File> outputDirectoryMap)
Sets the contents of the output directory map. The directory with the key null is the default output directory.

Parameters:
outputDirectoryMap - the new output directory map.

setWorkDir

public void setWorkDir(File workDir)
Sets the directory where the torque generator can store internal files, relative to the current directory, or absolute.

Parameters:
workDir - the directory for internal files, null to invalidate the current setting.

getConfigurationPath

public File getConfigurationPath()
Returns the root directory for the Torque generator files, relative to the project root.

Specified by:
getConfigurationPath in interface ProjectPaths
Returns:
the directory for the Torque generator files, not null.
Throws:
IllegalStateException - if one of the required parameters is not set.

getConfigurationPackage

public String getConfigurationPackage()
Returns the root package of the Torque generator files.

Specified by:
getConfigurationPackage in interface ProjectPaths
Returns:
the root package of the Torque generator files.
Throws:
IllegalStateException - if one of the required parameters is not set.

getDefaultSourcePath

public File getDefaultSourcePath()
Returns the default directory for the source files, relative to the project root. "Default" means that the setting can be overridden in a unit of generation.

Specified by:
getDefaultSourcePath in interface ProjectPaths
Returns:
the directory for the source files, not null.
Throws:
IllegalStateException - if one of the required parameters is not set.

getOutputDirectory

public File getOutputDirectory(String outputDirKey)
Returns the output directory for a given output directory key.

Specified by:
getOutputDirectory in interface ProjectPaths
Parameters:
outputDirKey - the output directory key, or null for the default output directory.
Returns:
the output directory for the key, relative to the current directory, or absolute, not null.
Throws:
IllegalStateException - if one of the required parameters is not set.
IllegalArgumentException - if the outputDirKey is unknown.

getOutputDirectoryMap

public Map<String,File> getOutputDirectoryMap()
Returns the output directory map which contains the mapping from output directory key to output directory.

Specified by:
getOutputDirectoryMap in interface ProjectPaths
Returns:
the mutable output directory map, not null, contains at least a mapping for the key null.
Throws:
IllegalStateException - if one of the required parameters is not set.

getWorkDirectory

public File getWorkDirectory()
Returns the directory where the torque generator can store internal files, relative to the project root.

Specified by:
getWorkDirectory in interface ProjectPaths
Returns:
the directory where the torque generator can store internal files, not null.
Throws:
IllegalStateException - if one of the required parameters is not set.

isInit

public boolean isInit()
returns whether the current settings are valid. It is checked whether all necessary informations are set.

Returns:
true if the current settings are valid, false otherwise.

toString

public String toString()
Overrides:
toString in class Object


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