com.tivoli.twg.engine
Class TWGRemoteJobManager

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGRemoteJobManager
All Implemented Interfaces:
TWGRemoteJobListener

public class TWGRemoteJobManager
extends java.lang.Object
implements TWGRemoteJobListener

This class handle's the console's side of the ServiceNode for communications related to the TWGScheduler and related objects like TWGJob, TWGJobActivation, and TWGTimeTrigger objects. The static calls into this class cause commands to be sent to the server to create, delete and manipulate objects. The creations, deletions and updates are sent back as asynchronous commands that results in update calls to a listener interface. This "shadowing" mechanism allows any changes to be reflected on all active consoles.


Field Summary
static int RETURN_GENERAL_FAILURE
           
static int RETURN_INVALID_ACTIVATION_ID
           
static int RETURN_INVALID_FILTER_ID
           
static int RETURN_INVALID_JOB_ID
           
static int RETURN_INVALID_MANAGED_OBJECT_ID
           
static int RETURN_INVALID_TRIGGER_ID
           
static int RETURN_OK
           
 
Method Summary
static int activateJob(long joid)
          This method activates a TWGJob on the server causing it to create a new TWGJobActivation.
static int activateJob(long joid, LongValueSet moidSet, LongValueSet foidSet)
          This method activates a TWGJob on the server on a specified set of targets causing a new TWGJobActivation to be created.
static int activateJob(long joid, LongValueSet moidSet, LongValueSet foidSet, byte[] jobActData)
          This method activates a TWGJob on the server on a specified set of targets causing a new TWGJobActivation to be created.
static long addDependantJob(long firstjoid, long dependantjoid)
           
static void addListener(TWGRemoteJobListener listener)
          Add a listener to the list of listeners
static long addtotzvector(long joid, long tzoffset, long moid)
          This method adds the timezone and moid to jobs vector
static long attachJobToTrigger(long joid, long troid)
          This method attaches a job to a trigger.
static long attachJobToTrigger(com.tivoli.twg.engine.TWGRemoteJob job, com.tivoli.twg.engine.TWGRemoteTrigger trigger)
          This method attaches a job to a trigger.
static long cancelJobActivation(long joid)
          This method cancels the active TWGJobActivation on the specified job if one exists.
static long changeTriggerStartDate(long troid, java.util.Date sd)
          This method modifys a TWGTimeTrigger on the server.
static long createJob(java.lang.String label, long toid, java.lang.String subtaskID, LongValueSet moidSet, LongValueSet foidSet, int flags, int maxActs, int maxDays)
          This method creates a TWGJob on the server.
static long createJob(java.lang.String label, long toid, java.lang.String subtaskID, LongValueSet moidSet, LongValueSet foidSet, int flags, int maxActs, int maxDays, byte[] jobActData)
          This method creates a TWGJob on the server.
static long createJob(java.lang.String label, TWGSubtask subtask, LongValueSet moidSet, LongValueSet foidSet, int flags, int maxActs, int maxDays)
          This method creates a TWGJob on the server.
static long createJob(java.lang.String label, TWGSubtask subtask, LongValueSet moidSet, LongValueSet foidSet, int flags, int maxActs, int maxDays, byte[] jobActData)
          This method creates a TWGJob on the server.
static long createJob(java.lang.String label, java.util.Vector subtasks, LongValueSet moidSet, LongValueSet foidSet, int flags, int maxActs, int maxDays)
          This method creates a Multitask Job on the server.
static long createJob(java.lang.String label, java.util.Vector subtasks, LongValueSet moidSet, LongValueSet foidSet, int flags, int maxActs, int maxDays, byte[] jobActData)
          This method creates a Multitask Job on the server.
static long createTrigger(java.lang.String label, byte[] triggerData)
          This method creates a TWGTimeTrigger on the server.
static long deleteJob(long joid)
          This method deletes a TWGJob from the server.
static long deleteJobActivation(long joid, int jactoid)
          This method deletes a TWGJObActivation on the server.
static long deleteTrigger(long troid)
          This method deletes a TWGTimeTrigger on the server.
