org.codehaus.cargo.container.tomcat.internal
Class AbstractTomcatConfigurationBuilder

java.lang.Object
  extended by org.codehaus.cargo.container.spi.configuration.builder.AbstractConfigurationBuilder
      extended by org.codehaus.cargo.container.tomcat.internal.AbstractTomcatConfigurationBuilder
All Implemented Interfaces:
ConfigurationBuilder
Direct Known Subclasses:
Tomcat4xConfigurationBuilder, Tomcat5And6xConfigurationBuilder

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 appropriate ConfigurationBuilder to create the configuration.

Version:
$Id: $

Field Summary
protected  Map typeToFactory
          contains a mapping of resource types to the factory they use.
 
Constructor Summary
AbstractTomcatConfigurationBuilder()
          generates typeToFactory
 
Method Summary
 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
 

Field Detail

typeToFactory

protected Map typeToFactory
contains a mapping of resource types to the factory they use. There should always be a key "default" which can be used for unknown objects.

Constructor Detail

AbstractTomcatConfigurationBuilder

public AbstractTomcatConfigurationBuilder()
generates typeToFactory

Method Detail

buildEntryForDriverConfiguredDataSourceWithNoTx

public String buildEntryForDriverConfiguredDataSourceWithNoTx(DataSource ds)
this implementation first converts the DataSource to a Resource before returning XML.

Specified by:
buildEntryForDriverConfiguredDataSourceWithNoTx in class AbstractConfigurationBuilder
Parameters:
ds - the DataSource with the following state:
Returns:
configuration binding a container provided implementation of type javax.sql.DataSource to the JNDI path specified at DataSource.getJndiLocation().
See Also:
convertDataSourceToResourceAndGetXMLEntry(DataSource)

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 class AbstractConfigurationBuilder
Parameters:
ds - the DataSource with the following state:
Returns:
configuration binding a container provided implementation of type javax.sql.DataSource to the JNDI path specified at DataSource.getJndiLocation(). This container will provide XA support through the third party implementation specified at DataSource.getDriverClass().

buildEntryForDriverConfiguredDataSourceWithLocalTx

public String buildEntryForDriverConfiguredDataSourceWithLocalTx(DataSource ds)
This throws an UnsupportedOperationException as Tomcat is not transactional.

Specified by:
buildEntryForDriverConfiguredDataSourceWithLocalTx in class AbstractConfigurationBuilder
Parameters:
ds - the DataSource with the following state:
Returns:
configuration binding a container provided implementation of type javax.sql.DataSource to the JNDI path specified at DataSource.getJndiLocation().

buildEntryForDriverConfiguredDataSourceWithXaTx

public String buildEntryForDriverConfiguredDataSourceWithXaTx(DataSource ds)
This throws an UnsupportedOperationException as Tomcat is not transactional.

Specified by:
buildEntryForDriverConfiguredDataSourceWithXaTx in class AbstractConfigurationBuilder
Parameters:
ds - the DataSource with the following state:
Returns:
configuration binding a container provided implementation of type javax.sql.DataSource to the JNDI path specified at DataSource.getJndiLocation().


Copyright © 2004-2012 Codehaus. All Rights Reserved.