thinkmap.server
Class JNDIDatabase

java.lang.Object
  extended by thinkmap.server.JNDIDatabase
All Implemented Interfaces:
Serializable, Wrapper, CommonDataSource, DataSource

public class JNDIDatabase
extends Object
implements DataSource, Serializable

A javax.sql.DataSource that looks up another javax.sql.DataSource using JNDI, and then forwards all calls to that DataSource.

See Also:
Serialized Form

Field Summary
protected  String databaseName
           
protected  DataSource db
           
 
Constructor Summary
JNDIDatabase()
           
 
Method Summary
 Connection getConnection()
           
 Connection getConnection(String user, String pass)
           
 String getDataSourceName()
          Get the JNDI name that is used to look up the data source.
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
 boolean isWrapperFor(Class c)
           
 void setDataSourceName(String s)
          Set the JNDI name that is used to look up the data source.
 void setLoginTimeout(int i)
           
 void setLogWriter(PrintWriter lw)
           
 Object unwrap(Class c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

databaseName

protected String databaseName

db

protected transient DataSource db
Constructor Detail

JNDIDatabase

public JNDIDatabase()
Method Detail

setDataSourceName

public void setDataSourceName(String s)
Set the JNDI name that is used to look up the data source.

Parameters:
s - the JNDI name that is used to look up the data source.

getDataSourceName

public String getDataSourceName()
Get the JNDI name that is used to look up the data source.

Returns:
the JNDI name that is used to look up the data source.

getConnection

public Connection getConnection()
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

getConnection

public Connection getConnection(String user,
                                String pass)
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

setLoginTimeout

public void setLoginTimeout(int i)
                     throws SQLException
Specified by:
setLoginTimeout in interface CommonDataSource
Throws:
SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Specified by:
getLoginTimeout in interface CommonDataSource
Throws:
SQLException

setLogWriter

public void setLogWriter(PrintWriter lw)
                  throws SQLException
Specified by:
setLogWriter in interface CommonDataSource
Throws:
SQLException

getLogWriter

public PrintWriter getLogWriter()
                         throws SQLException
Specified by:
getLogWriter in interface CommonDataSource
Throws:
SQLException

isWrapperFor

public boolean isWrapperFor(Class c)
                     throws SQLException
Specified by:
isWrapperFor in interface Wrapper
Throws:
SQLException

unwrap

public Object unwrap(Class c)
              throws SQLException
Specified by:
unwrap in interface Wrapper
Throws:
SQLException


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.