Class DataSource
- java.lang.Object
-
- org.codehaus.cargo.container.configuration.entry.DataSource
-
public class DataSource extends Object
A Datasource is a representation of a JDBC datasource. If supported by the container, this property is used to setup a datasource.
-
-
Constructor Summary
Constructors Constructor Description DataSource()
initializes connectionProperties to a new object.DataSource(String jndiLocation, String connectionType, TransactionSupport transactionSupport, String driverClass, String url, String username, String password, String id, Properties connectionProperties)
Constructor containing default DataSource construction rules.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Properties
getConnectionProperties()
Extra properties passed to the JDBC Driver.String
getConnectionType()
The type of the data source (typicallyjavax.sql.XADataSource
orjavax.sql.DataSource
).String
getDriverClass()
The class name of the Driver or XADataSource.String
getId()
The String used to identify this datasource in configuration files.String
getJndiLocation()
The JNDI location that this datasource should be bound do (in the config file).String
getPassword()
The password to use when connecting to the database.TransactionSupport
getTransactionSupport()
The transaction support of the underlying connections, ifjavax.xml.DataSource
.String
getUrl()
The url to connect to the database.String
getUsername()
The username to use when connecting to the database.void
setConnectionProperties(Properties connectionProperties)
void
setConnectionType(String connectionType)
void
setDriverClass(String driverClass)
void
setId(String id)
void
setJndiLocation(String jndiLocation)
void
setPassword(String password)
void
setTransactionSupport(TransactionSupport transactionSupport)
void
setUrl(String url)
void
setUsername(String username)
-
-
-
Constructor Detail
-
DataSource
public DataSource()
initializes connectionProperties to a new object.
-
DataSource
public DataSource(String jndiLocation, String connectionType, TransactionSupport transactionSupport, String driverClass, String url, String username, String password, String id, Properties connectionProperties)
Constructor containing default DataSource construction rules.- Parameters:
jndiLocation
- Where to bind this DataSource (typicallyjava:comp/env
).connectionType
- What to use to get a connection from the database.javax.sql.XADataSource
orjavax.sql.Driver
.transactionSupport
- Transaction support of the datasource ex.XA_TRANSACTION
driverClass
- The class name of the Driver or XADataSource. Example:org.hsqldb.jdbcDriver
.url
- The url of the driver.username
- The user to connect to the database with.password
- The password tousername
.id
- Id used in configuration files.connectionProperties
- Extra properties passed to the jdbc driver.
-
-
Method Detail
-
setJndiLocation
public void setJndiLocation(String jndiLocation)
- Parameters:
jndiLocation
- where to bind this DataSource (typicallyjava:comp/env
).
-
setConnectionType
public void setConnectionType(String connectionType)
- Parameters:
connectionType
- what to use to get a connection from the database.javax.sql.XADataSource
orjavax.sql.Driver
.
-
setTransactionSupport
public void setTransactionSupport(TransactionSupport transactionSupport)
- Parameters:
transactionSupport
- transaction support of the datasource ex.XA_TRANSACTION
-
setDriverClass
public void setDriverClass(String driverClass)
- Parameters:
driverClass
- The class name of the Driver or XADataSource. Example:org.hsqldb.jdbcDriver
.
-
setUrl
public void setUrl(String url)
- Parameters:
url
- The url of the driver.
-
setUsername
public void setUsername(String username)
- Parameters:
username
- the user to connect to the database with
-
setPassword
public void setPassword(String password)
- Parameters:
password
- the password tousername
-
setId
public void setId(String id)
- Parameters:
id
- id used in configuration files.
-
setConnectionProperties
public void setConnectionProperties(Properties connectionProperties)
- Parameters:
connectionProperties
- extra properties passed to the jdbc driver.
-
getId
public String getId()
The String used to identify this datasource in configuration files.- Returns:
- the datasource id
-
getJndiLocation
public String getJndiLocation()
The JNDI location that this datasource should be bound do (in the config file). Note that many application servers may prepend a context (typicallyjava:comp/env
) to this context.- Returns:
- the JNDI location
-
getConnectionType
public String getConnectionType()
The type of the data source (typicallyjavax.sql.XADataSource
orjavax.sql.DataSource
).- Returns:
- the datasource type.
-
getTransactionSupport
public TransactionSupport getTransactionSupport()
The transaction support of the underlying connections, ifjavax.xml.DataSource
.- Returns:
- transactional support of the DataSource
-
getDriverClass
public String getDriverClass()
The class name of the Driver or XADataSource. Example:org.hsqldb.jdbcDriver
.- Returns:
- the class name of the JDBC driver
-
getConnectionProperties
public Properties getConnectionProperties()
Extra properties passed to the JDBC Driver.- Returns:
- Extra properties passed to the JDBC Driver.
-
getUrl
public String getUrl()
The url to connect to the database. Example:jdbc:hsqldb:database/jiradb
.- Returns:
- the url to connect to the database
-
getUsername
public String getUsername()
The username to use when connecting to the database.- Returns:
- the username (eg 'sa')
-
getPassword
public String getPassword()
The password to use when connecting to the database.- Returns:
- the password to use to connect to the database
-
-