com.tivoli.twg.engine
Class TWGPrivToken

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGObject
      extended bycom.tivoli.twg.engine.TWGPersistentObject
          extended bycom.tivoli.twg.engine.TWGPrivToken
All Implemented Interfaces:
TWGBaseShadowedObject, TWGShadowedObject

public class TWGPrivToken
extends TWGPersistentObject
implements TWGShadowedObject

Privilege token definition class : used by extensions to define custom privilege tokens, including the descriptive names for the tokens and any default access for those tokens.


Field Summary
 
Fields inherited from class com.tivoli.twg.engine.TWGPersistentObject
CLASS_NAME, SIZEOF_BYTE, SIZEOF_CHAR, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_INT, SIZEOF_LONG, SIZEOF_SHORT
 
Constructor Summary
TWGPrivToken()
          Default constructor for token : used for object restore
TWGPrivToken(java.lang.String id, java.lang.String n, java.lang.String nls, boolean def_enab, java.lang.String ext)
          Main constructor for TWGPrivToken
 
Method Summary
static TWGPrivToken findPrivToken(java.lang.String tok_id)
          Get privilege token by token ID
 java.lang.String GetConShadowClass()
          Get name of console shadow class.
 java.lang.String getName()
          Get name of privilege (use default locale)
 java.lang.String getName(java.util.Locale loc)
          Get name of privilege (using given locale)
 byte[] GetShadowRecord(java.util.Locale locale)
          Get buffer containing current values of the shadowed attributes to be delivered to the console shadow class.
 long GetShadowVersion()
          Get object state version.
static StringValueSet getTokenIDs()
          Get set of all token IDs defined
static void initializeBuiltInPrivs()
          Initialize built-in privilege tokens
 boolean isDefaultEnabled()
          Test if privilege defaults to enabled
static boolean isPrivTokenDefined(java.lang.String id)
          Test if token ID is defined
protected  void restoreData(TWGPersistentObjectDictionary dictionary, boolean resolveObjectReferences)
          Method for restoring persistent object data.
protected  void saveData(TWGPersistentObjectDictionary dictionary)
          Method for saving persistent object data.
 void UpdateShadowVersion()
          Update object state version.
 
Methods inherited from class com.tivoli.twg.engine.TWGPersistentObject
Destroy, enableAsyncWrites, fromPersistID, initialize, isNewPersistentStore, isSaveRequired, PersistID, restore, restoreAll, save, save, setSaveRequired, terminate, toPersistID
 
Methods inherited from class com.tivoli.twg.engine.TWGObject
AllObjects, AllObjects, Delete, DumpTWGObjects, FindObject, isDeleted, isNewObject, isPersistent, isPersistent, isValid, isValid, ObjectID, setDistinctObjectID, SetObjectID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TWGPrivToken

public TWGPrivToken()
Default constructor for token : used for object restore


TWGPrivToken

public TWGPrivToken(java.lang.String id,
                    java.lang.String n,
                    java.lang.String nls,
                    boolean def_enab,
                    java.lang.String ext)
             throws TWGPersistentObjectSaveException
Main constructor for TWGPrivToken

Parameters:
id - - unique token ID string
n - - name string, or name ID string if 'nls' defined
nls - - NLS bundle class (null if none)
def_enab - - default privilege to enabled on new/existing users
ext - - class name of extension defining privilege (null if none)
Throws:
TWGPersistentObjectSaveException - if error saving object
Method Detail

UpdateShadowVersion

public void UpdateShadowVersion()
Update object state version. This method must call the TWGActiveConsole.nextShadowVersion() to update its internal state_version attribute (a 'long' instance variable). This method should be called by any methods of the object's class or subclasses which modify attributes which are send to the shadow objects on the console).

Specified by:
UpdateShadowVersion in interface TWGBaseShadowedObject

GetShadowVersion

public long GetShadowVersion()
Get object state version. This returns value of state_version.

Specified by:
GetShadowVersion in interface TWGBaseShadowedObject
Returns:
state_version attribute value

GetConShadowClass

public java.lang.String GetConShadowClass()
Get name of console shadow class. This returns the name of TWGConObject subclass which is used to hold the attributes shadowed to the console.

Specified by:
GetConShadowClass in interface TWGBaseShadowedObject
Returns:
com.tivoli.twg.engine.TWGConObject subclass which object shadows to

GetShadowRecord

public byte[] GetShadowRecord(java.util.Locale locale)
Get buffer containing current values of the shadowed attributes to be delivered to the console shadow class. This data is delivered along with the ObjectID (so the ObjectID shouldn't be included in the shadowed data record).

Specified by:
GetShadowRecord in interface TWGBaseShadowedObject
Parameters:
locale - - Locale of requested data
Returns:
byte array containing opaque data representation of attribute values to be delivered to the console shadow class.

getName

public java.lang.String getName()
Get name of privilege (use default locale)

Returns:
name

getName

public java.lang.String getName(java.util.Locale loc)
Get name of privilege (using given locale)

Parameters:
loc - - locale of request
Returns:
name

isDefaultEnabled

public boolean isDefaultEnabled()
Test if privilege defaults to enabled

Returns:
true if enabled by default

saveData

protected void saveData(TWGPersistentObjectDictionary dictionary)
                 throws TWGPersistentObjectSaveException
Method for saving persistent object data.

Overrides:
saveData in class TWGPersistentObject
Throws:
TWGPersistentObjectSaveException - thrown to abort save procedure.

restoreData

protected void restoreData(TWGPersistentObjectDictionary dictionary,
                           boolean resolveObjectReferences)
                    throws TWGPersistentObjectRestoreException
Method for restoring persistent object data.

Overrides:
restoreData in class TWGPersistentObject
Parameters:
resolveObjectReferences - used to indicate if object references should be resolved during restore.
Throws:
TWGPersistentObjectRestoreException - thrown to abort restore procedure.

findPrivToken

public static TWGPrivToken findPrivToken(java.lang.String tok_id)
Get privilege token by token ID

Parameters:
tok_id - - token ID
Returns:
privilege token found, or null if not found

getTokenIDs

public static StringValueSet getTokenIDs()
Get set of all token IDs defined

Returns:
read-only set of token IDs

isPrivTokenDefined

public static boolean isPrivTokenDefined(java.lang.String id)
Test if token ID is defined

Parameters:
id - - token ID
Returns:
true if token with given ID defined

initializeBuiltInPrivs

public static void initializeBuiltInPrivs()
                                   throws TWGPersistentObjectSaveException
Initialize built-in privilege tokens

Throws:
TWGPersistentObjectSaveException - if error creating objects