org.experlog.openeas.api
Class Session

java.lang.Object
  extended by org.experlog.openeas.api.Session

public class Session
extends java.lang.Object

A web client session


Constructor Summary
protected Session(org.experlog.util.Client s)
           
 
Method Summary
 void closeConnection(java.sql.Connection c, java.lang.String dsn)
          Send a database connection back to the pool (logical "close")
 void debug(java.lang.String msg)
           
static Session findClient(java.lang.String id)
          Find an existing session given a session id.
 AppConfiguration getAppConfiguration()
          Get the application configuration
static Session getClient(java.lang.String id, javax.servlet.http.HttpServletRequest req)
          Find or create a session given a session id.
 java.lang.String getClientId()
          Get the session Id (to recognize who is connected)
 java.sql.Connection getConnection(java.lang.String datasourcename)
          Obtain a database connection from the pool
 Cookie getCookie()
          Get the client info
protected  org.experlog.base.OpenClient getSession()
           
 void logRequest(java.lang.String dsn, java.lang.String request)
           
 DbObject newDbObject(java.lang.String table, java.sql.ResultSet rs)
           
 void resetTimer()
           
 java.lang.String sqlEncode(java.lang.String s)
           
 java.lang.String sqlEncode(java.lang.String datasourcename, java.lang.String s)
           
 void trace(java.lang.String msg)
           
 void updateDB(java.lang.String sql)
          Issue a database update on the default datasource
 void updateDB(java.lang.String datasourcename, java.lang.String sql)
          Issue a database update on a specified datasource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Session

protected Session(org.experlog.util.Client s)
Method Detail

getSession

protected org.experlog.base.OpenClient getSession()

newDbObject

public DbObject newDbObject(java.lang.String table,
                            java.sql.ResultSet rs)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

getAppConfiguration

public AppConfiguration getAppConfiguration()
Get the application configuration


getCookie

public Cookie getCookie()
Get the client info

Returns:
The current client info.

getClientId

public java.lang.String getClientId()
Get the session Id (to recognize who is connected)

Returns:
The session id (a String that identifies the client).

findClient

public static Session findClient(java.lang.String id)
Find an existing session given a session id.

Returns:
The requested session, or null if it does not exist.

getClient

public static Session getClient(java.lang.String id,
                                javax.servlet.http.HttpServletRequest req)
                         throws java.lang.Exception
Find or create a session given a session id. If the session already exists, it is returned, otherwise created.

Returns:
The requested session
Throws:
java.lang.Exception

getConnection

public java.sql.Connection getConnection(java.lang.String datasourcename)
                                  throws java.lang.Exception
Obtain a database connection from the pool

Parameters:
datasourcename -
Returns:
a database connection
Throws:
java.lang.Exception

closeConnection

public void closeConnection(java.sql.Connection c,
                            java.lang.String dsn)
                     throws java.sql.SQLException
Send a database connection back to the pool (logical "close")

Parameters:
c - the database connection to "close"
dsn - the datasource name
Throws:
java.sql.SQLException

logRequest

public void logRequest(java.lang.String dsn,
                       java.lang.String request)

updateDB

public void updateDB(java.lang.String sql)
              throws java.sql.SQLException,
                     java.lang.Exception
Issue a database update on the default datasource

Parameters:
sql - the SQL (update or insert) request
Throws:
java.sql.SQLException
java.lang.Exception

updateDB

public void updateDB(java.lang.String datasourcename,
                     java.lang.String sql)
              throws java.sql.SQLException,
                     java.lang.Exception
Issue a database update on a specified datasource

Parameters:
datasourcename - the data source name
sql - the SQL (update or insert) request
Throws:
java.sql.SQLException
java.lang.Exception

debug

public void debug(java.lang.String msg)

trace

public void trace(java.lang.String msg)

sqlEncode

public java.lang.String sqlEncode(java.lang.String s)

sqlEncode

public java.lang.String sqlEncode(java.lang.String datasourcename,
                                  java.lang.String s)

resetTimer

public void resetTimer()