static long detachJobFromTrigger(long joid, long troid)
          This method detaches a job from a trigger.
static long detachJobFromTrigger(com.tivoli.twg.engine.TWGRemoteJob job, com.tivoli.twg.engine.TWGRemoteTrigger trigger)
          This method detaches a job from a trigger.
static com.tivoli.twg.engine.TWGRemoteJob getJob(long joid)
          This method fetches a job.
static java.util.Date getServerDate()
          This method returns the current data from the server
static java.util.TimeZone getTimeZone()
          This method returns a TimeZone for the server.
static int getTimeZone(int moid)
          This method returns a TimeZone for the moid.
static int getTimeZoneOffset()
          This method returns the time zone offset for the server.
static java.util.Date[] getTriggerDates(long troid, java.util.Date startDate, java.util.Date endDate, int max)
          This method is public for implementation purposes.
static long initialize()
          This method initializes the remote job manager so that it is ready exchange job related commands with the server using the console's ServiceNode.
static long initialize(ServiceNode sn)
          This method initializes the remote job manager so that it is ready exchange job related commands with the server using the specified ServiceNode.
 void jobActivationClientUpdated(TWGRemoteJobActivation act, long moid, int status)
          This method is public for implementation purposes.
 void jobActivationCreated(TWGRemoteJobActivation act)
          This method is public for implementation purposes.
 void jobActivationDeleted(TWGRemoteJobActivation act)
          This method is public for implementation purposes.
 void jobActivationUpdated(TWGRemoteJobActivation act, int status)
          This method is public for implementation purposes.
 void jobAttachedToTrigger(long joid, long troid)
          This method is public for implementation purposes.
 void jobCreated(com.tivoli.twg.engine.TWGRemoteJob job)
          This method is public for implementation purposes.
 void jobDeleted(long joid)
          This method is public for implementation purposes.
 void jobDetachedFromTrigger(long joid, long troid)
          This method is public for implementation purposes.
 void jobEnabled(com.tivoli.twg.engine.TWGRemoteJob job, boolean flag)
          This method is public for implementation purposes.
 void jobRenamed(com.tivoli.twg.engine.TWGRemoteJob job, java.lang.String label)
          This method is public for implementation purposes.
static long reexecute(long joid, LongValueSet moids)
           
static long removeDependantJob(long firstjoid, long dependantjoid)
           
static void removeListener(TWGRemoteJobListener listener)
          Remove a listener from the list of listeners
static long renameJob(long joid, java.lang.String name)
          This method renames a job.
static long renameJob(com.tivoli.twg.engine.TWGRemoteJob job, java.lang.String name)
          This method renames a job.
static IntValueSet resolveFilter(long filterid)
          This method returns a LVS containing the moids for filter
static long setJobEnabled(long joid, boolean flag)
          This method enables/disables a job.
static long setJobEnabled(com.tivoli.twg.engine.TWGRemoteJob job, boolean flag)
          This method enables/disables a job.
static void terminate()
          This method terminates the remote job manager so that no more job related commands will be exchanged with the server.
 void triggerCreated(com.tivoli.twg.engine.TWGRemoteTrigger trigger)
          This method is public for implementation purposes.
 void triggerDeleted(long troid)
          This method is public for implementation purposes.
 void triggerUpdated(com.tivoli.twg.engine.TWGRemoteTrigger trigger)
          This method is public for implementation purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RETURN_OK

public static final int RETURN_OK
See Also:
Constant Field Values

RETURN_GENERAL_FAILURE

public static final int RETURN_GENERAL_FAILURE
See Also:
Constant Field Values

RETURN_INVALID_TRIGGER_ID

public static final int RETURN_INVALID_TRIGGER_ID
See Also:
Constant Field Values

RETURN_INVALID_JOB_ID

public static final int RETURN_INVALID_JOB_ID
See Also:
Constant Field Values

RETURN_INVALID_ACTIVATION_ID

public static final int RETURN_INVALID_ACTIVATION_ID
See Also:
Constant Field Values

