com.tivoli.twg.engine
Class TWGActiveConsole

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGObject
      extended bycom.tivoli.twg.engine.TWGActiveConsole
All Implemented Interfaces:
TWGBaseShadowedObject, TWGFilterSubscriber, TWGGetSetInterface, TWGShadowedObject

public class TWGActiveConsole
extends TWGObject
implements TWGShadowedObject, TWGFilterSubscriber, TWGGetSetInterface

Transient object representing state and active processes associated with a specific remote management console logon.


Field Summary
static int CONSOLE_CLOSED
          Console closed state for TWGActiveConsoleListener.consoleChanged()
static int CONSOLE_OPENED
          Console opened state for TWGActiveConsoleListener.consoleChanged()
 
Constructor Summary
TWGActiveConsole(TWGIPCServerLink lnk)
          Constructor for active console instance.
 
Method Summary
static void addConsoleAndSubtaskListener(TWGConsoleAndSubtaskListener listener)
          Add a listener for console and task activation/deactivations
static void addListener(TWGActiveConsoleListener listener)
          Add a listener for TWGActiveConsole state change notifications
static void attachAllFiltersToUserConsoles(TWGUser uid)
          Attach all filters to all consoles for a given user account.
static void attachAllTasksToUserConsoles(TWGUser uid)
          Attach all tasks to all consoles for a given user account.
static void attachCategoryToAllAllowedConsoles(com.tivoli.twg.engine.TWGGroupCategory gcat)
          Attach group category to all allowed consoles
static void attachCategoryToAllAllowedConsoles(com.tivoli.twg.engine.TWGTaskCategory tcat)
          Attach task category to all allowed consoles
static void attachFilterToAllAllowedConsoles(TWGFilter flt)
          Attach filter to all allowed consoles
static void attachObjectsToAlmostAllConsoles(LongValueSet oids, StringValueSet uids)
          Attach set of console-spec shadowed objects to all consoles EXCEPT those in a given list of user accounts.
static void attachObjectsToUserConsoles(LongValueSet oids, TWGUser uid)
          Attach set of console-spec shadowed objects to all consoles for a given user account.
static void attachTaskToAllAllowedConsoles(TWGTask tsk)
          Attach task to all allowed consoles
static void checkUserLogon(java.lang.String uid)
          Check to see if a user logon would be accepted (based on logon and user limits)
static void CloseLink(TWGIPCServerLink lnk)
          Close console associated with given link
 void Delete()
          Delete method for active console
static void detachAllDisallowedFiltersFromUserConsoles(TWGUser uid)
          Detach all disallowed filters from a given user's consoles
static void detachAllDisallowedTasksFromUserConsoles(TWGUser uid)
          Detach all disallowed tasks from a given user's consoles
static void detachObjectsFromAlmostAllConsoles(LongValueSet oids, StringValueSet uids)
          Detach set of console-spec shadowed objects from all consoles EXCEPT those in a given list of user accounts.
static void detachObjectsFromUserConsoles(LongValueSet oids, TWGUser uid)
          Detach set of console-spec shadowed objects from all consoles for a given user account.
static void dropFilter(TWGFilter flt)
          Drop filter : used to by TWGFilter to announce deletion of filter.
static void filterActivated(TWGFilter flt)
          Filter activated notification
static void filterDeactivated(TWGFilter flt)
          Filter deactivated notification
 void filterMOSChangeNotify(TWGFilter filt, TWGManagedObjectSet mos, IntValueSet add_mo_ids, IntValueSet chg_mo_ids, IntValueSet del_mo_ids)
          Notification method for reporting changes in the membership of the TWGManagedObjectSet associated with the TWGFilter.
 void filterSubscribeEnded(TWGFilter filt)
          Notifcation of end of subscription to filter : called if filter deleted
static TWGActiveConsole FindConsoleForServiceNode(java.lang.String sn_name)
          Find TWGActiveConsole associated with given service node name
static TWGActiveConsole[] findConsolesForUserIDs(java.lang.String[] uid)
          Find active consoles for given user IDs
static StringValueSet getAllActiveUserIDs()
          Get all active accounts
 TWGAssociation getAssociation()
          Return reference to active association for session
 java.lang.String[] getAttributeIDList()
          Attribute ID enumeration : this method is expected to return a List of strings containing the String names of the attributes supported for a given object.
 int getAttributeType(java.lang.String id)
          Get type of attribute value for given attribute
 DataValue getAttributeValue(java.lang.String id, java.util.Locale loc)
          Get value of attribute with given ID
 java.lang.String GetConShadowClass()
          Get name of console shadow class.
