org.javasimon.jdbcx
Class AbstractSimonDataSource

java.lang.Object
  extended by org.javasimon.jdbcx.AbstractSimonDataSource
Direct Known Subclasses:
SimonConnectionPoolDataSource, SimonDataSource, SimonXADataSource, WrappingSimonDataSource

public abstract class AbstractSimonDataSource
extends Object

SimonCommonDataSource is parent for all three datasource implementation classes.

It contains getters and setters for basic properties which all three datasource types needs to impelement.

Since:
1.0
Version:
$Revision: 304 $ $Date: 2011-04-08 10:39:02 +0200 (Fri, 08 Apr 2011) $
Author:
Radovan Sninsky

Field Summary
protected  int loginTimeout
           
protected  PrintWriter logWriter
           
protected  String password
           
protected  String prefix
           
protected  String realDataSourceClassName
           
protected  String url
           
protected  String user
           
 
Constructor Summary
AbstractSimonDataSource()
           
 
Method Summary
 int getLoginTimeout()
          Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.
 PrintWriter getLogWriter()
          Retrieves the log writer for this DataSource object.
 String getPassword()
          Returns database password to autenticate connection.
 String getPrefix()
          Returns Simon prefix for constructing names of Simons.
 String getRealDataSourceClassName()
          Returns real datasource class name.
 String getUrl()
          Returns JDBC connection URL.
 String getUser()
          Returns database user to autenticate connection.
 void setLoginTimeout(int seconds)
          Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
 void setLogWriter(PrintWriter out)
          Sets the log writer for this DataSource object to the given java.io.PrintWriter object.
 void setPassword(String password)
          Setter for password property.
 void setPrefix(String prefix)
          Setter for prefix property.
 void setRealDataSourceClassName(String className)
          Setter for realDataSourceClassName property.
 void setUrl(String url)
          Setter for URL property.
 void setUser(String user)
          Setter for user property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logWriter

protected transient PrintWriter logWriter

url

protected String url

user

protected String user

password

protected String password

loginTimeout

protected int loginTimeout

realDataSourceClassName

protected String realDataSourceClassName

prefix

protected String prefix
Constructor Detail

AbstractSimonDataSource

public AbstractSimonDataSource()
Method Detail

getLogWriter

public final PrintWriter getLogWriter()
                               throws SQLException

Retrieves the log writer for this DataSource object.

Returns:
the log writer for this data source or null if logging is disabled
Throws:
SQLException - if a database access error occurs
See Also:
CommonDataSource.getLogWriter(), setLogWriter(java.io.PrintWriter)

setLogWriter

public final void setLogWriter(PrintWriter out)
                        throws SQLException

Sets the log writer for this DataSource object to the given java.io.PrintWriter object.

Parameters:
out - the new log writer; to disable logging, set to null
Throws:
SQLException - if a database access error occurs
See Also:
CommonDataSource.setLogWriter(java.io.PrintWriter), getLogWriter()

getUrl

public final String getUrl()
Returns JDBC connection URL.

Returns:
JDBC connection URL

setUrl

public final void setUrl(String url)
Setter for URL property.

Parameters:
url - JDBC connection URL

getUser

public final String getUser()
Returns database user to autenticate connection.

Returns:
database user

setUser

public final void setUser(String user)
Setter for user property.

Parameters:
user - database user

getPassword

public final String getPassword()
Returns database password to autenticate connection.

Returns:
database password

setPassword

public final void setPassword(String password)
Setter for password property.

Parameters:
password - database password

setLoginTimeout

public final void setLoginTimeout(int seconds)
                           throws SQLException

Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise, it specifies that there is no timeout. When a DataSource object is created, the login timeout is initially zero.

Parameters:
seconds - the data source login time limit
Throws:
SQLException - if a database access error occurs.
See Also:
getLoginTimeout()

getLoginTimeout

public final int getLoginTimeout()
                          throws SQLException
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. A value of zero means that the timeout is the default system timeout if there is one; otherwise, it means that there is no timeout. When a DataSource object is created, the login timeout is initially zero.

Returns:
the data source login time limit
Throws:
SQLException - if a database access error occurs.
See Also:
setLoginTimeout(int)

getRealDataSourceClassName

public final String getRealDataSourceClassName()
Returns real datasource class name.

Returns:
real datasource class name

setRealDataSourceClassName

public final void setRealDataSourceClassName(String className)
Setter for realDataSourceClassName property.

Parameters:
className - class name of real datasource

getPrefix

public final String getPrefix()
Returns Simon prefix for constructing names of Simons.

Returns:
Simon prefix

setPrefix

public final void setPrefix(String prefix)
Setter for prefix property.

Parameters:
prefix - Simon prefix


Copyright © 2011. All Rights Reserved.