RETURN_INVALID_FILTER_ID

public static final int RETURN_INVALID_FILTER_ID
See Also:
Constant Field Values

RETURN_INVALID_MANAGED_OBJECT_ID

public static final int RETURN_INVALID_MANAGED_OBJECT_ID
See Also:
Constant Field Values
Method Detail

initialize

public static final long initialize()
This method initializes the remote job manager so that it is ready exchange job related commands with the server using the console's ServiceNode.


initialize

public static final long initialize(ServiceNode sn)
This method initializes the remote job manager so that it is ready exchange job related commands with the server using the specified ServiceNode.

Parameters:
sn - the ServiceNode to use to communicate with the server

addListener

public static final void addListener(TWGRemoteJobListener listener)
Add a listener to the list of listeners

Parameters:
listener - the TWGRemoteJobListener to add

removeListener

public static final void removeListener(TWGRemoteJobListener listener)
Remove a listener from the list of listeners

Parameters:
listener - the TWGRemoteJobListener to remove

getServerDate

public static final java.util.Date getServerDate()
This method returns the current data from the server


terminate

public static final void terminate()
This method terminates the remote job manager so that no more job related commands will be exchanged with the server.


createTrigger

public static long createTrigger(java.lang.String label,
                                 byte[] triggerData)
This method creates a TWGTimeTrigger on the server.

Parameters:
label - The name of the trigger
triggerData - the byte array retrieved from a RepeatDialog via its getBytes() method.
Returns:
long ID of new trigger or 0 if failure This method is public for implementation purposes. It should not be called directly.

changeTriggerStartDate

public static long changeTriggerStartDate(long troid,
                                          java.util.Date sd)
This method modifys a TWGTimeTrigger on the server.

Parameters:
troid - The id of the trigger
Returns:
long ID of new trigger or 0 if failure

deleteTrigger

public static long deleteTrigger(long troid)
This method deletes a TWGTimeTrigger on the server.

Parameters:
troid - the object ID of the trigger to delete.
Returns:
long return code This method is public for implementation purposes. It should not be called directly.

reexecute

public static long reexecute(long joid,
                             LongValueSet moids)

addDependantJob

public static long addDependantJob(long firstjoid,
                                   long dependantjoid)

removeDependantJob

public static long removeDependantJob(long firstjoid,
                                      long dependantjoid)

createJob

public static long createJob(java.lang.String label,
                             TWGSubtask subtask,
                             LongValueSet moidSet,
                             LongValueSet foidSet,
                             int flags,
                             int maxActs,
                             int maxDays)
This method creates a TWGJob on the server.

Parameters:
label - the name if the job
subtask - the TWGSubtask this job will activate
moidSet - the set of managed object IDs specifying the target stations
foidSet - the set of filter IDs specifying the target filters
flags - flags (watch for new stations, etc.)
maxActs - the maximum number of TWGJobActivation objects to keep as history
maxDays - the maximum number of days to keep old TWGJobActivation objects as history
Returns:
long job ID or 0 if failure

createJob

public static long createJob(java.lang.String label,
                             TWGSubtask subtask,
                             LongValueSet moidSet,
                             LongValueSet foidSet,
                             int flags,
                             int maxActs,
                             int maxDays,
                             byte[] jobActData)
This method creates a TWGJob on the server.

Parameters:
label - the name if the job
subtask - the TWGSubtask this job will activate
moidSet - the set of managed object IDs specifying the target stations
foidSet - the set of filter IDs specifying the target filters
flags - flags (watch for new stations, etc.)
maxActs - the maximum number of TWGJobActivation objects to keep as history
maxDays - the maximum number of days to keep old TWGJobActivation objects as history
jobActData - data to be passed to job activations
Returns:
long job ID or 0 if failure

createJob

public static long createJob(java.lang.String label,
                             java.util.Vector subtasks,
                             LongValueSet moidSet,
                             LongValueSet foidSet,
                             int flags,
                             int maxActs,
                             int maxDays)
This method creates a Multitask Job on the server.