static TWGActiveConsole getConsole(Command cmd)
          Obtain the active console for a received command.
 TWGFilter getFilter()
          Return reference to active filter for session
static long GetGlobalShadowVersion()
          Read current global state version
 java.lang.String getHostName()
          Get hostname.
 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.
 TWGUser getUser()
          Return user associated with console session
static void HandleUpdateRequest(Command cmd)
          Handler for requests for shadowed object updates.
static void managedObjectChanged(long chg_mo_id, int reason_code)
          Handle notification of changed managed object instance
static void managedObjectCreated(long new_mo_id)
          Handle notification of new managed object instance
static void managedObjectDeleted(long del_mo_id)
          Handle notification of deleted managed object instance
static void managedObjectsChanged(IntValueSet chg_mo_ids)
          Handle notification of changed managed object instances
static void managedObjectsChanged(IntValueSet chg_mo_ids, StringValueSet db_classnames)
          Handle notification of changed managed object instances (database content)
static void newUserCreatedNotify(TWGUser usr)
          Notify of new user created
static long nextShadowVersion()
          Get next state version : increments the global state version
 void objectAddToConsole(TWGConsoleSpecShadowedObject obj)
          Associate console-specific shadowed object with active console instance.
static void objectCreated(long oid, TWGShadowedObject obj)
          Method used to signal new shadowed object
static void objectDeleted(long obj_id)
          Method used to signal that a TWGShadowedObject has been deleted
static void objectRemoveFromAllConsoles(long obj_id)
          Disassociate console-specific shadowed object from all consoles.
static void objectRemoveFromAllUserConsoles(java.lang.String uid, TWGConsoleSpecShadowedObject obj)
          Disassociate console-specific shadowed object from all consoles associated with a specific user ID
 void objectRemoveFromConsole(long obj_id)
          Disassociate console-specific shadowed object with console instance.
 void objectRemoveFromConsole(TWGConsoleSpecShadowedObject obj)
          Disassociate console-specific shadowed object with console instance.
static void objectUpdated(TWGBaseShadowedObject obj)
          Method used to signal the change of the shadowed state of a shadowed object instance.
static void ProcessWizardGetPropertiesRequest(Command cmd)
          Process a request for the WizardTasks properties keys and values from both the static classes/WizardTasks.properties file and the user data file data/WizardTasks.prop.
static void ProcessWizardPutPropertiesRequest(Command cmd)
          Process a request to put property key/value pairs in data/WizardTasks.prop
static void removeConsoleAndSubtaskListener(TWGConsoleAndSubtaskListener listener)
          Remove a previously registered listener
static void removeListener(TWGActiveConsoleListener listener)
          Remove a previously registered listener
 void setAllUsersShadowed(boolean enab)
          Enable/disable shadowing of all user objects
 void setAssociation(TWGAssociation new_association)
          Set new active association for console session
 boolean setAttributeValue(java.lang.String id, DataValue val)
          Set value of attribute with given ID
 void setFilter(TWGFilter new_filter)
          Set new active filter for console session
 void SetObjectID(long oid)
          Change the object ID to a new value
 void setUser(TWGUser new_user)
          Set user object associated with console session
 java.lang.String toString()
          Returns a string representation of the object.
 void UpdateShadowVersion()
          Update object state version.
 
Methods inherited from class com.tivoli.twg.engine.TWGObject
AllObjects, AllObjects, Destroy, DumpTWGObjects, FindObject, isDeleted, isNewObject, isPersistent, isPersistent, isValid, isValid, ObjectID, setDistinctObjectID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONSOLE_OPENED

public static final int CONSOLE_OPENED
Console opened state for TWGActiveConsoleListener.consoleChanged()

See Also:
Constant Field Values

CONSOLE_CLOSED

public static final int CONSOLE_CLOSED
Console closed state for TWGActiveConsoleListener.consoleChanged()

See Also:
Constant Field Values
Constructor Detail

TWGActiveConsole

public TWGActiveConsole(TWGIPCServerLink lnk)
Constructor for active console instance. Save IPC link instance.

Parameters:
lnk - - IPC link for console
Method Detail

SetObjectID

public void SetObjectID(long oid)
                 throws DuplicateObjectIDException
Change the object ID to a new value

Overrides:
SetObjectID in class TWGObject
Parameters:
oid - - new object ID value
Throws:
DuplicateObjectIDException - if ID is duplicate

Delete

public void Delete()
Delete method for active console

