|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.rad.server.security.AbstractSecurityManager
com.sibvisions.rad.server.security.AbstractDBSecurityManager
public abstract class AbstractDBSecurityManager
The AbstractDBSecurityManager
is the base class for all security managers that use a database for
authentication.
Constructor Summary | |
---|---|
AbstractDBSecurityManager()
|
Method Summary | |
---|---|
protected void |
close(java.sql.Statement... pStatement)
Closes and unregisters the given statements. |
protected void |
closeConnection()
Close all statements and the connection. |
protected void |
closeStatements()
Close all registered statements. |
protected IAccessController |
createAccessController(ISession pSession)
Creates an access controller for a ISession . |
protected void |
finalize()
|
protected abstract java.lang.String |
getAliveQuery()
Gets the query which should be use for connection check. |
java.sql.Connection |
getConnection()
Gets the current connection to the database. |
java.sql.Connection |
getConnection(ISession pSession)
Gets the connection to the database. |
static DBCredentials |
getCredentials(IConfiguration pConfig)
Gets the configured database credentials from a given configuration. |
protected DBCredentials |
getCredentials(ISession pSession)
Gets the configured database credentials for the given session. |
protected abstract void |
initStatements(java.sql.Connection pConnection)
Initializes all statements after opening a database connection. |
protected boolean |
isConnectionAlive()
Checks whether the connection is still alive, means whether the connection can be used. |
protected java.sql.Connection |
openConnection(ISession pSession)
Opens a database connection to the database of an application. |
protected java.sql.CallableStatement |
prepareCall(java.sql.Connection pConnection,
java.lang.String pSql)
Creates a new instance of CallableStatement . |
protected java.sql.PreparedStatement |
prepareStatement(java.sql.Connection pConnection,
java.lang.String pSql)
Creates a new instance of PreparedStatement . |
protected void |
register(java.sql.Statement pStatement)
Registers a statment as closable statement. |
void |
release()
Releases all used resources. |
protected boolean |
unregister(java.sql.Statement pStatement)
Unregisters a statement. |
protected abstract void |
updateConfiguration(IConfiguration pConfig)
Updates relevant information after configuration was changed. |
Methods inherited from class com.sibvisions.rad.server.security.AbstractSecurityManager |
---|
addHiddenPackage, checkPassword, comparePassword, createSecurityManager, createSecurityManager, createSecurityManager, debug, error, getEncryptedPassword, getPasswordValidator, info, isAllowEncryptedUserPassword, isHiddenPackage, isPasswordEncrypted, isPasswordEncryptionEnabled, prepareException, prepareException, removeHiddenPackage, setAllowEncryptedUserPassword, validatePassword |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sibvisions.rad.server.security.ISecurityManager |
---|
changePassword, getAccessController, logout, validateAuthentication |
Constructor Detail |
---|
public AbstractDBSecurityManager()
Method Detail |
---|
protected abstract void updateConfiguration(IConfiguration pConfig) throws java.lang.Exception
pConfig
- the session configuration
java.lang.Exception
- if an exception occurs during statement creationprotected abstract void initStatements(java.sql.Connection pConnection) throws java.lang.Exception
pConnection
- the connection to use
java.lang.Exception
- if an exception occurs during statement creationprotected abstract java.lang.String getAliveQuery()
select 1 from dual
is enough.
public void release()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
protected java.sql.Connection openConnection(ISession pSession) throws java.lang.Exception
pSession
- the session for which the connection should be opened
java.lang.Exception
- if the application zone is invalid or the connection can not be opened
java.lang.IllegalArgumentException
- if the database configuration is invalid (parameters are missing, ...)protected void closeConnection() throws java.lang.Exception
java.lang.Exception
- if one statement can not be closedprotected void closeStatements()
protected void close(java.sql.Statement... pStatement)
pStatement
- the statements to close and unregisterprotected DBCredentials getCredentials(ISession pSession)
pSession
- the session
getCredentials(IConfiguration)
public static DBCredentials getCredentials(IConfiguration pConfig)
pConfig
- the configuration
public java.sql.Connection getConnection() throws java.lang.Exception
null
if the security manager did
not open a connection
java.lang.Exception
- if db access failspublic java.sql.Connection getConnection(ISession pSession) throws java.lang.Exception
pSession
- the session that wants access to the database
java.lang.Exception
- if db access failsprotected IAccessController createAccessController(ISession pSession)
ISession
.
pSession
- the session which requests the access controller
protected boolean isConnectionAlive()
true
if the connection is alive/validgetAliveQuery()
protected void register(java.sql.Statement pStatement)
pStatement
- the statementprotected boolean unregister(java.sql.Statement pStatement)
pStatement
- the statement
true
if unregistration was successful, false
if statement was not registered
as closableregister(Statement)
protected java.sql.PreparedStatement prepareStatement(java.sql.Connection pConnection, java.lang.String pSql) throws java.sql.SQLException
PreparedStatement
. The statement will be registered for automatic close.
pConnection
- the database connectionpSql
- the SQL statement, e.g. a query
java.sql.SQLException
- if statement creation failsprotected java.sql.CallableStatement prepareCall(java.sql.Connection pConnection, java.lang.String pSql) throws java.sql.SQLException
CallableStatement
. The statement will be registered for automatic close.
pConnection
- the database connectionpSql
- the call statement
java.sql.SQLException
- if statement creation fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |