Class AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.container.spi.configuration.AbstractConfiguration
-
- org.codehaus.cargo.container.spi.configuration.AbstractLocalConfiguration
-
- org.codehaus.cargo.container.spi.configuration.AbstractStandaloneLocalConfiguration
-
- org.codehaus.cargo.container.spi.configuration.builder.AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder
-
- All Implemented Interfaces:
Configuration
,DataSourceSupport
,ResourceSupport
,LocalConfiguration
,StandaloneLocalConfiguration
,ContainerConfiguration
,Loggable
- Direct Known Subclasses:
AbstractCatalinaStandaloneLocalConfiguration
,AbstractOrionStandaloneLocalConfiguration
,AbstractResinStandaloneLocalConfiguration
,JRun4xStandaloneLocalConfiguration
,WebLogic8xStandaloneLocalConfiguration
,WebLogic9xStandaloneLocalConfiguration
public abstract class AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder extends AbstractStandaloneLocalConfiguration implements DataSourceSupport, ResourceSupport
Base implementation for a standalone local configuration. Convenience class that simplifies development ofStandaloneLocalConfiguration
configurations withDataSourceSupport
. It does this by implementingDataSourceSupport
and instead asking for the inputs to this:-
createConfigurationBuilder(org.codehaus.cargo.container.LocalContainer)
: how do we generate the xml element(s) representing the datasource -
getXpathForDataSourcesParent()
: under which element should datasource elements be inserted? -
getNamespaces()
: does this configuration file use namespaces? -
getOrCreateDataSourceConfigurationFile(org.codehaus.cargo.container.configuration.entry.DataSource,org.codehaus.cargo.container.LocalContainer)
: where do we load and store the datasource configuration?
-
-
Field Summary
-
Fields inherited from class org.codehaus.cargo.container.spi.configuration.AbstractLocalConfiguration
RESOURCE_PATH
-
-
Constructor Summary
Constructors Constructor Description AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder(String dir)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
configure(DataSource ds, LocalContainer container)
void
configure(Resource ds, LocalContainer container)
void
configure(LocalContainer container)
Configure the specified container.void
configureDataSources(LocalContainer container)
Configure the DataSources defined for this configuration.void
configureResources(LocalContainer container)
Configure the Resources defined for this configuration.protected abstract ConfigurationBuilder
createConfigurationBuilder(LocalContainer container)
protected abstract Map<String,String>
getNamespaces()
Implementations should avoid passing null, and instead passCollections.EMPTY_MAP
, if the document is DTD bound.protected abstract String
getOrCreateDataSourceConfigurationFile(DataSource ds, LocalContainer container)
note that this file could hold other configuration besides datasources.protected abstract String
getOrCreateResourceConfigurationFile(Resource resource, LocalContainer container)
note that this file could hold other configuration besides Resources.protected abstract String
getXpathForDataSourcesParent()
DataSource entries must be stored in the xml configuration file.protected abstract String
getXpathForResourcesParent()
Resource entries must be stored in the xml configuration file.protected void
writeConfigurationToXpath(String file, String xml, String path)
Utility method used to write XML to an appropriate place in the configuration file.-
Methods inherited from class org.codehaus.cargo.container.spi.configuration.AbstractStandaloneLocalConfiguration
addXmlReplacement, addXmlReplacement, addXmlReplacement, addXmlReplacement, configureFiles, getType, getXmlReplacements, performXmlReplacements, removeXmlReplacement, removeXmlReplacement, replaceInFile, setupConfigurationDir, verify
-
Methods inherited from class org.codehaus.cargo.container.spi.configuration.AbstractLocalConfiguration
addDataSource, addDataSourcesFromProperties, addDeployable, addResource, addResourcesFromProperties, addUser, addUsersFromProperties, applyPortOffset, applyPortOffset, collectUnsupportedDataSourcesAndThrowException, collectUnsupportedResourcesAndThrowException, doConfigure, flagOffsetApplied, getDataSources, getDeployables, getDestDirectoryLocation, getDestFileLocation, getFileHandler, getFileProperties, getHome, getPropertyValue, getReplacements, getResources, getResourceUtils, getUsers, isOffsetApplied, isOffsetApplied, parsePropertiesForPendingConfiguration, revertPortOffset, revertPortOffset, setConfigFileProperty, setFileHandler, setFileProperty, setLogger
-
Methods inherited from class org.codehaus.cargo.container.spi.configuration.AbstractConfiguration
getProperties, setProperty
-
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger
-
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.Configuration
getCapability, getProperties, getPropertyValue, setProperty
-
Methods inherited from interface org.codehaus.cargo.container.configuration.LocalConfiguration
addDataSource, addDeployable, addResource, addUser, applyPortOffset, getDataSources, getDeployables, getFileHandler, getFileProperties, getHome, getResources, getUsers, isOffsetApplied, revertPortOffset, setConfigFileProperty, setFileHandler, setFileProperty
-
-
-
-
Constructor Detail
-
AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder
public AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder(String dir)
- Parameters:
dir
- configuration home
-
-
Method Detail
-
getNamespaces
protected abstract Map<String,String> getNamespaces()
Implementations should avoid passing null, and instead passCollections.EMPTY_MAP
, if the document is DTD bound.- Returns:
- a map of prefixes to the url namespaces used in the datasource configuration file.
-
getXpathForDataSourcesParent
protected abstract String getXpathForDataSourcesParent()
DataSource entries must be stored in the xml configuration file. Under which element do we insert the entries? example: //Engine/DefaultContext- Returns:
- path the the parent element datasources should be inserted under.
-
getXpathForResourcesParent
protected abstract String getXpathForResourcesParent()
Resource entries must be stored in the xml configuration file. Under which element do we insert the entries? example: //Engine/DefaultContext- Returns:
- path the the parent element Resources should be inserted under.
-
getOrCreateDataSourceConfigurationFile
protected abstract String getOrCreateDataSourceConfigurationFile(DataSource ds, LocalContainer container)
note that this file could hold other configuration besides datasources.- Parameters:
ds
- the DataSource configuration you wish to install on the container.container
- the container whose configuration you wish to affect.- Returns:
- the file that holds datasource configuration.
-
getOrCreateResourceConfigurationFile
protected abstract String getOrCreateResourceConfigurationFile(Resource resource, LocalContainer container)
note that this file could hold other configuration besides Resources.- Parameters:
resource
- the Resource configuration you wish to install on the container.container
- the container whose configuration you wish to affect.- Returns:
- the file that holds Resource configuration.
-
createConfigurationBuilder
protected abstract ConfigurationBuilder createConfigurationBuilder(LocalContainer container)
- Parameters:
container
- Container the dataSource will be configured on.- Returns:
- the object that produces xml entries for DataSource definitions.
-
configure
public void configure(LocalContainer container)
Configure the specified container.- Specified by:
configure
in interfaceLocalConfiguration
- Overrides:
configure
in classAbstractLocalConfiguration
- Parameters:
container
- the container to configure
-
configureDataSources
public void configureDataSources(LocalContainer container)
Configure the DataSources defined for this configuration.- Specified by:
configureDataSources
in interfaceDataSourceSupport
- Parameters:
container
- the container whose configuration you wish to affect.
-
configure
public void configure(Resource ds, LocalContainer container)
- Specified by:
configure
in interfaceResourceSupport
- Parameters:
ds
- the Resource configuration you wish to install on the container.container
- the container whose configuration you wish to affect.
-
configureResources
public void configureResources(LocalContainer container)
Configure the Resources defined for this configuration.- Specified by:
configureResources
in interfaceResourceSupport
- Parameters:
container
- the container whose configuration you wish to affect.
-
configure
public void configure(DataSource ds, LocalContainer container)
- Specified by:
configure
in interfaceDataSourceSupport
- Parameters:
ds
- the DataSource configuration you wish to install on the container.container
- the container whose configuration you wish to affect.
-
writeConfigurationToXpath
protected void writeConfigurationToXpath(String file, String xml, String path)
Utility method used to write XML to an appropriate place in the configuration file.- Parameters:
file
- where to write the datasource configuration to.xml
- node you wish to write to the resources configuration file.path
- where in the file to write the configuration.
-
-