org.codehaus.cargo.container.spi.configuration
Class AbstractStandaloneLocalConfiguration

java.lang.Object
  extended by org.codehaus.cargo.util.log.LoggedObject
      extended by org.codehaus.cargo.container.spi.configuration.AbstractConfiguration
          extended by org.codehaus.cargo.container.spi.configuration.AbstractLocalConfiguration
              extended by org.codehaus.cargo.container.spi.configuration.AbstractStandaloneLocalConfiguration
All Implemented Interfaces:
Configuration, LocalConfiguration, StandaloneLocalConfiguration, ContainerConfiguration, Loggable
Direct Known Subclasses:
AbstractJettyStandaloneLocalConfiguration, AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder, Geronimo1xStandaloneLocalConfiguration, JBossStandaloneLocalConfiguration, Jetty6xStandaloneLocalConfiguration, Jetty7xStandaloneLocalConfiguration, Jo1xStandaloneLocalConfiguration

public abstract class AbstractStandaloneLocalConfiguration
extends AbstractLocalConfiguration
implements StandaloneLocalConfiguration

Base implementation for a standalone local configuration.

Version:
$Id: AbstractStandaloneLocalConfiguration.java 1906 2009-02-19 16:43:11Z mwringe $

Field Summary
 
Fields inherited from class org.codehaus.cargo.container.spi.configuration.AbstractLocalConfiguration
RESOURCE_PATH
 
Constructor Summary
AbstractStandaloneLocalConfiguration(String dir)
          
 
Method Summary
 void configure(LocalContainer container)
          Configure the specified container.
protected  void configureFiles(org.apache.tools.ant.types.FilterChain filterChain)
          Copy the customized configuration files into the cargo home directory.
protected  org.apache.tools.ant.types.FilterChain createFilterChain()
          Creates the default filter chain that should be applied while copying container configuration files to the working directory from which the container is started.
protected  String getDestDirectoryLocation(String file, String toDir)
          Determines the correct path for the destination directory.
protected  String getDestFileLocation(String file, String toDir, String toFile)
          Determines the correct path for the destination file.
 List getFileProperties()
          Returns the file configurations.
 org.apache.tools.ant.types.FilterChain getFilterChain()
          Returns the filterchain for this configuration.
 ConfigurationType getType()
          
 void setConfigFileProperty(FileConfig fileConfig)
          set the config file property for a configuration.
 void setFileProperty(FileConfig fileConfig)
          set the file property for a configuration.
protected  void setupConfigurationDir()
          Set up the configuration directory (create it and clean it).
 void verify()
          Verify that the configuration is valid.
 
Methods inherited from class org.codehaus.cargo.container.spi.configuration.AbstractLocalConfiguration
addDataSource, addDataSourcesFromProperties, addDeployable, addResource, addResourcesFromProperties, collectUnsupportedDataSourcesAndThrowException, collectUnsupportedResourcesAndThrowException, doConfigure, getAntUtils, getDataSources, getDeployables, getFileHandler, getHome, getResources, getResourceUtils, parsePropertiesForPendingConfiguration, setFileHandler
 
Methods inherited from class org.codehaus.cargo.container.spi.configuration.AbstractConfiguration
getProperties, getPropertyValue, setProperty
 
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.cargo.container.configuration.LocalConfiguration
addDeployable, addResource, getDeployables, getFileHandler, getHome, getResources, setFileHandler
 
Methods inherited from interface org.codehaus.cargo.container.configuration.Configuration
getCapability, getProperties, getPropertyValue, setProperty
 
Methods inherited from interface org.codehaus.cargo.util.log.Loggable
getLogger, setLogger
 

Constructor Detail

AbstractStandaloneLocalConfiguration

public AbstractStandaloneLocalConfiguration(String dir)

See Also:
AbstractLocalConfiguration.AbstractLocalConfiguration(String)
Method Detail

configure

public void configure(LocalContainer container)
Configure the specified container.

Specified by:
configure in interface LocalConfiguration
Overrides:
configure in class AbstractLocalConfiguration
Parameters:
container - the container to configure
See Also:
LocalConfiguration.configure(LocalContainer)

setupConfigurationDir

protected void setupConfigurationDir()
                              throws IOException
Set up the configuration directory (create it and clean it). We clean it because we want to be sure the container starts with the same set up every time and there's no side effects introduced by a previous run or someone modifying some files in there.

Note: We only clean the configuration directory if it's empty or if there is a Cargo timestamp file. This is to prevent deleting not empty directories if the user has mistakenly pointed the configuration dir to an existing location.

Throws:
IOException - if the directory cannot be created

createFilterChain

protected final org.apache.tools.ant.types.FilterChain createFilterChain()
Creates the default filter chain that should be applied while copying container configuration files to the working directory from which the container is started.

Returns:
The default filter chain

verify

public void verify()
Verify that the configuration is valid. The checks to be performed may vay whether this is standalone or existing configuration. This method should also be used to verify that the configuration properties specified by the user are valid and that the required ones are set.

Specified by:
verify in interface ContainerConfiguration
Overrides:
verify in class AbstractLocalConfiguration
See Also:
ContainerConfiguration.verify()

getType

public ConfigurationType getType()

Specified by:
getType in interface Configuration
Returns:
the configuration type (standalone, existing, runtime, etc)
See Also:
Configuration.getType()

getFilterChain

public org.apache.tools.ant.types.FilterChain getFilterChain()
Returns the filterchain for this configuration.

Specified by:
getFilterChain in interface StandaloneLocalConfiguration
Returns:
The filterchain

setFileProperty

public void setFileProperty(FileConfig fileConfig)
set the file property for a configuration.

Specified by:
setFileProperty in interface StandaloneLocalConfiguration
Parameters:
fileConfig - The FileConfig to use
See Also:
org.codehaus.cargo.container.configuration.StandaloneLocalConfiguration#addConfigfile(org.codehaus.cargo.container.configuration.FileConfig)

setConfigFileProperty

public void setConfigFileProperty(FileConfig fileConfig)
set the config file property for a configuration.

Specified by:
setConfigFileProperty in interface StandaloneLocalConfiguration
Parameters:
fileConfig - The FileConfig to use
See Also:
org.codehaus.cargo.container.configuration.StandaloneLocalConfiguration#addConfigfile(org.codehaus.cargo.container.configuration.FileConfig)

getFileProperties

public List getFileProperties()
Returns the file configurations.

Specified by:
getFileProperties in interface StandaloneLocalConfiguration
Returns:
The configuration file properies
See Also:
org.codehaus.cargo.container.configuration.StandaloneLocalConfiguration#getConfigfiles()

configureFiles

protected void configureFiles(org.apache.tools.ant.types.FilterChain filterChain)
Copy the customized configuration files into the cargo home directory.

Parameters:
filterChain - the filter chain to use during the copy

getDestFileLocation

protected String getDestFileLocation(String file,
                                     String toDir,
                                     String toFile)
Determines the correct path for the destination file.

Parameters:
file - The path of the original file
toDir - The directory for the copied file
toFile - The file name for the copied file
Returns:
The path for the destination file

getDestDirectoryLocation

protected String getDestDirectoryLocation(String file,
                                          String toDir)
Determines the correct path for the destination directory.

Parameters:
file - The path of the original file
toDir - The directory for the copied file
Returns:
The path for the destination file


Copyright © 2004-2012 Codehaus. All Rights Reserved.