Class AbstractTomcatConfigurationBuilder
- java.lang.Object
-
- org.codehaus.cargo.container.spi.configuration.builder.AbstractConfigurationBuilder
-
- org.codehaus.cargo.container.tomcat.internal.AbstractTomcatConfigurationBuilder
-
- All Implemented Interfaces:
ConfigurationBuilder
- Direct Known Subclasses:
Tomcat4xConfigurationBuilder,Tomcat5x6x7xConfigurationBuilder
public abstract class AbstractTomcatConfigurationBuilder extends AbstractConfigurationBuilder
Constructs xml elements needed to configure a DataSource for Tomcat. Note that this implementation converts DataSources into Resources and then uses an appropriateConfigurationBuilderto create the configuration.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>typeToFactorycontains a mapping of resource types to the factory they use.
-
Constructor Summary
Constructors Constructor Description AbstractTomcatConfigurationBuilder()generatestypeToFactory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbuildConfigurationEntryForXADataSourceConfiguredDataSource(DataSource ds)This throws an UnsupportedOperationException as Tomcat is not transactional.StringbuildEntryForDriverConfiguredDataSourceWithLocalTx(DataSource ds)This throws an UnsupportedOperationException as Tomcat is not transactional.StringbuildEntryForDriverConfiguredDataSourceWithNoTx(DataSource ds)this implementation first converts the DataSource to a Resource before returning XML.StringbuildEntryForDriverConfiguredDataSourceWithXaTx(DataSource ds)This throws an UnsupportedOperationException as Tomcat is not transactional.protected StringconvertDataSourceToResourceAndGetXMLEntry(DataSource ds)This method converts the DataSource to a Resource and then builds the xml entry based on that.protected ResourceconvertToResource(DataSource ds)This method converts the DataSource to a Resource used in Tomcat.protected StringgetFactoryClassFor(String type)-
Methods inherited from class org.codehaus.cargo.container.spi.configuration.builder.AbstractConfigurationBuilder
toConfigurationEntry
-
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.builder.ConfigurationBuilder
toConfigurationEntry
-
-
-
-
Constructor Detail
-
AbstractTomcatConfigurationBuilder
public AbstractTomcatConfigurationBuilder()
generatestypeToFactory
-
-
Method Detail
-
buildEntryForDriverConfiguredDataSourceWithNoTx
public String buildEntryForDriverConfiguredDataSourceWithNoTx(DataSource ds)
this implementation first converts the DataSource to a Resource before returning XML.- Specified by:
buildEntryForDriverConfiguredDataSourceWithNoTxin classAbstractConfigurationBuilder- Parameters:
ds- theDataSourcewith the following state:DataSource.getJndiLocation()is set to a unique path for the container.DataSource.getDriverClass()is an implementation ofjava.sql.DriverDataSource.getTransactionSupport()isTransactionSupport.NO_TRANSACTION
- Returns:
- configuration binding a container provided implementation of type
javax.sql.DataSourceto the JNDI path specified atDataSource.getJndiLocation().
-
convertDataSourceToResourceAndGetXMLEntry
protected String convertDataSourceToResourceAndGetXMLEntry(DataSource ds)
This method converts the DataSource to a Resource and then builds the xml entry based on that.- Parameters:
ds- the DataSource we are configuring.- Returns:
- a datasource xml fragment that can be embedded directly into the server.xml file
-
convertToResource
protected Resource convertToResource(DataSource ds)
This method converts the DataSource to a Resource used in Tomcat.- Parameters:
ds- the DataSource we are configuring.- Returns:
- a Resource that can be used in Tomcat.
-
getFactoryClassFor
protected String getFactoryClassFor(String type)
- Parameters:
type- the type of object we are creating- Returns:
- the
factoryresponsible for creating the objects.
-
buildConfigurationEntryForXADataSourceConfiguredDataSource
public String buildConfigurationEntryForXADataSourceConfiguredDataSource(DataSource ds)
This throws an UnsupportedOperationException as Tomcat is not transactional.- Specified by:
buildConfigurationEntryForXADataSourceConfiguredDataSourcein classAbstractConfigurationBuilder- Parameters:
ds- theDataSourcewith the following state:DataSource.getJndiLocation()is set to a unique path for the container.DataSource.getConnectionType()isjavax.sql.XADataSourceDataSource.getDriverClass()is an implementation ofjavax.sql.XADataSource
- Returns:
- configuration binding a container provided implementation of type
javax.sql.DataSourceto the JNDI path specified atDataSource.getJndiLocation(). This container will provide XA support through the third party implementation specified atDataSource.getDriverClass().
-
buildEntryForDriverConfiguredDataSourceWithLocalTx
public String buildEntryForDriverConfiguredDataSourceWithLocalTx(DataSource ds)
This throws an UnsupportedOperationException as Tomcat is not transactional.- Specified by:
buildEntryForDriverConfiguredDataSourceWithLocalTxin classAbstractConfigurationBuilder- Parameters:
ds- theDataSourcewith the following state:DataSource.getJndiLocation()is set to a unique path for the container.DataSource.getDriverClass()is an implementation ofjava.sql.DriverDataSource.getTransactionSupport()isTransactionSupport.LOCAL_TRANSACTION
- Returns:
- configuration binding a container provided implementation of type
javax.sql.DataSourceto the JNDI path specified atDataSource.getJndiLocation().
-
buildEntryForDriverConfiguredDataSourceWithXaTx
public String buildEntryForDriverConfiguredDataSourceWithXaTx(DataSource ds)
This throws an UnsupportedOperationException as Tomcat is not transactional.- Specified by:
buildEntryForDriverConfiguredDataSourceWithXaTxin classAbstractConfigurationBuilder- Parameters:
ds- theDataSourcewith the following state:DataSource.getJndiLocation()is set to a unique path for the container.DataSource.getDriverClass()is an implementation ofjava.sql.DriverDataSource.getTransactionSupport()isTransactionSupport.XA_TRANSACTION
- Returns:
- configuration binding a container provided implementation of type
javax.sql.DataSourceto the JNDI path specified atDataSource.getJndiLocation().
-
-