This command
line interface (CLI) example shows how to create a bundle extending the command
line framework. CLI bundle extensions, like other IBM Director extensions, are loaded
at system startup and provide an expanded set of IBM Director functions. The steps to creating a CLI bundle:
1.
Implement the ICliBundle interface
2.
Use the below method signature for all accessible bundle commands:
1.
public int commandName(Locale locale, String[] args, Writer out)
throws Exception
3.
Furnish a help method with the correct method signature as
specified above
The method name
is used as the name of the command and this is not re-definable. When a user executes a command the
corresponding method is invoked where:
1.
Locale locale - is set to
the clients locale
2.
Strings args – command inputs provided by the user
3.
Writer out - output stream back to the client command shell
This particular
command line interface example implements two main functional commands. The first command displays all the subagents
for a list of specified systems while the second command verifies a set of
specified server nodes. An additional
two methods/commands are provided to display help and show syntax.
Also note that a
TWGExtension class is needed to load the bundle at startup. The class CliSampleExtension performs this
task.
To run this
sample, a user with DirSuper access must exist. Once a user has been created, enter
dircmd at the command prompt and
follow the instructions given.