Overrides:
Delete in class TWGObject

getUser

public TWGUser getUser()
Return user associated with console session

Returns:
user associated with console session

getAssociation

public TWGAssociation getAssociation()
Return reference to active association for session

Returns:
active association for console session

getFilter

public TWGFilter getFilter()
Return reference to active filter for session

Returns:
active filter for console session

setUser

public void setUser(TWGUser new_user)
Set user object associated with console session

Parameters:
new_user - - user object to be associated with session

setAssociation

public void setAssociation(TWGAssociation new_association)
Set new active association for console session

Parameters:
new_association - - new association to be used as active association

setFilter

public void setFilter(TWGFilter new_filter)
Set new active filter for console session

Parameters:
new_filter - - new filter to be used as active filter

CloseLink

public static void CloseLink(TWGIPCServerLink lnk)
Close console associated with given link

Parameters:
lnk - - link to be closed

toString

public java.lang.String toString()
Returns a string representation of the object.

See Also:
Object.toString()

FindConsoleForServiceNode

public static TWGActiveConsole FindConsoleForServiceNode(java.lang.String sn_name)
Find TWGActiveConsole associated with given service node name

Parameters:
sn_name - - name of service node to be found
Returns:
TWGActiveConsole which owns ServiceNode, or null if not found

getConsole

public static TWGActiveConsole getConsole(Command cmd)
Obtain the active console for a received command.

Parameters:
cmd - the received command
Returns:
the active console based on the return address of the command or null if there is no matching active console

objectAddToConsole

public void objectAddToConsole(TWGConsoleSpecShadowedObject obj)
Associate console-specific shadowed object with active console instance.

Parameters:
obj - - object to be associated

objectRemoveFromConsole

public void objectRemoveFromConsole(long obj_id)
Disassociate console-specific shadowed object with console instance.

Parameters:
obj_id - - object ID of object to be disassociated.

objectRemoveFromConsole

public void objectRemoveFromConsole(TWGConsoleSpecShadowedObject obj)
Disassociate console-specific shadowed object with console instance.

Parameters:
obj - - object to be disassociated.

objectRemoveFromAllConsoles

public static void objectRemoveFromAllConsoles(long obj_id)
Disassociate console-specific shadowed object from all consoles.

Parameters:
obj_id - - object ID to be disassociated

objectRemoveFromAllUserConsoles

public static void objectRemoveFromAllUserConsoles(java.lang.String uid,
                                                   TWGConsoleSpecShadowedObject obj)
Disassociate console-specific shadowed object from all consoles associated with a specific user ID

Parameters:
uid - - user ID
obj - - object to be disassociated.

nextShadowVersion

public static long nextShadowVersion()
Get next state version : increments the global state version

Returns:
new state version value

GetGlobalShadowVersion

public static long GetGlobalShadowVersion()
Read current global state version

Returns:
current value of state version value

objectUpdated

public static void objectUpdated(TWGBaseShadowedObject obj)
Method used to signal the change of the shadowed state of a shadowed object instance. Object must be a TWGObject subclass and a TWGBaseShadowedObject implementer.

Parameters:
obj - - reference to object instance which has been created/updated

objectDeleted

public static void objectDeleted(long obj_id)
Method used to signal that a TWGShadowedObject has been deleted

Parameters:
obj_id - - ObjectID of object which has been deleted

objectCreated

public static void objectCreated(long oid,
                                 TWGShadowedObject obj)
Method used to signal new shadowed object

Parameters:
oid - - Object ID
obj - - New object

HandleUpdateRequest

public static void HandleUpdateRequest(Command cmd)
Handler for requests for shadowed object updates. Command is either processed immediately (if the version information is "old") or postponed and stored for later reply (if version is "current")

Command format is as follows:

- input 0: Long64 timestamp value of caller's level (0=initial)

- input 1: locale string (4 character ASCIIZ string)

Parameters:
cmd - - IPC command requesting updates

ProcessWizardGetPropertiesRequest

public static void ProcessWizardGetPropertiesRequest(Command cmd)
Process a request for the WizardTasks properties keys and values from both the static classes/WizardTasks.properties file and the user data file data/WizardTasks.prop.

Parameters:
cmd - - A TWGWizardLoadSaveCommand

ProcessWizardPutPropertiesRequest

public static void ProcessWizardPutPropertiesRequest(Command cmd)
Process a request to put property key/value pairs in data/WizardTasks.prop

Parameters:
cmd - - A TWGWizardLoadSaveCommand

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.

