com.ibm.dse.applsrv.aa
Class SecurityContext

java.lang.Object
  |
  +--com.ibm.dse.applsrv.aa.SecurityObject
        |
        +--com.ibm.dse.applsrv.aa.SecurityContext

public class SecurityContext
extends SecurityObject
implements SecurityConstants, java.io.Serializable

The class defines a user's context.

See Also:
Serialized Form

Fields inherited from class com.ibm.dse.applsrv.aa.SecurityObject
fs
 
Fields inherited from interface com.ibm.dse.applsrv.aa.SecurityConstants
ACTIVE_CONTEXTS, ALL_CONTEXTS, AUDIT_FILE, CBTF_TRACING, CONFIGURATION, CONFIGURATIONS_DATABASE, CONTEXT_ACTIVE, CONTEXT_DATABASE, CONTEXT_INACTIVE, CONTEXT_INVALID, CONTEXTS, CONTROLLER, DEFAULT_CONFIGURATIONS_DATABASE, DEFAULT_CONTEXT_DATABASE, DEFAULT_GROUPS_DATABASE, DEFAULT_RIGHTS_DATABASE, DEFAULT_ROLES_DATABASE, DEFAULT_SERVICES_DATABASE, DEFAULT_USER_DATABASE, ENCRYPTION, GLOBAL_CONTEXTS, GROUPS, GROUPS_DATABASE, INACTIVE_CONTEXTS, JDBC_DATABASE, JDBC_DRIVER, JDBC_MAX_DATA, JDBC_MAX_GROUPS, JDBC_MAX_HANDLER, JDBC_MAX_ID, JDBC_MAX_PASSWORD, JDBC_MAX_RIGHT_TIMES, JDBC_MAX_RIGHTS, JDBC_MAX_ROLE_TIMES, JDBC_MAX_ROLES, JDBC_MAX_USER_ID, JDBC_MAX_USERS, JDBC_PASSWORD, JDBC_URL, JDBC_USER_ID, LIMIT_DATABASE, LIMITS, LOGGING_HANDLER, LOGGING_OPTIONS, PERSIST_CONTEXTS, PERSISTENCE, QUERY_PASSWORDS, RIGHTS, RIGHTS_DATABASE, ROLES, ROLES_DATABASE, SECURITY_DIRECTORY, SECURITY_MANAGER, SERVICES, SERVICES_DATABASE, SPECIFIC_CONTEXTS, TEST_ADD_RIGHT_TO_USER, TEST_ADD_RIGHTS_TO_USER, TEST_AUDIT, TEST_CONTEXT_IDS, TEST_DISABLE_PERSISTENCE, TEST_EXPORT, TEST_GET_CONFIGURATION, TEST_GET_CONTEXTS, TEST_GET_GROUPS, TEST_GET_PASSWORD_ACCESS, TEST_GET_PERSISTENCE, TEST_GET_RIGHTS, TEST_GET_ROLES, TEST_GET_SERVICES, TEST_GET_UNIQUE_LOGON, TEST_GET_USERS, TEST_GROUP_IDS, TEST_IMPORT, TEST_IMPORT2, TEST_LOAD_CONFIGURATIONS, TEST_LOAD_CONTEXTS, TEST_LOAD_GROUPS, TEST_LOAD_RIGHTS, TEST_LOAD_ROLES, TEST_LOAD_SERVICES, TEST_LOAD_USERS, TEST_PERSISTENCE, TEST_QUERY_SM, TEST_REMOVE_ALL_RIGHTS_FROM_USER, TEST_RESET, TEST_RIGHT_IDS, TEST_ROLE_IDS, TEST_SAVE, TEST_SERVICE_IDS, TEST_SET_CONFIGURATION, TEST_SET_PASSWORD_ACCESS, TEST_SET_PERSISTENCE, TEST_SET_UNIQUE_LOGON, TEST_TEST1, TEST_TEST2, TEST_TEST3, TEST_TRACE, TEST_USER_IDS, TRACE_EXCEPTIONS, TRACE_FILE, TRACE_LOGGER, UNIQUE_LOGONS, USE_LIMITS, USER_DATABASE, USERS
 
Constructor Summary
protected SecurityContext(java.lang.String user)
          Create a new instance of a context with the specified user.
protected SecurityContext(java.lang.String user, int contextId)
          Create a new instance of a context with the specified data.
 
Method Summary
protected  void _save()
          A hack to force inheritence of a static method.
 void activate()
          Activate this context.
protected static Dictionary contexts()
          Return a copy of the dictionary of contexts.
static void controller(SecurityController ctrl)
          Set the security controller.
 void deactivate()
          Deactivate this context.
 boolean delete()
          Delete this context.
protected static boolean delete(int context)
          Delete the specified context.
protected static boolean disablePersist()
          Disable persistence for contexts.
