Before you can use the command-line APIs, you must acquire a CommandManager from a CommandManagerBuilder. The following code example illustrates how to acquire a CommandManager.
public class CommandManagerBuilder {
/**
* Set the directory for the CLI installation directory
*/
public setHomeDirectory(File cliHomeDir){ ... }
/**
* Build a command manager with the properties set in this class
* @throws ConfigurationException incorrect properties
* specified for a valid CommandManager
*/
public CommandManager build() throws ConfigurationException {...}
}
Invoking the build method is an expensive operation. As a result, you should create only one CommandManager from which to execute commands.