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 appropriateConfigurationBuilder
to create the configuration.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>
typeToFactory
contains 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 String
buildConfigurationEntryForXADataSourceConfiguredDataSource(DataSource ds)
This throws an UnsupportedOperationException as Tomcat is not transactional.String
buildEntryForDriverConfiguredDataSourceWithLocalTx(DataSource ds)
This throws an UnsupportedOperationException as Tomcat is not transactional.String
buildEntryForDriverConfiguredDataSourceWithNoTx(DataSource ds)
this implementation first converts the DataSource to a Resource before returning XML.String
buildEntryForDriverConfiguredDataSourceWithXaTx(DataSource ds)
This throws an UnsupportedOperationException as Tomcat is not transactional.protected String
convertDataSourceToResourceAndGetXMLEntry(DataSource ds)
This method converts the DataSource to a Resource and then builds the xml entry based on that.protected Resource
convertToResource(DataSource ds)
This method converts the DataSource to a Resource used in Tomcat.protected String
getFactoryClassFor(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:
buildEntryForDriverConfiguredDataSourceWithNoTx
in classAbstractConfigurationBuilder
- Parameters:
ds
- theDataSource
with the following state:DataSource.getJndiLocation()
is set to a unique path for the container.DataSource.getDriverClass()
is an implementation ofjava.sql.Driver
DataSource.getTransactionSupport()
isTransactionSupport.NO_TRANSACTION
- Returns:
- configuration binding a container provided implementation of type
javax.sql.DataSource
to 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
factory
responsible for creating the objects.
-
buildConfigurationEntryForXADataSourceConfiguredDataSource
public String buildConfigurationEntryForXADataSourceConfiguredDataSource(DataSource ds)
This throws an UnsupportedOperationException as Tomcat is not transactional.- Specified by:
buildConfigurationEntryForXADataSourceConfiguredDataSource
in classAbstractConfigurationBuilder
- Parameters:
ds
- theDataSource
with the following state:DataSource.getJndiLocation()
is set to a unique path for the container.DataSource.getConnectionType()
isjavax.sql.XADataSource
DataSource.getDriverClass()
is an implementation ofjavax.sql.XADataSource
- Returns:
- configuration binding a container provided implementation of type
javax.sql.DataSource
to 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:
buildEntryForDriverConfiguredDataSourceWithLocalTx
in classAbstractConfigurationBuilder
- Parameters:
ds
- theDataSource
with the following state:DataSource.getJndiLocation()
is set to a unique path for the container.DataSource.getDriverClass()
is an implementation ofjava.sql.Driver
DataSource.getTransactionSupport()
isTransactionSupport.LOCAL_TRANSACTION
- Returns:
- configuration binding a container provided implementation of type
javax.sql.DataSource
to the JNDI path specified atDataSource.getJndiLocation()
.
-
buildEntryForDriverConfiguredDataSourceWithXaTx
public String buildEntryForDriverConfiguredDataSourceWithXaTx(DataSource ds)
This throws an UnsupportedOperationException as Tomcat is not transactional.- Specified by:
buildEntryForDriverConfiguredDataSourceWithXaTx
in classAbstractConfigurationBuilder
- Parameters:
ds
- theDataSource
with the following state:DataSource.getJndiLocation()
is set to a unique path for the container.DataSource.getDriverClass()
is an implementation ofjava.sql.Driver
DataSource.getTransactionSupport()
isTransactionSupport.XA_TRANSACTION
- Returns:
- configuration binding a container provided implementation of type
javax.sql.DataSource
to the JNDI path specified atDataSource.getJndiLocation()
.
-
-