addListener

public static void addListener(TWGActiveConsoleListener listener)
Add a listener for TWGActiveConsole state change notifications

Parameters:
listener - TWGActiveConsoleListener to be add

removeListener

public static void removeListener(TWGActiveConsoleListener listener)
Remove a previously registered listener

Parameters:
listener - TWGActiveConsoleListener to be removed

addConsoleAndSubtaskListener

public static void addConsoleAndSubtaskListener(TWGConsoleAndSubtaskListener listener)
Add a listener for console and task activation/deactivations

Parameters:
listener - TWGConsoleAndSubtaskListener to be add

removeConsoleAndSubtaskListener

public static void removeConsoleAndSubtaskListener(TWGConsoleAndSubtaskListener listener)
Remove a previously registered listener

Parameters:
listener - TWGConsoleAndSubtaskListener to be removed

managedObjectCreated

public static void managedObjectCreated(long new_mo_id)
Handle notification of new managed object instance

Parameters:
new_mo_id - - new managed object ID

managedObjectChanged

public static void managedObjectChanged(long chg_mo_id,
                                        int reason_code)
Handle notification of changed managed object instance

Parameters:
chg_mo_id - - changed managed object ID
reason_code - - change reason code

managedObjectsChanged

public static void managedObjectsChanged(IntValueSet chg_mo_ids,
                                         StringValueSet db_classnames)
Handle notification of changed managed object instances (database content)

Parameters:
chg_mo_ids - - changed managed object IDs (changed during call)
db_classnames - - classnames (without package) of database tables updated for given managed objects : "*" implies all tables

managedObjectsChanged

public static void managedObjectsChanged(IntValueSet chg_mo_ids)
Handle notification of changed managed object instances

Parameters:
chg_mo_ids - - changed managed object IDs (changed during call)

managedObjectDeleted

public static void managedObjectDeleted(long del_mo_id)
Handle notification of deleted managed object instance

Parameters:
del_mo_id - - deleted managed object ID

filterMOSChangeNotify

public void filterMOSChangeNotify(TWGFilter filt,
                                  TWGManagedObjectSet mos,
                                  IntValueSet add_mo_ids,
                                  IntValueSet chg_mo_ids,
                                  IntValueSet del_mo_ids)
Notification method for reporting changes in the membership of the TWGManagedObjectSet associated with the TWGFilter.

Specified by:
filterMOSChangeNotify in interface TWGFilterSubscriber
Parameters:
filt - - TWGFilter notifying of change
mos - - TWGManagedObjectSet associated with changed filter
add_mo_ids - - Set of TWGManagedObject persistent IDs added to the TWGManagedObjectSet
chg_mo_ids - - Set of TWGManagedObject persistent IDs changed in the TWGManagedObjectSet
del_mo_ids - - Set of TWGManagedObject persistent IDs deleted from the TWGManagedObjectSet

filterSubscribeEnded

public void filterSubscribeEnded(TWGFilter filt)
Notifcation of end of subscription to filter : called if filter deleted

Specified by:
filterSubscribeEnded in interface TWGFilterSubscriber
Parameters:
filt - - TWGFilter ending subscription

filterActivated

public static void filterActivated(TWGFilter flt)
Filter activated notification

Parameters:
flt - - reference to filter which has become active

filterDeactivated

public static void filterDeactivated(TWGFilter flt)
Filter deactivated notification

Parameters:
flt - - reference to filter which has become inactive

getAttributeIDList

public java.lang.String[] getAttributeIDList()
Attribute ID enumeration : this method is expected to return a List of strings containing the String names of the attributes supported for a given object. Subclasses of base classes implementing the interface should report additional attributes by adding them to the list returned by the base class.

Specified by:
getAttributeIDList in interface TWGGetSetInterface

getAttributeValue

public DataValue getAttributeValue(java.lang.String id,
                                   java.util.Locale loc)
Get value of attribute with given ID

Specified by:
getAttributeValue in interface TWGGetSetInterface
Parameters:
id - - attribute ID requested
loc - - locale to use for value, if applicable
Returns:
value object, or null if no value

setAttributeValue

public boolean setAttributeValue(java.lang.String id,
                                 DataValue val)
Set value of attribute with given ID

Specified by:
setAttributeValue in interface TWGGetSetInterface
Parameters:
id - - attribute ID to be set
val - - attribute value to be set
Returns:
true if set successful, false if not successful

getAttributeType

public int getAttributeType(java.lang.String id)
Get type of attribute value for given attribute