protected static java.util.Enumeration enumerationOverContexts()
          Return an enumeration over the contexts.
protected static void forceSave()
          Force a save of the current state of the contexts to the database.
protected static SecurityContext get(int contextID, java.lang.String user)
          Return the context with the specified id.
 boolean getActive()
          Return the active status of this context.
 Dictionary getAttributes()
          Return a dictionary containing all of the attributes of this context.
 int getContext()
          Return the id of this context.
protected static int[] getContextIds()
          Return a array of the integer ids of all the contexts.
protected static SecurityPersistence getDB()
          Return the persistence controller for this class.
 boolean getForcedSignOff()
          Return forced sign off status of this context.
 java.lang.String getOverride()
          Return the override userid of this context.
protected static java.lang.String getPathName()
          Return the pathname of this database of contexts.
protected static boolean getPersist()
          Return the persistence state for contexts.
 java.lang.String getUser()
          Return the userid of this context.
protected static void load()
          Load the current state of the contexts from the database.
protected static IntegerKeyDictionary loadr()
          Load and return the current state of the contexts from the database.
protected static void removeAllContextsReferringTo(java.lang.String user)
          Remove all contexts refering to the named user from the system.
protected static void reset()
          Reset the contexts.
 void resetAttributes()
          Reset all attributes of this context with the exception of the context's id and user id.
protected static void save()
          Save the current state of the contexts to the database.
 void setActive(boolean makeActive)
          Set the active status of this context.
 void setAttributes(boolean active, boolean forcedSignOff, java.lang.String override)
          Set various attributes of this context.
protected static void setDB(SecurityPersistence securityPersistence)
          Set the persistence controller for this class.
protected static void setFileName(java.lang.String fileName)
          Set the filename of this database.
 void setForcedSignOff(boolean forcedSignOff)
          Set the forced sign off status of this context.
 void setOverride(java.lang.String userid)
          Set the override userid of this context.
protected static void setPersist(boolean persistence)
          Enable or disable persistence for contexts.
 void setUser(java.lang.String user)
          Set the user of this context.
protected static void shutdown()
          Shutdown the security component.
 java.lang.String toString()
          Returns a string representation of this object.
 void verify()
          Verify this context.
protected static void verifyAll()
          Verify the consistancy of this database.
 
Methods inherited from class com.ibm.dse.applsrv.aa.SecurityObject
getData, getData, getDataOrNull, getName, home, prefix, putData, putData, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SecurityContext

protected SecurityContext(java.lang.String user)
                   throws DSESecurityException
Create a new instance of a context with the specified user.
Parameters:
user - String - the name of this user.
Throws:
DSESecurityException - - database error.

SecurityContext

protected SecurityContext(java.lang.String user,
                          int contextId)
                   throws DSESecurityException
Create a new instance of a context with the specified data.
Parameters:
user - String - the name of this user.
contextId - int - the id of this new context.
Throws:
DSESecurityException - - invalid context id.
Method Detail

_save

protected void _save()
              throws DSESecurityException
A hack to force inheritence of a static method.
Overrides:
_save in class SecurityObject
Throws:
DSESecurityException - - abstract method.

activate

public void activate()
              throws DSESecurityException
Activate this context.
Throws:
DSESecurityException - - error during save.

contexts

protected static Dictionary contexts()
Return a copy of the dictionary of contexts.
Returns:
Dictionary - a copy of the contexts.

controller

public static void controller(SecurityController ctrl)
Set the security controller.
Parameters:
ctrl - SecurityController - the security controller.

deactivate

public void deactivate()
                throws DSESecurityException
Deactivate this context.
Throws:
DSESecurityException - - error during save.

delete

public boolean delete()
               throws DSESecurityException
Delete this context.
Returns:
boolean - true if the delete succeeded else false.
Throws:
DSESecurityException - - database error.

delete

protected static boolean delete(int context)
                         throws DSESecurityException
Delete the specified context.
Parameters:
context - int - the id of the context to delete.
Returns:
boolean - true if the delete succeeded else false.
Throws:
DSESecurityException - - database error.

disablePersist

protected static boolean disablePersist()
Disable persistence for contexts.
Returns:
boolean - true if contexts were persisting else false.

enumerationOverContexts

protected static java.util.Enumeration enumerationOverContexts()
Return an enumeration over the contexts.
Returns:
Enumeration - the enumeration over the contexts.

forceSave

protected static void forceSave()
                         throws DSESecurityException
Force a save of the current state of the contexts to the database.
Throws:
DSESecurityException - - database error.

get

protected static SecurityContext get(int contextID,
                                     java.lang.String user)
                              throws DSESecurityException
Return the context with the specified id. If the context doesn't exist & the user is null then return null else create & return a new context with the specified id.
Parameters:
contextID - int - the context id.
user - String - if the context does not exist then if user is specified then create it else just return null.
Returns:
SecurityContext - the context.
Throws:
DSESecurityException - - error in the request.

