Adding tasks to an extension

IBM Director uses tasks to perform operations on the systems that are being managed and tasks are the most common way to extend IBM Director.

Use these steps to add a task:

  1. Decide what kind of a task you need
  2. Compile and test the task
  3. Adding a task to your extension - the basic steps
  4. Adding tasks to an extension - the details
  5. Debugging the extension

Decide what kind of task you need

Before you add a task, you will need to decide what kind of a task to create.Your choices are:

Interactive not non-interactive tasks

Tasks that present you, the IBM Director user, with an interface (for example, a dialog) are interactive. These tasks must be started by the user, or activated, on the IBM Director console.

Tasks that do not require user input are non-interactive. These tasks can be activated form the IBM Director Console and they can be activated from the IBM Director Scheduler, by Event Actions, or even by the Command Line Interface (CLI).

Targeted and non-targeted tasks

Tasks can be created to be either targeted or non-targeted. Task targets are always Managed Objects. Let's look at some examples.

Example 1: A task called power-off allows an IBM Director user to turn off a specific system. In this case, the target is the system to be turned off. As always the target is a Managed Object.

Example 2: The IBM Director Scheduler GUI allows an IBM Director user to schedule actions to happen at specific times. Because the schedule itself does not apply to any one system, it is non-targeted. The user does not have to select any specific Managed Object to activate this task.

Multitargeted

One of the most significant features of IBM Director is group actions, the abillity to allow a user to easily perform an action on an entire group of managed objects. The user can do this in either of two ways:

  1. By activating the task against a group
  2. By using mulitselect to select several managed objects.

Do you need a parent task?

Parent tasks cannot be activated. They are simply a way of organizing tasks on the IBM Director Console to help limit clutter on the user interface. Below is an example how parent and child tasks appear in the Task Pane of the IBM Director Console:


In IBM Director 5.1, the parent task will also be added to the Toolbar on the IBM Director Console. The child tasks will be displayed as "drop-down" items under the toolbar icon.

If you have more than one task, you should create a parent task and make the rest of your tasks children of that task.

The task compile/test cycle

Every time you change your code, follow the directions for redeploying you extension, but remember: every time you change the properties of a task, you must do a twgreset to remove the old persistent copy of the task.

Basic steps to add a task to your extension

There is a helper class called TWGDefaultTask that will make task creation easier. The only methods that you will ever need to use from TWGDefaultTask are it's constructors. The steps to create a task are these:

  1. Define some properties. These properties will tell TWGDefaultTask abotu how your task should work. The properties are usually put into a Java Properties file, but they can also be put into an instance of a java.util.Properties object.
  2. Create an instance of TWGDefaultTask. Pass the properties file name (or the java.util.Properties object) as a parameter.
  3. Write the code that will execute when the Task is activated. Where you write the code will be different for different types of tasks.