org.dbforms.config
Class DbConnection

java.lang.Object
  extended by org.dbforms.config.DbConnection
All Implemented Interfaces:
DataSource

public class DbConnection
extends Object
implements DataSource

This class represents datastructures like to following examples:


  <dbconnection
           name   = "jdbc/dbformstest"
           isJndi = "true"
  />
 

(in the example above dbforms asumes that the jndi-entry "jdbc/dbformstest" is correctly configured in the application-server's database configuration [i.e. date-sources.xml])

or:

  <dbconnection
          name   = "jdbc:poolman://dbformstest"
          isJndi = "false"
          class  = "com.codestudio.sql.PoolMan"
  />
 

(in the example above dbforms asumes that the connectionpool-entry "dbformstest" is correctly configured in the associated connection pool properties file).

As these examples show, the configuration of datasources is beyond the scope of dbforms. That is a task of the underlying applicationserver/jsp-engine!

Version:
0.8.3 Kevin Dangoor added Username and Passwort properties
Author:
Joe Peer

Constructor Summary
DbConnection()
          Constructor.
 
Method Summary
 void addPoolProperty(String name, String prop)
          Adds a new pool property - used while parsing XML file
 void addProperty(String name, String prop)
          Adds a new property - used while parsing XML file
 String getConClass()
          Gets the conClass attribute of the DbConnection object
 Connection getConnection()
          Gets a JDBC connection object.
 Connection getConnection(String p_username, String p_password)
          returns a Connection
 String getConnectionPoolURL()
          Gets the connectionPoolURL attribute of the DbConnection object
 String getConnectionProviderClass()
          Gets the connectionProviderClass attribute of the DbConnection object
 String getContextDataSource()
          returns the name of the parameter from context-Scope which contains a DataSource-Object
 String getId()
          Gets the id attribute of the DbConnection object
 String getisJndi()
          Description of the Method
 int getLoginTimeout()
          Always throws a SQLException.
 PrintWriter getLogWriter()
          Always throws a SQLException.
 String getName()
          Gets the name attribute of the DbConnection object
 String getPassword()
          Gets the password attribute of the DbConnection object
 String getUsername()
          Gets the username attribute of the DbConnection object
 boolean isDefaultConnection()
          Gets the defaultConnection attribute of the DbConnection object
 void setConClass(String conClass)
          Sets the conClass attribute of the DbConnection object
 void setConnectionPoolURL(String url)
          Sets the connectionPoolURL attribute of the DbConnection object
 void setConnectionProviderClass(String cpc)
          Sets the connectionProviderClass attribute of the DbConnection object
 void setContextDataSource(String contextDataSource)
          sets the name of the parameter from context-Scope which contains a DataSource-Object
 void setDefaultConnection(boolean defaultConnection)
          Sets the defaultConnection attribute of the DbConnection object
 void setDriverClassName(String driverClassName)
          DataSource interface
 void setId(String id)
          Sets the id attribute of the DbConnection object
 void setIsJndi(String isJndi)
          Sets the isJndi attribute of the DbConnection object
 void setIsPow2(String isPow2)
          Sets the isPow2 attribute of the DbConnection object
 void setJdbcURL(String jdbcURL)
          DOCUMENT ME!
 void setLoginTimeout(int seconds)
          Always throws a SQLException.
 void setLogWriter(PrintWriter out)
          Always throws a SQLException.
 void setName(String name)
          Sets the name attribute of the DbConnection object
 void setPassword(String newpass)
          Sets the password attribute of the DbConnection object
 void setUsername(String newuser)
          Sets the username attribute of the DbConnection object
 String toString()
          Gets the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DbConnection

public DbConnection()
Constructor.

Method Detail

setConClass

public void setConClass(String conClass)
Sets the conClass attribute of the DbConnection object

Parameters:
conClass - The new conClass value

getConClass

public String getConClass()
Gets the conClass attribute of the DbConnection object

Returns:
The conClass value

getConnection

public Connection getConnection()
Gets a JDBC connection object.

Specified by:
getConnection in interface DataSource
Returns:
the connection object, or null if any error occurs

getConnection

public Connection getConnection(String p_username,
                                String p_password)
                         throws SQLException
returns a Connection

Specified by:
getConnection in interface DataSource
Parameters:
username - DOCUMENT ME!
password - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
SQLException

setConnectionPoolURL

public void setConnectionPoolURL(String url)
Sets the connectionPoolURL attribute of the DbConnection object

Parameters:
url - The new connectionPoolURL value

getConnectionPoolURL

public String getConnectionPoolURL()
Gets the connectionPoolURL attribute of the DbConnection object

Returns:
The connectionPoolURL value

setConnectionProviderClass

public void setConnectionProviderClass(String cpc)
Sets the connectionProviderClass attribute of the DbConnection object

Parameters:
cpc - The new connectionProviderClass value

getConnectionProviderClass

public String getConnectionProviderClass()
Gets the connectionProviderClass attribute of the DbConnection object

Returns:
The connectionProviderClass value

setContextDataSource

public void setContextDataSource(String contextDataSource)
sets the name of the parameter from context-Scope which contains a DataSource-Object

Parameters:
contextDataSource -

getContextDataSource

public String getContextDataSource()
returns the name of the parameter from context-Scope which contains a DataSource-Object

Returns:
contextDataSource - the name

setDefaultConnection

public void setDefaultConnection(boolean defaultConnection)
Sets the defaultConnection attribute of the DbConnection object

Parameters:
defaultConnection - The new defaultConnection value

isDefaultConnection

public boolean isDefaultConnection()
Gets the defaultConnection attribute of the DbConnection object

Returns:
The defaultConnection value

setDriverClassName

public void setDriverClassName(String driverClassName)
DataSource interface

Parameters:
driverClassName - DOCUMENT ME!

setId

public void setId(String id)
Sets the id attribute of the DbConnection object

Parameters:
id - The new id value

getId

public String getId()
Gets the id attribute of the DbConnection object

Returns:
The id value

setIsJndi

public void setIsJndi(String isJndi)
Sets the isJndi attribute of the DbConnection object

Parameters:
isJndi - The new isJndi value

setIsPow2

public void setIsPow2(String isPow2)
Sets the isPow2 attribute of the DbConnection object

Parameters:
isPow2 - The new isPow2 value

setJdbcURL

public void setJdbcURL(String jdbcURL)
DOCUMENT ME!

Parameters:
jdbcURL - DOCUMENT ME!

setLogWriter

public void setLogWriter(PrintWriter out)
                  throws SQLException
Always throws a SQLException. Not supported.

Specified by:
setLogWriter in interface DataSource
Parameters:
out - DOCUMENT ME!
Throws:
SQLException

getLogWriter

public PrintWriter getLogWriter()
                         throws SQLException
Always throws a SQLException. Not supported.

Specified by:
getLogWriter in interface DataSource
Returns:
DOCUMENT ME!
Throws:
SQLException

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws SQLException
Always throws a SQLException. Not supported.

Specified by:
setLoginTimeout in interface DataSource
Parameters:
seconds - DOCUMENT ME!
Throws:
SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Always throws a SQLException. Not supported.

Specified by:
getLoginTimeout in interface DataSource
Returns:
DOCUMENT ME!
Throws:
SQLException

setName

public void setName(String name)
Sets the name attribute of the DbConnection object

Parameters:
name - The new name value

getName

public String getName()
Gets the name attribute of the DbConnection object

Returns:
The name value

setPassword

public void setPassword(String newpass)
Sets the password attribute of the DbConnection object

Parameters:
newpass - The new password value

getPassword

public String getPassword()
Gets the password attribute of the DbConnection object

Returns:
The password value

setUsername

public void setUsername(String newuser)
Sets the username attribute of the DbConnection object

Parameters:
newuser - The new username value

getUsername

public String getUsername()
Gets the username attribute of the DbConnection object

Returns:
The username value

addPoolProperty

public void addPoolProperty(String name,
                            String prop)
Adds a new pool property - used while parsing XML file

Parameters:
prop - The feature to be added to the PoolProperty attribute

addProperty

public void addProperty(String name,
                        String prop)
Adds a new property - used while parsing XML file

Parameters:
prop - The feature to be added to the Property attribute

getisJndi

public String getisJndi()
Description of the Method

Returns:
Description of the Return Value

toString

public String toString()
Gets the string representation of this object.

Overrides:
toString in class Object
Returns:
the string representation of this object


Copyright © 2002-2006 DbForms. All Rights Reserved.