Parameters:
label - the name if the job
subtasks - the subtask vector of the subtasks
moidSet - the set of managed object IDs specifying the target stations
foidSet - the set of filter IDs specifying the target filters
flags - flags (watch for new stations, etc.)
maxActs - the maximum number of TWGJobActivation objects to keep as history
maxDays - the maximum number of days to keep old TWGJobActivation objects as history
Returns:
long job ID or 0 if failure

createJob

public static long createJob(java.lang.String label,
                             java.util.Vector subtasks,
                             LongValueSet moidSet,
                             LongValueSet foidSet,
                             int flags,
                             int maxActs,
                             int maxDays,
                             byte[] jobActData)
This method creates a Multitask Job on the server.

Parameters:
label - the name if the job
subtasks - the subtask vector of the subtasks
moidSet - the set of managed object IDs specifying the target stations
foidSet - the set of filter IDs specifying the target filters
flags - flags (watch for new stations, etc.)
maxActs - the maximum number of TWGJobActivation objects to keep as history
maxDays - the maximum number of days to keep old TWGJobActivation objects as history
jobActData - data to be passed to job activations
Returns:
long job ID or 0 if failure

createJob

public static long createJob(java.lang.String label,
                             long toid,
                             java.lang.String subtaskID,
                             LongValueSet moidSet,
                             LongValueSet foidSet,
                             int flags,
                             int maxActs,
                             int maxDays)
This method creates a TWGJob on the server.

Parameters:
label - the name if the job
toid - the object identifier of the task
subtaskID - the subtask identifier of the subtask
moidSet - the set of managed object IDs specifying the target stations
foidSet - the set of filter IDs specifying the target filters
flags - flags (watch for new stations, etc.)
maxActs - the maximum number of TWGJobActivation objects to keep as history
maxDays - the maximum number of days to keep old TWGJobActivation objects as history
Returns:
long job ID or 0 if failure

createJob

public static long createJob(java.lang.String label,
                             long toid,
                             java.lang.String subtaskID,
                             LongValueSet moidSet,
                             LongValueSet foidSet,
                             int flags,
                             int maxActs,
                             int maxDays,
                             byte[] jobActData)
This method creates a TWGJob on the server.

Parameters:
label - the name if the job
toid - the object identifier of the task
subtaskID - the subtask identifier of the subtask
moidSet - the set of managed object IDs specifying the target stations
foidSet - the set of filter IDs specifying the target filters
flags - flags (watch for new stations, etc.)
maxActs - the maximum number of TWGJobActivation objects to keep as history
maxDays - the maximum number of days to keep old TWGJobActivation objects as history
jobActData - data to pass to job activations
Returns:
long job ID or 0 if failure

deleteJob

public static long deleteJob(long joid)
This method deletes a TWGJob from the server.

Parameters:
joid - the object ID of the job to delete.
Returns:
long return code

getTimeZone

public static int getTimeZone(int moid)
This method returns a TimeZone for the moid.

Returns:
int the moid's time zone offset in minutes

getTimeZoneOffset

public static int getTimeZoneOffset()
This method returns the time zone offset for the server. So if daylight savings is enabled, it will adjust GMT.

Returns:
int the servers time zone offset in minutes

getTimeZone

public static java.util.TimeZone getTimeZone()
This method returns a TimeZone for the server. Note: you will have to pass the SERVER's date to the TimeZone class in order to know the offseted server time zone.

Returns:
TimeZone the servers time zone

resolveFilter

public static IntValueSet resolveFilter(long filterid)
This method returns a LVS containing the moids for filter

Parameters:
filterid - the filter id to resolve
Returns:
LongValueSet the requested moids

activateJob

public static int activateJob(long joid)
This method activates a TWGJob on the server causing it to create a new TWGJobActivation.

Parameters:
joid - the object ID of the job to delete.
Returns:
int the ID of the new job activation or zero if failure

activateJob

public static int activateJob(long joid,
                              LongValueSet moidSet,
                              LongValueSet foidSet)
