org.codehaus.cargo.container.property
Class DataSource

java.lang.Object
  extended by org.codehaus.cargo.container.property.DataSource

public class DataSource
extends java.lang.Object

A Datasource is a representation of a JDBC datasource. If supported by the container, this property is used to setup a datasource.

Version:
$Id: DataSource.java 1057 2006-06-17 13:06:20Z vmassol $

Constructor Summary
DataSource(java.util.Properties properties)
          Contruct a DataSource from a list of properties.
DataSource(java.lang.String datasourceInformation)
          Contruct a DataSource from a single String.
DataSource(java.lang.String jndiLocation, java.lang.String dataSourceType, java.lang.String driverClass, java.lang.String url, java.lang.String username, java.lang.String password)
          Contruct a DataSource object.
 
Method Summary
 java.lang.String getDataSourceType()
          The type of the data source (typically javax.sql.XADataSource or javax.sql.DataSource).
 java.lang.String getDriverClass()
          The class name of the JDBC driver.
 java.lang.String getJndiLocation()
          The JNDI location that this datasource should be bound do (in the config file).
 java.lang.String getPassword()
          The password to use when connecting to the database.
 java.lang.String getStringRepresentation()
          Get a string representation of this datasource.
 java.lang.String getUrl()
          The url to connect to the database.
 java.lang.String getUsername()
          The username to use when connecting to the database.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSource

public DataSource(java.lang.String jndiLocation,
                  java.lang.String dataSourceType,
                  java.lang.String driverClass,
                  java.lang.String url,
                  java.lang.String username,
                  java.lang.String password)
Contruct a DataSource object.

Parameters:
jndiLocation - (typically java:comp/env)
dataSourceType - (typically javax.sql.XADataSource or javax.sql.DataSource)
driverClass - The class name of the JDBC driver. Example: org.hsqldb.jdbcDriver
url - The url to connect to the database. Example: jdbc:hsqldb:database/jiradb
username - The username to use when connecting to the database.
password - The password to use when connecting to the database.

DataSource

public DataSource(java.lang.String datasourceInformation)
Contruct a DataSource from a single String.

Parameters:
datasourceInformation - A string, really a list of properties, representing a datasource
See Also:
PropertyUtils.getDataSourceProperties(String)

DataSource

public DataSource(java.util.Properties properties)
Contruct a DataSource from a list of properties.

Parameters:
properties - A list of properties representing this datasource
See Also:
PropertyUtils.getDataSourceProperties(String)
Method Detail

getStringRepresentation

public java.lang.String getStringRepresentation()
Get a string representation of this datasource.

Returns:
a string representation
See Also:
PropertyUtils.getDataSourceString(java.util.Properties)

getJndiLocation

public java.lang.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 (typically java:comp/env) to this context.

Returns:
the JDNI location

getDataSourceType

public java.lang.String getDataSourceType()
The type of the data source (typically javax.sql.XADataSource or javax.sql.DataSource).

Returns:
the datasource type.

getDriverClass

public java.lang.String getDriverClass()
The class name of the JDBC driver. Example: org.hsqldb.jdbcDriver.

Returns:
the class name of the JDBC driver

getUrl

public java.lang.String getUrl()
The url to connect to the database. Example: jdbc:hsqldb:database/jiradb.

Returns:
the url to connect to the database

getUsername

public java.lang.String getUsername()
The username to use when connecting to the database.

Returns:
the username (eg 'sa')

getPassword

public java.lang.String getPassword()
The password to use when connecting to the database.

Returns:
the password to use to connect to the database

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2004-2010 Codehaus. All Rights Reserved.