com.infoengine.jdbc
Class JDBCAdapterImpl

java.lang.Object
  extended bycom.infoengine.jdbc.JDBCAdapterImpl
All Implemented Interfaces:
IeMultithreadedProcessor, IeProcessor

public class JDBCAdapterImpl
extends Object
implements IeMultithreadedProcessor


Field Summary
private static Hashtable busyContexts
           
private static Hashtable connCaches
           
static String CONNECTION_OBJECT
           
private static Hashtable connInfo
           
static String DB_PASSWD_KEY
           
static String DB_URL_KEY
           
static String DB_USER_KEY
           
private  short dbType
           
private  String drivers
           
(package private)  long endTime
           
private static Hashtable freeContexts
           
private static Hashtable freeContextsLastUse
           
static short IDLE
           
static short IDLE_REMOVE
           
static String IN_USE_KEY
           
private  com.infoengine.log.LogWriter logWriter
           
private  int maxContextAge
           
private  int maxContextCacheSize
           
static short NOT_IDLE
           
private static String rb
           
static String SAVE_POINT_KEY
           
private  String serviceName
           
static String SESSION_ID_GROUP_KEY
           
static String SESSION_ID_KEY
           
(package private)  long startTime
           
static String TIME_LAST_USED_KEY
           
static String TRANSACTION_COMMIT
           
static String TRANSACTION_END
           
static String TRANSACTION_OTHER
           
static String TRANSACTION_ROLLBACK
           
static String TRANSACTION_SAVEPOINT
           
static String TRANSACTION_START
           
static String TRANSACTION_TYPE_KEY
           
private static JDBCTransactionCleanup transCleanup
           
private  String url
           
private  String webjectClassName
           
 
Constructor Summary
JDBCAdapterImpl()
           
 
Method Summary
static void addKeyToConnInfo(String session_id, String db_url, String db_user, String db_passwd, boolean in_use, Object conn, Object session_id_group)
           
static void addSavepointToConnInfo(Object key, Object svpnt, short db_type)
           
static String appendStrings(String str1, String str2, StringBuffer scratch)
           
static String appendStrings(String str1, String str2, String str3, StringBuffer scratch)
           
static boolean checkSavepointName(Object svpnt, String name, short db_type)
           
static boolean cleanupConnInfo(long inactivity_timeout_millis)
           
static void cleanupSavepoints(Object key, Object svpnt)
           
private  void closeContext(JdbcContext context, boolean error)
           
private  void closeCtxForOracleOrTransaction(JdbcContext context, boolean error)
           
 Connection getConnectionFromConnInfo(String session_id)
           
 Connection getConnForOracleOrTransaction(String url, String user, String passwd, String session_id, String trans_type)
           
static short getConnInfoKeyStatus(Object key, long inactivity_timeout_millis)
           
private  JdbcContext getCtxForOracleOrTransaction(Properties env)
           
private  JdbcContext getFreeContext(Properties env)
           
private  JdbcContext getJdbcContext(Properties env)
           
 Connection getNewConnection(String url, String user, String passwd)
           
static oracle.jdbc.pool.OracleConnectionCache getOracleConnectionCache(String url, String user)
           
static Object getSavepointFromConnInfo(Object key, String name, short db_type, com.infoengine.log.LogWriter logWriter)
           
static Object getSessionIdGroupForKey(Object key)
           
static String getTransactionType(String action)
           
 void initialize(String serviceName, com.infoengine.log.LogWriter log)
          Initialize the adapter implementation class.
 boolean isDatabaseTypeOracle()
           
static boolean isSessionIdInConnInfo(String session_id)
           
 boolean isTransaction(Hashtable env)
           
 void printConnInfo(String message)
           
 IeRequest processRequest(Request request)
          Process a request received from the Info*Engine server.
 void putBackKeyInConnInfo(Object key)
           
static void remConnOrKeyFromConnInfo(String session_id, boolean retainInfo)
           
static void removeSavepointWithName(Hashtable svpnt_info, Object svpnt, short db_type)
           
static void removeSessionIdElemFromGroup(Object session_id_group)
           
