com.BobCo.postit
Class BCPostItNotebook

java.lang.Object
  extended bycom.BobCo.postit.BCPostItNotebook
All Implemented Interfaces:
BCPostItConstants, com.tivoli.twg.libs.CommandReceivedListener, java.lang.Runnable, com.tivoli.twg.engine.TWGTaskServer

public class BCPostItNotebook
extends java.lang.Object
implements com.tivoli.twg.engine.TWGTaskServer, BCPostItConstants, com.tivoli.twg.libs.CommandReceivedListener

This is an example server task providing the tracking of the reminder notes that are attached to managed objects/groups. In this example, ....


Field Summary
 
Fields inherited from interface com.BobCo.postit.BCPostItConstants
CREATE_POST_IT_NOTE_CMD, GET_POST_IT_NOTE_TEXT_CMD, GET_POST_ITS_FOR_OBJECT_CMD, POST_IT_SERVER, RC_INVALID_PARAMETER, RC_OKAY, RC_UNSUPPORTED_CMD, REMOVE_POST_IT_NOTE_CMD, RETRIEVE_POST_IT_LIST_CMD
 
Constructor Summary
BCPostItNotebook()
          Constructor for the Reminder Notes Server Task
 
Method Summary
 boolean CommandReceived(com.tivoli.twg.libs.ServiceNode sn, com.tivoli.twg.libs.Command cmd)
          Command received callback.
 int createPostItNote(java.lang.String noteText, com.tivoli.twg.libs.LongValueSet moids)
          Create a post it note for the objects specified.
 com.tivoli.twg.libs.IntValueSet getAllNotesForObject(long oid)
          Get the list of notes attached to a specific object id.
 long[] getAllObjectsWithNotesAttached()
          Get the list of all object ids that have notes attached to them.
static BCPostItNotebook getPostItServerTask()
          This method returns the postit service node defined in the server.
 com.tivoli.twg.libs.ServiceNode getPostItServiceNode()
          This method returns the postit service node defined in the server.
 void handleCreatePostItRequest(com.tivoli.twg.libs.Command cmd)
          Command handler for create post it note command
 void handleGetPostItListRequest(com.tivoli.twg.libs.Command cmd)
          Command handler for retrieving the list of all object ids with notes attached.
 void handleGetPostItNotesForObjectRequest(com.tivoli.twg.libs.Command cmd)
          Command handler for retrieving the list of all object ids with notes attached.
 void handleGetPostItNoteTextRequest(com.tivoli.twg.libs.Command cmd)
          Command handler for retrieving the text for a specific post it note.
 void handleRemovePostItRequest(com.tivoli.twg.libs.Command cmd)
          Command handler for remove post it note command
 void removePostItNote(int noteID, com.tivoli.twg.libs.LongValueSet moids)
          Remove the post it note from the specified systems.
 void run()
           
 boolean serverActivate(com.tivoli.twg.engine.TWGTask task)
          This method is called first so that the server task can perform any initialization prior to run() getting called.
 void serverDeactivate()
          This method is called when the server needs to deactivate this server task.
 int subtaskActivate(com.tivoli.twg.engine.TWGTaskActivation act)
          This method is called when a subtask activation has been received from the console for this task.
 void subtaskDeactivate(com.tivoli.twg.engine.TWGTaskActivation act)
          This method is called when a subtask deactivation has been received from the console for this task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BCPostItNotebook

public BCPostItNotebook()
Constructor for the Reminder Notes Server Task

Method Detail

serverActivate

public boolean serverActivate(com.tivoli.twg.engine.TWGTask task)
This method is called first so that the server task can perform any initialization prior to run() getting called. If there are any other threads needed besides the thread that calls run() they should be created here. Since the thread calling serverActivate() is dedicated to the activation process, it is expected that control will not be returned from this call until server task activation has completed.

Specified by:
serverActivate in interface com.tivoli.twg.engine.TWGTaskServer
Returns:
true if server activation completed successfully. or false if it failed

serverDeactivate

public void serverDeactivate()
This method is called when the server needs to deactivate this server task. The server task should perform any necessary clean up including shutting down any additional threads it may have started and cause the thread running in the run() method to return.

