org.apache.torque.generator.configuration
Class DirectoryConfigurationProvider

java.lang.Object
  extended by org.apache.torque.generator.configuration.DirectoryConfigurationProvider
All Implemented Interfaces:
ConfigurationProvider

public class DirectoryConfigurationProvider
extends Object
implements ConfigurationProvider

Provides InputStreams to read the configuration from a directory.


Constructor Summary
DirectoryConfigurationProvider(ProjectPaths projectPaths, TorqueGeneratorPaths configurationPaths)
          Constructor.
 
Method Summary
 InputStream getControlConfigurationInputStream()
          Creates a reader to access the control configuration.
 String getControlConfigurationLocation()
          Returns the location of the control configuration as human readable String for debugging and error tracking purposes.
 InputStream getOptionsInputStream(String name)
          Creates a reader to access an options file.
 InputStream getOutletConfigurationInputStream(String name)
          Creates a reader to access the configuration for one outlet.
 Collection<String> getOutletConfigurationNames()
          Returns a list of all found outlet configuration files in the generation unit.
 InputStream getResourceInputStream(String name)
          Creates a reader to access a resource file.
 InputStream getTemplateInputStream(String name)
          Creates a reader to access a template.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryConfigurationProvider

public DirectoryConfigurationProvider(ProjectPaths projectPaths,
                                      TorqueGeneratorPaths configurationPaths)
Constructor.

Parameters:
projectPaths - the paths needed to interact with the enclosing project, not null.
configurationPaths - The internal directory structure of the generator files, not null.
Throws:
NullPointerException - if projectPaths or configurationPaths are null.
Method Detail

getControlConfigurationInputStream

public InputStream getControlConfigurationInputStream()
                                               throws ConfigurationException
Description copied from interface: ConfigurationProvider
Creates a reader to access the control configuration. It is the callers responsibility to close the reader after use.

Specified by:
getControlConfigurationInputStream in interface ConfigurationProvider
Returns:
a reader to access the control configuration, never null.
Throws:
ConfigurationException - if the reader can not be created.

getControlConfigurationLocation

public String getControlConfigurationLocation()
                                       throws ConfigurationException
Description copied from interface: ConfigurationProvider
Returns the location of the control configuration as human readable String for debugging and error tracking purposes.

Specified by:
getControlConfigurationLocation in interface ConfigurationProvider
Returns:
the location of the control configuration, not null.
Throws:
ConfigurationException - if the location name can not be created.

getTemplateInputStream

public InputStream getTemplateInputStream(String name)
                                   throws ConfigurationException
Description copied from interface: ConfigurationProvider
Creates a reader to access a template. It is the callers responsibility to close the reader after use.

Specified by:
getTemplateInputStream in interface ConfigurationProvider
Parameters:
name - the name (==path to) of the template.
Returns:
a reader to access a template, never null.
Throws:
ConfigurationException - if the reader can not be created.

getOutletConfigurationInputStream

public InputStream getOutletConfigurationInputStream(String name)
                                              throws ConfigurationException
Description copied from interface: ConfigurationProvider
Creates a reader to access the configuration for one outlet. It is the callers responsibility to close the reader after use.

Specified by:
getOutletConfigurationInputStream in interface ConfigurationProvider
Parameters:
name - the name (==path to) of the outlet configuration.
Returns:
a reader to access the outlet configuration, never null.
Throws:
ConfigurationException - if the reader can not be created.

getResourceInputStream

public InputStream getResourceInputStream(String name)
                                   throws ConfigurationException
Description copied from interface: ConfigurationProvider
Creates a reader to access a resource file. It is the callers responsibility to close the reader after use.

Specified by:
getResourceInputStream in interface ConfigurationProvider
Parameters:
name - the path to of the resource file.
Returns:
a reader to access the options file, never null.
Throws:
ConfigurationException - if the reader can not be created.

getOptionsInputStream

public InputStream getOptionsInputStream(String name)
                                  throws ConfigurationException
Description copied from interface: ConfigurationProvider
Creates a reader to access an options file. It is the callers responsibility to close the reader after use.

Specified by:
getOptionsInputStream in interface ConfigurationProvider
Parameters:
name - the name (==path to) of the options file.
Returns:
a reader to access the options file, never null.
Throws:
ConfigurationException - if the reader can not be created.

getOutletConfigurationNames

public Collection<String> getOutletConfigurationNames()
                                               throws ConfigurationException
Description copied from interface: ConfigurationProvider
Returns a list of all found outlet configuration files in the generation unit.

Specified by:
getOutletConfigurationNames in interface ConfigurationProvider
Returns:
a list with the generation configuration files, not null.
Throws:
ConfigurationException - if the configuration can not be read.


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