public abstract class AbstractStandaloneLocalConfiguration extends AbstractLocalConfiguration implements StandaloneLocalConfiguration
RESOURCE_PATH| Constructor and Description |
|---|
AbstractStandaloneLocalConfiguration(String dir) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addXmlReplacement(String filename,
String xpathExpression,
String configurationPropertyName)
Adds an XML replacement.
|
protected void |
addXmlReplacement(String filename,
String xpathExpression,
String attributeName,
String configurationPropertyName)
Adds an XML replacement.
|
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<FileConfig> |
getFileProperties()
Returns the file configurations.
|
org.apache.tools.ant.types.FilterChain |
getFilterChain()
Returns the filterchain for this configuration.
|
ConfigurationType |
getType() |
protected void |
performXmlReplacements(LocalContainer container)
Perform the XML replacements for the specified container.
|
protected void |
removeXmlReplacement(String filename,
String xpathExpression)
Removes an XML replacement.
|
protected void |
removeXmlReplacement(String filename,
String xpathExpression,
String attributeName)
Removes an XML replacement.
|
protected void |
replaceInFile(String file,
Map<String,String> replacements,
String encoding)
Replaces using a map of replacements in a given file.
|
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.
|
addDataSource, addDataSourcesFromProperties, addDeployable, addResource, addResourcesFromProperties, applyPortOffset, applyPortOffset, collectUnsupportedDataSourcesAndThrowException, collectUnsupportedResourcesAndThrowException, doConfigure, getAntUtils, getDataSources, getDeployables, getFileHandler, getHome, getResources, getResourceUtils, parsePropertiesForPendingConfiguration, revertPortOffset, revertPortOffset, setFileHandler, setLoggergetProperties, getPropertyValue, setPropertygetLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddDataSource, addDeployable, addResource, applyPortOffset, getDataSources, getDeployables, getFileHandler, getHome, getResources, revertPortOffset, setFileHandlergetCapability, getProperties, getPropertyValue, setPropertypublic AbstractStandaloneLocalConfiguration(String dir)
public void configure(LocalContainer container)
configure in interface LocalConfigurationconfigure in class AbstractLocalConfigurationcontainer - the container to configureLocalConfiguration.configure(LocalContainer)protected void performXmlReplacements(LocalContainer container)
container - the container to configureprotected void setupConfigurationDir()
throws IOException
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.
IOException - if the directory cannot be createdprotected final org.apache.tools.ant.types.FilterChain createFilterChain()
protected void addXmlReplacement(String filename, String xpathExpression, String configurationPropertyName)
filename - File in which to replace.xpathExpression - XPath expression to look for.configurationPropertyName - Name of the configuration property to set. The XML
replacement will be ignored if the property is set to null.protected void addXmlReplacement(String filename, String xpathExpression, String attributeName, String configurationPropertyName)
filename - File in which to replace.xpathExpression - XPath expression to look for.attributeName - Attribute name to modify. If null, the node's contents
will be modified.configurationPropertyName - Name of the configuration property to set. The XML
replacement will be ignored if the property is set to null.protected void removeXmlReplacement(String filename, String xpathExpression)
filename - File in which to replace.xpathExpression - XPath expression to look for.protected void removeXmlReplacement(String filename, String xpathExpression, String attributeName)
filename - File in which to replace.xpathExpression - XPath expression to look for.attributeName - Attribute name to modify. If null, the node's contents
will be modified.public void verify()
verify in interface ContainerConfigurationverify in class AbstractLocalConfigurationContainerConfiguration.verify()public ConfigurationType getType()
getType in interface ConfigurationConfiguration.getType()public org.apache.tools.ant.types.FilterChain getFilterChain()
getFilterChain in interface StandaloneLocalConfigurationpublic void setFileProperty(FileConfig fileConfig)
setFileProperty in interface StandaloneLocalConfigurationfileConfig - The FileConfig to useorg.codehaus.cargo.container.configuration.StandaloneLocalConfiguration#addConfigfile(org.codehaus.cargo.container.configuration.FileConfig)public void setConfigFileProperty(FileConfig fileConfig)
setConfigFileProperty in interface StandaloneLocalConfigurationfileConfig - The FileConfig to useorg.codehaus.cargo.container.configuration.StandaloneLocalConfiguration#addConfigfile(org.codehaus.cargo.container.configuration.FileConfig)public List<FileConfig> getFileProperties()
getFileProperties in interface StandaloneLocalConfigurationorg.codehaus.cargo.container.configuration.StandaloneLocalConfiguration#getConfigfiles()protected void configureFiles(org.apache.tools.ant.types.FilterChain filterChain)
filterChain - the filter chain to use during the copyprotected String getDestFileLocation(String file, String toDir, String toFile)
file - The path of the original filetoDir - The directory for the copied filetoFile - The file name for the copied fileprotected String getDestDirectoryLocation(String file, String toDir)
file - The path of the original filetoDir - The directory for the copied fileprotected void replaceInFile(String file, Map<String,String> replacements, String encoding) throws CargoException
file - File to replace in.replacements - Map containing replacements.encoding - The character encoding to use, may be null or empty to use the
platform's default encoding.CargoException - If anything fails, most notably if one of the replacements does not
exist in the file.Copyright © 2004-2013 Codehaus. All Rights Reserved.