Specified by:
serverDeactivate in interface com.tivoli.twg.engine.TWGTaskServer

subtaskActivate

public int subtaskActivate(com.tivoli.twg.engine.TWGTaskActivation act)
This method is called when a subtask activation has been received from the console for this task. The thread calling this method is responsible for perfoming all subtaskActivate() calls, so control should not be kept here for long. If subtask activation requires waiting for an asynchronous state change or event to occur, then this method should return indicating that the activation is still pending and complete the subtask activation later by calling act.getTask().subtaskActivateComplete().

Specified by:
subtaskActivate in interface com.tivoli.twg.engine.TWGTaskServer
Parameters:
act - the TWGTaskActivation object for the subtask being activated.
Returns:
Use one of the following final values from TWGTask:
  • SUBTASK_ACT_COMPLETE - completed successfully
  • SUBTASK_ACT_FAILED - subtask activation failed
  • SUBTASK_ACT_PENDING - subtask activation will complete asynchronously

subtaskDeactivate

public void subtaskDeactivate(com.tivoli.twg.engine.TWGTaskActivation act)
This method is called when a subtask deactivation has been received from the console for this task.

Specified by:
subtaskDeactivate in interface com.tivoli.twg.engine.TWGTaskServer

run

public void run()
Specified by:
run in interface java.lang.Runnable

CommandReceived

public boolean CommandReceived(com.tivoli.twg.libs.ServiceNode sn,
                               com.tivoli.twg.libs.Command cmd)
Command received callback. This listener method is called when a Command is received matching one of the command codes registered for the given listener

Specified by:
CommandReceived in interface com.tivoli.twg.libs.CommandReceivedListener
Parameters:
sn - - ServiceNode instance which received Command
cmd - - Instance of Command received
Returns:
true if ServiceNode should stay active, false if it should terminate

getPostItServiceNode

public com.tivoli.twg.libs.ServiceNode getPostItServiceNode()
This method returns the postit service node defined in the server.

Returns:
post it service node reference.

getPostItServerTask

public static BCPostItNotebook getPostItServerTask()
This method returns the postit service node defined in the server.

Returns:
post it service node reference.

getAllObjectsWithNotesAttached

public long[] getAllObjectsWithNotesAttached()
Get the list of all object ids that have notes attached to them.

Returns:
Array of object ids that have notes attached.

getAllNotesForObject

public com.tivoli.twg.libs.IntValueSet getAllNotesForObject(long oid)
Get the list of notes attached to a specific object id.

Returns:
Array of object ids that have notes attached.

createPostItNote

public int createPostItNote(java.lang.String noteText,
                            com.tivoli.twg.libs.LongValueSet moids)
Create a post it note for the objects specified.

Parameters:
noteText - The text of the note attached to the objects.
moids - The managed object ids of the systems the note is attached to.

removePostItNote

public void removePostItNote(int noteID,
                             com.tivoli.twg.libs.LongValueSet moids)
Remove the post it note from the specified systems.

Parameters:
noteID - The id of the note to remove from the objects.
moids - The object ids of the systems the note is removed from.

handleCreatePostItRequest

public void handleCreatePostItRequest(com.tivoli.twg.libs.Command cmd)
Command handler for create post it note command

Parameters:
cmd - - command requested

handleRemovePostItRequest

public void handleRemovePostItRequest(com.tivoli.twg.libs.Command cmd)
Command handler for remove post it note command

Parameters:
cmd - - command requested

handleGetPostItListRequest

public void handleGetPostItListRequest(com.tivoli.twg.libs.Command cmd)
Command handler for retrieving the list of all object ids with notes attached.

Parameters:
cmd - - command requested

handleGetPostItNotesForObjectRequest

public void handleGetPostItNotesForObjectRequest(com.tivoli.twg.libs.Command cmd)
Command handler for retrieving the list of all object ids with notes attached.

Parameters:
cmd - - command requested

handleGetPostItNoteTextRequest

public void handleGetPostItNoteTextRequest(com.tivoli.twg.libs.Command cmd)
Command handler for retrieving the text for a specific post it note.

Parameters:
cmd - - command requested