Creating a parent task


Use the following steps to create a parent task:

  1. Create some folders under the Deploy Folder.
  2. Create and import the images.
  3. Create the task properties file.
  4. Add the label to your resource bundle.
  5. Add the call to TWGDefaultTask.
  6. Verify that the task was created.

Create some folders under the Deploy Folder

Use the File->New menu to create these folders under your "deploy" folder.

When you are finished the project should loook like this:

Create and import the images

You will need a few images which will be displayed on the IBM Director Console will use as icons. GIF files are preferable.

  1. Small - a 16 bit by 16 bit image. GIF files are preferable
  2. Large - a 32 bit by 32 bit image.
  3. medium (for Toolbar) - a 24 bit by 24 bit image.

Use your favorite image editing software to create these images. Then import them into the images folder in you project.

Create the task properties file

Now create the task properties file. Task properties define how IBm Director processes the tasks. Here are some examples of things that you can specify with Task Properties:


Task properties are very powerful and can be complex, but for now, all we need are a few properties to define:

  1. The task title.
  2. The location of the icons for the task

Since this is the higest parent task, it cannot be activated, so we do not need to describe where the code is.

Right click on the folder deploy\classes\com\bobco and select New->File. Create a new file named BobCoParentTask.properties.

Edit the BobCoParentTask.properties file and add these properties

TaskID
This is an identifier for the task. It must be unique so it's a good idea to put a common prefix on all of your taskIDs.
Title
The actual title text will go in the Resource Bundle - enter the key that you will use for the title string.
ResourceBundle
Use the same resource bundle that already exists for your extension. Remember to include the package name in the class name.
Icon.Large, Icon.Large.Selected
The name of a 32 bit by 32 bit image
Icon.Small, Icon.Small.Selected
The name of a 16 bit by 16 bit image
Icon.Toolbar
The name of a 24 bit by 24 bit image


Add the label to your resource bundle

Edit your resource bundle and add the string. Make sure the key for the string matches the Title from the the task properties.

Then you are done, the Resource Bundle will look something like this:


Add the call to TWGDefaultTask

Edit your Extension Class and add the code to create the new TWGDefaultTask. There are two thinks to remember about new TWGDefaultTask.

  1. Tasks are persistent so if they were created on a previous IBM Director Server start, then you do not need to recreate them. Before creating the task you must check to ensure that it does not already exist by looking for the TaskID.
  2. The TWGDefaultTask constructor can throw exceptions which you must catch. It is very important to log a message if you catch an exception. Most of the time an exceptions in Task creation happen during development and you will need to write the exception to the Ras Log

You will need to import some classes as follows:

Below is a view of the completed code:


Verify that the task was created

Start the IBM Director Console and look for the task in the Tasks Pane. Below is a screenshot on the classical IBM Director view.