getActive

public boolean getActive()
Return the active status of this context.
Returns:
boolean - true if this context is active else false.

getAttributes

public Dictionary getAttributes()
                         throws DSESecurityException
Return a dictionary containing all of the attributes of this context.
Returns:
Dictionary - a dictionary containing all of the attributes of this context.
Throws:
DSESecurityException - - database error.

getContext

public int getContext()
Return the id of this context.
Returns:
int - the id.

getContextIds

protected static int[] getContextIds()
Return a array of the integer ids of all the contexts.
Returns:
int[] - the array of the integer ids of all the contexts.

getDB

protected static SecurityPersistence getDB()
Return the persistence controller for this class.
Returns:
SecurityPersistence - the persistence controller.

getForcedSignOff

public boolean getForcedSignOff()
Return forced sign off status of this context.
Returns:
boolean - true if the last signoff of this context was a forced signoff else false.

getOverride

public java.lang.String getOverride()
Return the override userid of this context. If there is no override id then return null.
Returns:
String - the override userid.

getPathName

protected static java.lang.String getPathName()
Return the pathname of this database of contexts.
Returns:
String - the pathname of this database or null if its not configured.

getPersist

protected static boolean getPersist()
Return the persistence state for contexts.
Returns:
boolean - true if contexts are persisting else false.

getUser

public java.lang.String getUser()
Return the userid of this context.
Returns:
String - the userid.

load

protected static void load()
                    throws DSESecurityException
Load the current state of the contexts from the database.
Throws:
DSESecurityException - - database error.

loadr

protected static IntegerKeyDictionary loadr()
                                     throws DSESecurityException
Load and return the current state of the contexts from the database.
Returns:
IntegerKeyDictionary - the contexts that were read in.
Throws:
DSESecurityException - - database error.

removeAllContextsReferringTo

protected static void removeAllContextsReferringTo(java.lang.String user)
                                            throws DSESecurityException
Remove all contexts refering to the named user from the system.
Parameters:
user - String - the name of the user.
Throws:
DSESecurityException - - database error.

reset

protected static void reset()
                     throws DSESecurityException
Reset the contexts.
Throws:
DSESecurityException - - database error.

resetAttributes

public void resetAttributes()
                     throws DSESecurityException
Reset all attributes of this context with the exception of the context's id and user id.
Throws:
DSESecurityException - - error during save.

save

protected static void save()
                    throws DSESecurityException
Save the current state of the contexts to the database.
Throws:
DSESecurityException - - database error.

setActive

public void setActive(boolean makeActive)
               throws DSESecurityException
Set the active status of this context.
Parameters:
makeActive - boolean - the active status.
Throws:
DSESecurityException - - database error.

setAttributes

public void setAttributes(boolean active,
                          boolean forcedSignOff,
                          java.lang.String override)
                   throws DSESecurityException
Set various attributes of this context.
Parameters:
active - boolean - the active status.
forcedSignOff - boolean - true if the last signoff of this context was a forced signoff else false.
override - String - the override id.
Throws:
DSESecurityException - - database error.

setDB

protected static void setDB(SecurityPersistence securityPersistence)
Set the persistence controller for this class.
Parameters:
securityPersistence - SecurityPersistence - the persistence controller.

setFileName

protected static void setFileName(java.lang.String fileName)
Set the filename of this database.
Parameters:
fileName - String - the name of this database.

setForcedSignOff

public void setForcedSignOff(boolean forcedSignOff)
                      throws DSESecurityException
Set the forced sign off status of this context.
Parameters:
forcedSignOff - boolean - true if the last signoff of this context was a forced signoff else false.
Throws:
DSESecurityException - - database error.

setOverride

public void setOverride(java.lang.String userid)
                 throws DSESecurityException
Set the override userid of this context. A null refers to no override id.
Parameters:
userid - String - the override userid.
Throws:
DSESecurityException - - database error.

setPersist

protected static void setPersist(boolean persistence)
Enable or disable persistence for contexts.
Parameters:
persistence - boolean - true to enable persistence, false to disable it.

setUser

public void setUser(java.lang.String user)
             throws DSESecurityException
Set the user of this context. This value DOES change during a forced sign on.
Parameters:
user - String - the user.
Throws:
DSESecurityException - - database error.

shutdown

protected static void shutdown()
                        throws DSESecurityException
Shutdown the security component.
Throws:
DSESecurityException - - error in the request.

toString

public java.lang.String toString()
Returns a string representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
String - a string representation of this object.

verify

public void verify()
            throws DSESecurityException
Verify this context.
Throws:
DSESecurityException - - error in the request.

verifyAll

protected static void verifyAll()
                         throws DSESecurityException
Verify the consistancy of this database.
Throws:
DSESecurityException - - error in the request.