static void setOracleConnectionCache(String url, String user, oracle.jdbc.pool.OracleConnectionCache conn_cache)
           
 void setTransactionInfo(Properties env, Webject webject)
           
static void setTransCleanup(JDBCTransactionCleanup trans_cleanup)
           
private  String toClassName(String oldstring)
          Converts the request to the classname syntax.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serviceName

private String serviceName

logWriter

private com.infoengine.log.LogWriter logWriter

startTime

long startTime

endTime

long endTime

maxContextAge

private int maxContextAge

maxContextCacheSize

private int maxContextCacheSize

url

private String url

drivers

private String drivers

dbType

private short dbType

webjectClassName

private String webjectClassName

busyContexts

private static Hashtable busyContexts

freeContexts

private static Hashtable freeContexts

freeContextsLastUse

private static Hashtable freeContextsLastUse

connCaches

private static Hashtable connCaches

connInfo

private static Hashtable connInfo

transCleanup

private static JDBCTransactionCleanup transCleanup

rb

private static String rb

TRANSACTION_OTHER

public static final String TRANSACTION_OTHER
See Also:
Constant Field Values

TRANSACTION_START

public static final String TRANSACTION_START
See Also:
Constant Field Values

TRANSACTION_END

public static final String TRANSACTION_END
See Also:
Constant Field Values

TRANSACTION_COMMIT

public static final String TRANSACTION_COMMIT
See Also:
Constant Field Values

TRANSACTION_ROLLBACK

public static final String TRANSACTION_ROLLBACK
See Also:
Constant Field Values

TRANSACTION_SAVEPOINT

public static final String TRANSACTION_SAVEPOINT
See Also:
Constant Field Values

TRANSACTION_TYPE_KEY

public static final String TRANSACTION_TYPE_KEY
See Also:
Constant Field Values

DB_URL_KEY

public static final String DB_URL_KEY
See Also:
Constant Field Values

DB_USER_KEY

public static final String DB_USER_KEY
See Also:
Constant Field Values

DB_PASSWD_KEY

public static final String DB_PASSWD_KEY
See Also:
Constant Field Values

CONNECTION_OBJECT

public static final String CONNECTION_OBJECT
See Also:
Constant Field Values

IN_USE_KEY

public static final String IN_USE_KEY
See Also:
Constant Field Values

SESSION_ID_KEY

public static final String SESSION_ID_KEY
See Also:
Constant Field Values

SESSION_ID_GROUP_KEY

public static final String SESSION_ID_GROUP_KEY
See Also:
Constant Field Values

TIME_LAST_USED_KEY

public static final String TIME_LAST_USED_KEY
See Also:
Constant Field Values

SAVE_POINT_KEY

public static final String SAVE_POINT_KEY
See Also:
Constant Field Values

NOT_IDLE

public static final short NOT_IDLE
See Also:
Constant Field Values

IDLE

public static final short IDLE
See Also:
Constant Field Values

IDLE_REMOVE

public static final short IDLE_REMOVE
See Also:
Constant Field Values
Constructor Detail

JDBCAdapterImpl

public JDBCAdapterImpl()
Method Detail

initialize

public void initialize(String serviceName,
                       com.infoengine.log.LogWriter log)
Description copied from interface: IeProcessor
Initialize the adapter implementation class.

Specified by:
initialize in interface IeProcessor
Parameters:
serviceName - Logical name defined for this implementation
log - file to write informational and debug messages.

processRequest

public IeRequest processRequest(Request request)
                         throws IEException
Description copied from interface: IeProcessor
Process a request received from the Info*Engine server. This method is called when a adapter request if received on the Info*Engine socket.

Specified by:
processRequest in interface IeProcessor
Parameters:
request - The request to perform
Throws:
IEException

printConnInfo

public void printConnInfo(String message)

setTransactionInfo

public void setTransactionInfo(Properties env,
                               Webject webject)
                        throws IEAdapterException
Throws:
IEAdapterException

getTransactionType

public static String getTransactionType(String action)
                                 throws IEAdapterException
Throws:
IEAdapterException

isSessionIdInConnInfo

public static boolean isSessionIdInConnInfo(String session_id)

addSavepointToConnInfo

public static void addSavepointToConnInfo(Object key,
                                          Object svpnt,
                                          short db_type)
                                   throws IEAdapterException