Specified by:
getAttributeType in interface TWGGetSetInterface
Parameters:
id - - attribute ID
Returns:
DataValue type of attribute, or DataValue.NONE_TYPE if undefined

dropFilter

public static void dropFilter(TWGFilter flt)
Drop filter : used to by TWGFilter to announce deletion of filter. All active console will switch to another filter before returning.

Parameters:
flt - - filter to be deleted

findConsolesForUserIDs

public static TWGActiveConsole[] findConsolesForUserIDs(java.lang.String[] uid)
Find active consoles for given user IDs

Parameters:
uid - - user ID list
Returns:
active console list

getAllActiveUserIDs

public static StringValueSet getAllActiveUserIDs()
Get all active accounts

Returns:
set of active user IDs (lower case), or null if none

attachFilterToAllAllowedConsoles

public static void attachFilterToAllAllowedConsoles(TWGFilter flt)
Attach filter to all allowed consoles

Parameters:
flt - - filter to be attached

attachTaskToAllAllowedConsoles

public static void attachTaskToAllAllowedConsoles(TWGTask tsk)
Attach task to all allowed consoles

Parameters:
tsk - - task to be attached

attachCategoryToAllAllowedConsoles

public static void attachCategoryToAllAllowedConsoles(com.tivoli.twg.engine.TWGGroupCategory gcat)
Attach group category to all allowed consoles

Parameters:
gcat - - category to be attached

attachCategoryToAllAllowedConsoles

public static void attachCategoryToAllAllowedConsoles(com.tivoli.twg.engine.TWGTaskCategory tcat)
Attach task category to all allowed consoles


attachObjectsToUserConsoles

public static void attachObjectsToUserConsoles(LongValueSet oids,
                                               TWGUser uid)
Attach set of console-spec shadowed objects to all consoles for a given user account.

Parameters:
oids - - object IDs of console-spec objects to attach
uid - - user object

detachObjectsFromUserConsoles

public static void detachObjectsFromUserConsoles(LongValueSet oids,
                                                 TWGUser uid)
Detach set of console-spec shadowed objects from all consoles for a given user account.

Parameters:
oids - - object IDs of console-spec objects to detach
uid - - user object

attachObjectsToAlmostAllConsoles

public static void attachObjectsToAlmostAllConsoles(LongValueSet oids,
                                                    StringValueSet uids)
Attach set of console-spec shadowed objects to all consoles EXCEPT those in a given list of user accounts.

Parameters:
oids - - object IDs of console-spec objects to attach
uids - - user ids of the users to exclude

detachObjectsFromAlmostAllConsoles

public static void detachObjectsFromAlmostAllConsoles(LongValueSet oids,
                                                      StringValueSet uids)
Detach set of console-spec shadowed objects from all consoles EXCEPT those in a given list of user accounts.

Parameters:
oids - - object IDs of console-spec objects to detach
uids - - user ids of the users to exclude

attachAllFiltersToUserConsoles

public static void attachAllFiltersToUserConsoles(TWGUser uid)
Attach all filters to all consoles for a given user account.

Parameters:
uid - - user object

detachAllDisallowedFiltersFromUserConsoles

public static void detachAllDisallowedFiltersFromUserConsoles(TWGUser uid)
Detach all disallowed filters from a given user's consoles

Parameters:
uid - - user object

attachAllTasksToUserConsoles

public static void attachAllTasksToUserConsoles(TWGUser uid)
Attach all tasks to all consoles for a given user account.

Parameters:
uid - - user object

detachAllDisallowedTasksFromUserConsoles

public static void detachAllDisallowedTasksFromUserConsoles(TWGUser uid)
Detach all disallowed tasks from a given user's consoles

Parameters:
uid - - user object

setAllUsersShadowed

public void setAllUsersShadowed(boolean enab)
Enable/disable shadowing of all user objects

Parameters:
enab - - true if enabling, false if disabling

newUserCreatedNotify

public static void newUserCreatedNotify(TWGUser usr)
Notify of new user created

Parameters:
usr - - user object created

checkUserLogon

public static void checkUserLogon(java.lang.String uid)
                           throws TWGUserIDCountExceededException,
                                  TWGLogonCountExceededException
Check to see if a user logon would be accepted (based on logon and user limits)

Parameters:
uid - - user ID
Throws:
TWGUserIDCountExceededException - if too many active user-ids
TWGLogonCountExceededException - if too many active logons

getHostName

public java.lang.String getHostName()
Get hostname. Return an empty string if the link is no longer active.

Returns:
hostname