This method activates a TWGJob on the server on a specified set of targets causing a new TWGJobActivation to be created.

Parameters:
joid - the object ID of the job to activate.
moidSet - a LongValueSet of managed object IDs to target or null if none
foidSet - a LongValueSet of filters to target or null if none
Returns:
int the ID of the new job activation or zero if failure

activateJob

public static int activateJob(long joid,
                              LongValueSet moidSet,
                              LongValueSet foidSet,
                              byte[] jobActData)
This method activates a TWGJob on the server on a specified set of targets causing a new TWGJobActivation to be created.

Parameters:
joid - the object ID of the job to activate.
moidSet - a LongValueSet of managed object IDs to target or null if none
foidSet - a LongValueSet of filters to target or null if none
jobActData - a byte[] of data to be associated with the job activation
Returns:
int the ID of the new job activation or zero if failure

cancelJobActivation

public static long cancelJobActivation(long joid)
This method cancels the active TWGJobActivation on the specified job if one exists.

Parameters:
joid - the object ID of the job to cancel the activiation on.
Returns:
long return code

deleteJobActivation

public static long deleteJobActivation(long joid,
                                       int jactoid)
This method deletes a TWGJObActivation on the server.

Parameters:
joid - the object ID of the job to delete an activiation from.
jactoid - the object ID of the job activation.
Returns:
long return code

attachJobToTrigger

public static long attachJobToTrigger(com.tivoli.twg.engine.TWGRemoteJob job,
                                      com.tivoli.twg.engine.TWGRemoteTrigger trigger)
This method attaches a job to a trigger.

Parameters:
job - the job to attach
trigger - the trigger to attach it to
Returns:
long return code This method is public for implementation purposes. It should not be called directly.

addtotzvector

public static long addtotzvector(long joid,
                                 long tzoffset,
                                 long moid)
This method adds the timezone and moid to jobs vector

Parameters:
joid - the ID of the job to edit
tzoffset - the offset for the moid
moid - the moid corresponding to the offset
Returns:
long return code

attachJobToTrigger

public static long attachJobToTrigger(long joid,
                                      long troid)
This method attaches a job to a trigger.

Parameters:
joid - the ID of the job to attach
troid - the ID of the trigger to attach it to
Returns:
long return code This method is public for implementation purposes. It should not be called directly.

detachJobFromTrigger

public static long detachJobFromTrigger(com.tivoli.twg.engine.TWGRemoteJob job,
                                        com.tivoli.twg.engine.TWGRemoteTrigger trigger)
This method detaches a job from a trigger.

Parameters:
job - the job to detach
trigger - the trigger to detach it from
Returns:
long return code This method is public for implementation purposes. It should not be called directly.

detachJobFromTrigger

public static long detachJobFromTrigger(long joid,
                                        long troid)
This method detaches a job from a trigger.

Parameters:
joid - the ID of the job to detach
troid - the ID of the trigger to detach it from
Returns:
long return code This method is public for implementation purposes. It should not be called directly.

renameJob

public static long renameJob(long joid,
                             java.lang.String name)
This method renames a job.

Parameters:
joid - the ID of the job to rename
name - the new name for the job
Returns:
long return code

getJob

public static com.tivoli.twg.engine.TWGRemoteJob getJob(long joid)
This method fetches a job.

Parameters:
joid - the ID of the job to fetch
Returns:
TWGRemoteJob job

renameJob

public static long renameJob(com.tivoli.twg.engine.TWGRemoteJob job,
                             java.lang.String name)
This method renames a job.

Parameters:
job - the job to rename
name - the new name for the job
Returns:
long return code

setJobEnabled

public static long setJobEnabled(long joid,
                                 boolean flag)
This method enables/disables a job.

Parameters:
joid - The ID of the job to enable or disable
flag - true to enable, false do disable

setJobEnabled

public static long setJobEnabled(com.tivoli.twg.engine.TWGRemoteJob job,
                                 boolean flag)
This method enables/disables a job.

Parameters:
job - The job to enable or disable
flag - true to enable, false do disable

getTriggerDates