Throws:
IEAdapterException

removeSavepointWithName

public static void removeSavepointWithName(Hashtable svpnt_info,
                                           Object svpnt,
                                           short db_type)
                                    throws SQLException
Throws:
SQLException

getSavepointFromConnInfo

public static Object getSavepointFromConnInfo(Object key,
                                              String name,
                                              short db_type,
                                              com.infoengine.log.LogWriter logWriter)

checkSavepointName

public static boolean checkSavepointName(Object svpnt,
                                         String name,
                                         short db_type)
                                  throws SQLException
Throws:
SQLException

cleanupSavepoints

public static void cleanupSavepoints(Object key,
                                     Object svpnt)

addKeyToConnInfo

public static void addKeyToConnInfo(String session_id,
                                    String db_url,
                                    String db_user,
                                    String db_passwd,
                                    boolean in_use,
                                    Object conn,
                                    Object session_id_group)
                             throws IEAdapterException
Throws:
IEAdapterException

remConnOrKeyFromConnInfo

public static void remConnOrKeyFromConnInfo(String session_id,
                                            boolean retainInfo)
                                     throws IEAdapterException
Throws:
IEAdapterException

removeSessionIdElemFromGroup

public static void removeSessionIdElemFromGroup(Object session_id_group)

getSessionIdGroupForKey

public static Object getSessionIdGroupForKey(Object key)

getConnectionFromConnInfo

public Connection getConnectionFromConnInfo(String session_id)
                                     throws SQLException,
                                            IEAdapterException
Throws:
SQLException
IEAdapterException

putBackKeyInConnInfo

public void putBackKeyInConnInfo(Object key)

getNewConnection

public Connection getNewConnection(String url,
                                   String user,
                                   String passwd)
                            throws SQLException,
                                   IEAdapterException
Throws:
SQLException
IEAdapterException

getConnForOracleOrTransaction

public Connection getConnForOracleOrTransaction(String url,
                                                String user,
                                                String passwd,
                                                String session_id,
                                                String trans_type)
                                         throws SQLException,
                                                IEAdapterException
Throws:
SQLException
IEAdapterException

getCtxForOracleOrTransaction

private JdbcContext getCtxForOracleOrTransaction(Properties env)
                                          throws SQLException,
                                                 IEAdapterException
Throws:
SQLException
IEAdapterException

closeCtxForOracleOrTransaction

private void closeCtxForOracleOrTransaction(JdbcContext context,
                                            boolean error)
                                     throws IEAdapterException
Throws:
IEAdapterException

setOracleConnectionCache

public static void setOracleConnectionCache(String url,
                                            String user,
                                            oracle.jdbc.pool.OracleConnectionCache conn_cache)

getOracleConnectionCache

public static oracle.jdbc.pool.OracleConnectionCache getOracleConnectionCache(String url,
                                                                              String user)

cleanupConnInfo

public static boolean cleanupConnInfo(long inactivity_timeout_millis)
                               throws SQLException
Throws:
SQLException

getConnInfoKeyStatus

public static short getConnInfoKeyStatus(Object key,
                                         long inactivity_timeout_millis)

setTransCleanup

public static void setTransCleanup(JDBCTransactionCleanup trans_cleanup)

isDatabaseTypeOracle

public boolean isDatabaseTypeOracle()

isTransaction

public boolean isTransaction(Hashtable env)

appendStrings

public static String appendStrings(String str1,
                                   String str2,
                                   StringBuffer scratch)

appendStrings

public static String appendStrings(String str1,
                                   String str2,
                                   String str3,
                                   StringBuffer scratch)

getJdbcContext

private JdbcContext getJdbcContext(Properties env)
                            throws SQLException,
                                   IEAdapterException
Throws:
SQLException
IEAdapterException

getFreeContext

private JdbcContext getFreeContext(Properties env)

closeContext

private void closeContext(JdbcContext context,
                          boolean error)
                   throws IEAdapterException
Throws:
IEAdapterException

toClassName

private String toClassName(String oldstring)
Converts the request to the classname syntax.

Parameters:
oldstring - The request in original form
Returns:
The request in the converted form