IBM Director is designed to be extendable. In fact, most of the functions delivered with
IBM Director are implemented as extensions.
Extensions enable functions, such as new tasks or new managed objects, to be
added to Director.
Subtopics
Related information
Related sample code
You can extend IBM Director functions by installing a new function into IBM Director's server.
During initialization, the server searches for all the files with the extension TWGExt.
These files are located in x:\Program Files\IBM\Director\Classes\extensions,
where x: is the drive on which the IBM Director Server is installed.
The TWGExt files are treated as Java properties files and should have the following syntax:
label=value
The server reads these files during initialization. The most important property
specifies the fully qualified name of a Java class that must be a subclass
of TWGExtension.
During initialization, the server loads each of the
TWGExtension subclasses
specified by the TWGExt files and creates a single instance.
TWGExtension is
an abstract class that specifies methods that must be implemented. The server calls these
methods consecutively and stages the initialization of each extension. In other words, each
TWGExtension is called at
the first method before any of the extensions are called at the second method.
When the IBM Director Server is initialized, the following actions occur in the order shown:
- IBM Director Server's registry support is initialized.
- IBM Director Server's configuration properties are read.
- RAS service is initialized.
- License keys are loaded.
- IBM Director Server's service node is initialized.
- TWGExt files are loaded and TWGExtension subclasses are instantiated
- DoInitClassRegistration method is called
- Previously-saved persistent objects are restored.
- Database is initialized.
- Default filters and associations are created.
- DoInitClassInstances method is called.
- DoInitCompletion method is called.
- User support is initialized.
- Event router is initialized.
- Task support is initialized.
- Managed object factories are activated.
- Scheduler is initialized.
- Ping cycles are started.
Note: The order shown in the previous list is not guaranteed to be preserved in subsequent releases of IBM Director.
The only sequence that extension implementers should rely on is:
DoInitClassRegistration, persistent object restoration,
DoInitClassInstances, and
DoInitCompletion.
The IBM Director Server activities stop in the following order:
- Ping cycles are stopped.
- Event router is terminated.
- DoTermBegin method is called.
- DoTermComplete method is called.
- Task support is terminated.
TWGExt files
The TWGExt files are treated as Java properties files. The following properties are used by the IBM Director Server:
- twg.extension.classname (Required)
- Specifies the fully-qualified name of the Java class that is a subclass of
TWGExtension. For the file explorer sample, the value of this property is com.BobCo.FileExplorer.BobCoFileExplorerExtension.
- twg.extension.nlsclassname (Optional but Recommended)
- Specifies the fully qualified name of the Java class that is a ResourceBundle containing translatable strings.
For the file explorer sample, the value of this property is com.BobCo.FileExplorer.BobCoResources.
- twg.extension.version (Optional)
- Provides a place to specify a version number.
- twg.extension.name (Optional)
- Provides a place to specify the name of the extension. This can be either a label to retrieve a string from the National Language Support (NLS) property bundle or a literal string value.
- twg.extension.vendor (Optional)
- Provides a place to specify the name of the vendor that implemented the extension. This can be either a label to retrieve a string from the NLS property bundle or a literal string value.
- classpath.append.1 (Optional)
- Specifies the relative or fully-qualified pathname of the JAR file or classes directory
that contains your server extension class files. This name is appended to the server's classpath
when your extension is loaded.
Relative paths are relative to the home directory of the IBM Director
product, as described above for prepends.
- Other
- Other twg.* names are reserved for future standard variables. Extensions can
define other variables with names other than twg.*. Extensions can access these
property values with the
getProperty(String name)
method.
TWGExtension
TWGExtension
has the following methods that can be overridden so that a new extension can be initialized and terminated as part of IBM Director Server:
- InitClassRegistration
- During this method call, an extension should register new TWGPersistentObject
subclasses so that they can be properly saved and restored by IBM Director Server.
This method must be implemented by all TWGExtension implementations.
- InitClassInstances
- During this method call, an extension should instantiate the objects that it needs to
create. As an example, the BobCo file explorer adds its task during this method call.
See Identifying your task to IBM Director at startup for more details.
You can also create other objects required by your server task, such as Server preferences pages at this time.
This method must be implemented by all TWGExtension implementations.
- InitCompletion
- This method call is made as the last step of extension initialization. At this point, any dependencies or relationships between
extensions can be resolved because all extensions have been loaded and instantiated.
- TermBegin and TermComplete
- These methods are called as a two-step extension termination process. During these calls, extensions should clean up termination processing that needs to
be done, such as freeing up resources and saving data that must be saved.