public static java.util.Date[] getTriggerDates(long troid,
                                               java.util.Date startDate,
                                               java.util.Date endDate,
                                               int max)
This method is public for implementation purposes. It should not be called directly.


triggerCreated

public void triggerCreated(com.tivoli.twg.engine.TWGRemoteTrigger trigger)
This method is public for implementation purposes. It should not be called directly.

Specified by:
triggerCreated in interface TWGRemoteJobListener
Parameters:
trigger - a new TWGRemoteTrigger

triggerUpdated

public void triggerUpdated(com.tivoli.twg.engine.TWGRemoteTrigger trigger)
This method is public for implementation purposes. It should not be called directly.

Specified by:
triggerUpdated in interface TWGRemoteJobListener
Parameters:
trigger - the TWGRemoteTrigger that was updated

triggerDeleted

public void triggerDeleted(long troid)
This method is public for implementation purposes. It should not be called directly.

Specified by:
triggerDeleted in interface TWGRemoteJobListener
Parameters:
troid - the id of the trigger that was deleted.

jobCreated

public void jobCreated(com.tivoli.twg.engine.TWGRemoteJob job)
This method is public for implementation purposes. It should not be called directly.

Specified by:
jobCreated in interface TWGRemoteJobListener
Parameters:
job - a new TWGJob

jobDeleted

public void jobDeleted(long joid)
This method is public for implementation purposes. It should not be called directly.

Specified by:
jobDeleted in interface TWGRemoteJobListener
Parameters:
joid - the id of the job that was deleted.

jobAttachedToTrigger

public void jobAttachedToTrigger(long joid,
                                 long troid)
This method is public for implementation purposes. It should not be called directly.

Specified by:
jobAttachedToTrigger in interface TWGRemoteJobListener
Parameters:
joid - the ID of the job that was attached
troid - the ID of the trigger it was attached to

jobDetachedFromTrigger

public void jobDetachedFromTrigger(long joid,
                                   long troid)
This method is public for implementation purposes. It should not be called directly.

Specified by:
jobDetachedFromTrigger in interface TWGRemoteJobListener
Parameters:
joid - the ID of the job that was detached
troid - the ID of the trigger it was detached from

jobRenamed

public void jobRenamed(com.tivoli.twg.engine.TWGRemoteJob job,
                       java.lang.String label)
This method is public for implementation purposes. It should not be called directly.

Specified by:
jobRenamed in interface TWGRemoteJobListener
Parameters:
job - the job that was renamed
label - new label for the job

jobEnabled

public void jobEnabled(com.tivoli.twg.engine.TWGRemoteJob job,
                       boolean flag)
This method is public for implementation purposes. It should not be called directly.

Specified by:
jobEnabled in interface TWGRemoteJobListener
Parameters:
job - the job that was enabled or disabled
flag - true for enabled, false for disabled

jobActivationCreated

public void jobActivationCreated(TWGRemoteJobActivation act)
This method is public for implementation purposes. It should not be called directly.

Specified by:
jobActivationCreated in interface TWGRemoteJobListener
Parameters:
act - the job activation that was created

jobActivationUpdated

public void jobActivationUpdated(TWGRemoteJobActivation act,
                                 int status)
This method is public for implementation purposes. It should not be called directly.

Specified by:
jobActivationUpdated in interface TWGRemoteJobListener
Parameters:
act - the activation that was updated
status - the new status of the job activation

jobActivationClientUpdated

public void jobActivationClientUpdated(TWGRemoteJobActivation act,
                                       long moid,
                                       int status)
This method is public for implementation purposes. It should not be called directly.

Specified by:
jobActivationClientUpdated in interface TWGRemoteJobListener
Parameters:
act - the activation with the client that was updated
moid - the managed object ID of the updated client
status - the new status of the client

jobActivationDeleted

public void jobActivationDeleted(TWGRemoteJobActivation act)
This method is public for implementation purposes. It should not be called directly.

Specified by:
jobActivationDeleted in interface TWGRemoteJobListener
Parameters:
act - the job activation being deleted