public abstract class AbstractLocalConfiguration extends AbstractConfiguration implements LocalConfiguration
ContainerConfiguration that can be
specialized for standalone configuration, existing configuration or other local configurations.| Modifier and Type | Field and Description |
|---|---|
protected static String |
RESOURCE_PATH
The path under which the container resources are stored in the JAR.
|
| Constructor and Description |
|---|
AbstractLocalConfiguration(String home) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDataSource(DataSource dataSource)
Add data source the container can take advantage of.
|
protected void |
addDataSourcesFromProperties()
Parse properties and add any DataSources to pending configuration.
|
void |
addDeployable(Deployable newDeployable)
Deploy a
Deployable in the container. |
void |
addResource(Resource resource)
Add resources the container can take advantage of.
|
protected void |
addResourcesFromProperties()
Parse properties and add any Resources to pending configuration.
|
void |
applyPortOffset()
Apply the port offset to the configuration port properties.
|
protected void |
applyPortOffset(String name)
Apply the port offset on the specified property
|
void |
collectUnsupportedDataSourcesAndThrowException()
Warn user and throw an Exception if any unsupported
DataSources are setup for this
configuration. |
void |
collectUnsupportedResourcesAndThrowException()
Warn user and throw an Exception if any unsupported
Resources are setup for this
configuration. |
void |
configure(LocalContainer container)
Setup the container which means setting up a valid directory structure, setting up
configuration files and deploying static deployables.
|
protected void |
configureFiles(org.apache.tools.ant.types.FilterChain filterChain,
LocalContainer container)
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 abstract void |
doConfigure(LocalContainer container)
Implementation of
LocalConfiguration.configure(LocalContainer) that all local
configuration using this class must implement. |
protected AntUtils |
getAntUtils() |
List<DataSource> |
getDataSources() |
List<Deployable> |
getDeployables() |
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.
|
FileHandler |
getFileHandler() |
List<FileConfig> |
getFileProperties()
Returns the file configurations.
|
protected org.apache.tools.ant.types.FilterChain |
getFilterChain() |
String |
getHome() |
List<Resource> |
getResources() |
protected ResourceUtils |
getResourceUtils() |
void |
parsePropertiesForPendingConfiguration()
Some configuration can be specified as encoded properties.
|
void |
revertPortOffset()
Revert the port offset on the configuration port properties.
|
protected void |
revertPortOffset(String name)
Revert the port offset on the specified property
|
void |
setConfigFileProperty(FileConfig fileConfig)
set the config file property for a configuration.
|
void |
setFileHandler(FileHandler fileHandler) |
void |
setFileProperty(FileConfig fileConfig)
set the file property for a configuration.
|
void |
setLogger(Logger logger)
Overriden in order to set the logger on ancillary components.
|
void |
verify()
Verify that the configuration is valid.
|
getProperties, getPropertyValue, setPropertygetLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCapability, getProperties, getPropertyValue, getType, setPropertyprotected static final String RESOURCE_PATH
public AbstractLocalConfiguration(String home)
home - the home directory where the container will be set up to start and where it will
deploy its deployables. IMPORTANT: While some containers can deal with this parameter
being set as a relative path, some others require this path to be set to an absolute
directory. Please refer to the documentation of the server to ensure you give the path in
the appropriate way. If in doubt, you can use absolute paths -that is known to work with all
containers.public void setLogger(Logger logger)
setLogger in interface LoggablesetLogger in class LoggedObjectlogger - the logger to set and set in the ancillary objectsLoggable.setLogger(org.codehaus.cargo.util.log.Logger)public FileHandler getFileHandler()
getFileHandler in interface LocalConfigurationpublic void setFileHandler(FileHandler fileHandler)
setFileHandler in interface LocalConfigurationfileHandler - the file utility class to use for performing all file I/O.protected final AntUtils getAntUtils()
protected final ResourceUtils getResourceUtils()
public void setFileProperty(FileConfig fileConfig)
setFileProperty in interface LocalConfigurationfileConfig - The FileConfig to useorg.codehaus.cargo.container.configuration.LocalConfiguration#addConfigfile(org.codehaus.cargo.container.configuration.FileConfig)public void setConfigFileProperty(FileConfig fileConfig)
setConfigFileProperty in interface LocalConfigurationfileConfig - The FileConfig to useorg.codehaus.cargo.container.configuration.LocalConfiguration#addConfigfile(org.codehaus.cargo.container.configuration.FileConfig)public List<FileConfig> getFileProperties()
getFileProperties in interface LocalConfigurationorg.codehaus.cargo.container.configuration.StandaloneLocalConfiguration#getConfigfiles()public void addDeployable(Deployable newDeployable)
Deployable in the container. It installs the Deployable in the
container's configuration directory.addDeployable in interface LocalConfigurationnewDeployable - the Deployable to deployLocalConfiguration.addDeployable(org.codehaus.cargo.container.deployable.Deployable)public List<Deployable> getDeployables()
getDeployables in interface LocalConfigurationDeployables that are going to be deployed in the container when
it is startedLocalConfiguration.getDeployables()public String getHome()
getHome in interface LocalConfigurationLocalConfiguration.getHome()public void configure(LocalContainer container)
configure in interface LocalConfigurationcontainer - the container to configureLocalConfiguration.configure(LocalContainer)protected final org.apache.tools.ant.types.FilterChain createFilterChain()
protected org.apache.tools.ant.types.FilterChain getFilterChain()
protected void configureFiles(org.apache.tools.ant.types.FilterChain filterChain,
LocalContainer container)
filterChain - the filter chain to use during the copycontainer - local containerprotected 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 filepublic void verify()
verify in interface ContainerConfigurationverify in class AbstractConfigurationContainerConfiguration.verify()public void collectUnsupportedResourcesAndThrowException()
Resources are setup for this
configuration.public void collectUnsupportedDataSourcesAndThrowException()
DataSources are setup for this
configuration.public void parsePropertiesForPendingConfiguration()
protected void addResourcesFromProperties()
ResourcePropertySet.RESOURCEprotected void addDataSourcesFromProperties()
DatasourcePropertySet.DATASOURCEprotected abstract void doConfigure(LocalContainer container) throws Exception
LocalConfiguration.configure(LocalContainer) that all local
configuration using this class must implement. This provides the ability to perform generic
actions before and after the container-specific implementation. Another way would be to use
AOP...container - the container to configureException - if any error is raised during the configurationpublic void addResource(Resource resource)
addResource in interface LocalConfigurationresource - the Resource to add.LocalConfiguration.addResource(Resource)public List<Resource> getResources()
getResources in interface LocalConfigurationpublic void addDataSource(DataSource dataSource)
addDataSource in interface LocalConfigurationdataSource - the DataSource to add.LocalConfiguration.addDataSource(DataSource)public List<DataSource> getDataSources()
getDataSources in interface LocalConfigurationLocalConfiguration.getDataSources()public void applyPortOffset()
applyPortOffset in interface LocalConfigurationThis method should only be called once all the properties has been set.public void revertPortOffset()
revertPortOffset in interface LocalConfigurationThis method should only be called once all the properties has been set.protected void applyPortOffset(String name)
name - the property nameprotected void revertPortOffset(String name)
name - the property nameCopyright © 2004-2013 Codehaus. All Rights Reserved.