Expresso 5-5-0

com.jcorporate.expresso.core.db.datasource
Class JndiDataSource

java.lang.Object
  extended bycom.jcorporate.expresso.core.db.datasource.JndiDataSource
All Implemented Interfaces:
DataSourceInterface

public class JndiDataSource
extends Object
implements DataSourceInterface

JndiDataSource are the pure core of the Expresso framework.

Interface for wrapping J2EE datasource connection retrieve

Version:
$Revision: 1.4 $ $Date: 2003/06/03 06:12:13 $
Author:
Yves Henri AMAIZO
See Also:
DBException, DBConnection

Field Summary
protected  String dbURL
          The local Database URL object for setting the connection to database via JNDI.
protected  javax.sql.DataSource ds
          The local DataSource object for setting the connection to database via JNDI.
protected  JNDIConfig myJndi
          The JDBC Configuration retrieve from config-expresso.xml for the context.
 
Constructor Summary
JndiDataSource()
          Constructor Create a new datasource object
JndiDataSource(JNDIConfig newJndi, String newURL)
          Constructor Create a new datasource object
 
Method Summary
 Connection getConnection()
          Get connection from JNDI Factory retrieve from the context previously set up.
 Connection getConnection(String Username, String Password)
          Get connection from JNDI Factory retrieve from the context previously set up.
 String getDbURL()
          Gets the dbURL
 JNDIConfig getMyJndi()
          Gets the myJndi
 void setDbURL(String dbURL)
          Sets the dbURL
 void setMyJndi(JNDIConfig myJndi)
          Sets the myJndi
 void setupContext()
          Configure and set up the JNDI search for database Pool Factory connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ds

protected javax.sql.DataSource ds
The local DataSource object for setting the connection to database via JNDI.


myJndi

protected JNDIConfig myJndi
The JDBC Configuration retrieve from config-expresso.xml for the context.


dbURL

protected String dbURL
The local Database URL object for setting the connection to database via JNDI.

Constructor Detail

JndiDataSource

public JndiDataSource()
Constructor Create a new datasource object


JndiDataSource

public JndiDataSource(JNDIConfig newJndi,
                      String newURL)
Constructor Create a new datasource object

Method Detail

setupContext

public void setupContext()
                  throws DSException
Configure and set up the JNDI search for database Pool Factory connection. Initial JNDI context Factory for searchin in java environment Lookup for database info from this environment.

Throws:
DSException

getConnection

public Connection getConnection()
                         throws DSException
Get connection from JNDI Factory retrieve from the context previously set up.

Specified by:
getConnection in interface DataSourceInterface
Throws:
DSException

getConnection

public Connection getConnection(String Username,
                                String Password)
                         throws DSException
Get connection from JNDI Factory retrieve from the context previously set up.

Throws:
DSException

getMyJndi

public JNDIConfig getMyJndi()
Gets the myJndi

Returns:
Returns a ConfigJndi

setMyJndi

public void setMyJndi(JNDIConfig myJndi)
Sets the myJndi

Parameters:
myJndi - The myJndi to set

getDbURL

public String getDbURL()
Gets the dbURL

Returns:
Returns a String

setDbURL

public void setDbURL(String dbURL)
Sets the dbURL

Parameters:
dbURL - The dbURL to set

Expresso 5-5-0

Please see www.jcorporate.com for information about new Expresso releases.