Copyright (c) 1999, 2000 Silicon Graphics, Inc. All Rights Reserved.

Overview | Basic Concepts | GUI Components | Architecture | How To Write An App

How to Write a Task

Outlined below are the basic steps involved in writing a Task for Rhino. Unless otherwise noted, the code examples below are for a Define User Account Task.

Before proceeding, you should familiarize yourself with Basic Concepts and at least look over the GUI Components, Architecture, and Task Internals documents.

1. Create the Task properties file

The Task properties file is required to exist in the same directory as the Task class. The name of the properties file must be the Task class name followed by "P.properties". For example, a Task subclass named "DefineUserAccountTask" must have a properties file named "DefineUserAccountTaskP.properties".

The Task properties file contains static information about the Task, including the Task title, privilege list, and whether or not the Task accepts operands. The Task properties file also contains User-visible labels and messages, and interface characteristics such as fonts, colors, and sizes.

Below is a sample of what the DefineUserAccountTaskP.properties file might contain. Letters have been used to identify the lines to distinguish them from the Java code examples that follow.

 A: #
 B: # Properties file for the Define User Account Task
 C: #
 D: Task.shortName = Define User Account
 E: Task.longName = Define a new User Account
 F: Task.keywords = define new add user account login home directory shell
 G:
 H: [...]
 I:
 J: #
 K: # DO NOT LOCALIZE BELOW THIS LINE
 L: #
 M: Task.privList0 = addUser
 N: Task.privList1 = listUsers
 O: Task.publicData0 = userName
 P: Task.ProductAttributes0 = com.sgi.psa

2. Implement the Task subclass

The Task subclass is the main entry point to the Task. Its functions are to verify prerequisites, initialize TaskData, coordinate the Task interface(s), and perform the Task operation when the User presses the OK button.

3. Implement the Form subclass

The Form subclass sets up the visible components for the Form interface of a Task, and then binds the components to the appropriate TaskData attributes.

4. Implement the Guide subclass

The Guide subclass is slightly more complicated than the Form interface because the developer breaks the interface into multiple pages, each of which may have its own TaskDataVerifier that gets called when the User presses the Next button to leave that page.

Running a Task from the command line

% setenv CLASSPATH \
/usr/sysadm/java/swingall.jar:/usr/sysadm/java/sysadm.jar:{task workarea}

% java com.sgi.sysadm.manager.RunTask {package}.{taskname} [operands]

See the RunTask documentation for a list of available runtime options.

Areas to be covered in a future revision

Integrating Tasks into Other Views

There are two ways that a set of Tasks can be associated with a particular view:
  1. The list of Tasks is hardcoded in the view code or properties file.
  2. The list of Tasks is retrieved from the TaskRegistry, filtered by ItemTester.

Sharing Code Among Multiple Tasks

  1. Subclassing

  2. Libraries

Tips on Asynchronous Programming