Ontimize 5.2072EN

com.ontimize.db
Class OntimizeConnection

java.lang.Object
  extended bycom.ontimize.db.OntimizeConnection

public class OntimizeConnection
extends java.lang.Object

Modified 10-07-2002. Add 'reserved' state


Field Summary
protected  java.sql.Connection connection
           
static boolean DEBUG
           
protected  long lastUsedHour
           
protected  boolean lock
           
protected  int reservationId
           
protected  boolean reserved
           
protected  long reserveRequestTime
           
 
Constructor Summary
OntimizeConnection(java.sql.Connection con)
          Creates a new OntimizeConnection instance with the specified database connection
OntimizeConnection(java.lang.String driver, java.lang.String dbURL, java.lang.String user, java.lang.String password)
          Creates a new OntimizeConnection instance using the specified database parameters
 
Method Summary
 void cancelReservation()
           
 void close()
          Close the database connection
 java.sql.Connection getConnection()
          Get the database connection
 java.lang.String getConnectionLockStack()
           
 java.lang.String getCurrentLockKey()
           
 long getLastUseTime()
          Gets the last time when this connection has been used
 long getReservationElapsedTime()
           
 int getReservationId()
           
 boolean isLocked()
          Is true if this connection is locked
 boolean isReserved()
           
 boolean reserve(int reserveId)
          Reserver this OntimizeConnection
 void setLastUseTime(long time)
          Sets the time value for the last connection use parameter
 void setLock(boolean lock)
          Sets the lock parameter value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG

connection

protected java.sql.Connection connection

lock

protected boolean lock

lastUsedHour

protected long lastUsedHour

reserved

protected boolean reserved

reservationId

protected int reservationId

reserveRequestTime

protected long reserveRequestTime
Constructor Detail

OntimizeConnection

public OntimizeConnection(java.lang.String driver,
                          java.lang.String dbURL,
                          java.lang.String user,
                          java.lang.String password)
                   throws java.lang.Exception
Creates a new OntimizeConnection instance using the specified database parameters

Parameters:
driver - Database driver
dbURL - Database url
user - Database user
password - Database password
Throws:
java.lang.Exception

OntimizeConnection

public OntimizeConnection(java.sql.Connection con)
                   throws java.lang.Exception
Creates a new OntimizeConnection instance with the specified database connection

Parameters:
con -
Throws:
java.lang.Exception
Method Detail

getLastUseTime

public long getLastUseTime()
Gets the last time when this connection has been used

Returns:

isLocked

public boolean isLocked()
Is true if this connection is locked

Returns:

setLastUseTime

public void setLastUseTime(long time)
Sets the time value for the last connection use parameter

Parameters:
time - time to set

getConnectionLockStack

public java.lang.String getConnectionLockStack()

setLock

public void setLock(boolean lock)
Sets the lock parameter value

Parameters:
lock -

getCurrentLockKey

public java.lang.String getCurrentLockKey()

reserve

public boolean reserve(int reserveId)
Reserver this OntimizeConnection

Parameters:
reserveId -
Returns:
Return true if this connection has been reserved, false in other case

getReservationElapsedTime

public long getReservationElapsedTime()

isReserved

public boolean isReserved()

cancelReservation

public void cancelReservation()

getReservationId

public int getReservationId()

getConnection

public java.sql.Connection getConnection()
Get the database connection

Returns:

close

public void close()
Close the database connection


Ontimize