The CLI Beans incorporated in this package can be used in visual builders or user code. CLI Beans simplify the process of using data in applications, by implementing standard approaches to properties and events as per the Beans model. Subtle differences in builders exist and may require extra work to get around differences or limitations of builders. This section explains the CLI Beans components that are available with the package. Following Bean components are discussed below:
The CLI Browser can be integrated into a management application to provide browsing and related functions. This class provides the UI for sending CLI commands and receiving responses. This class makes use of CLI APIs to create a dedicated CLI Session and send Asynchronous CLI commands to network device.
The CLIBrowser Bean comprises a toolbar and a menu bar and there is a provision to add any additional buttons or menu items depending upon the requirements of an application. It provides methods to load XML files. The loaded XML files are parsed and displayed as a tree in left hand side pane. Selection of any node displays the input message and also the information about that node. After choosing the message, it can be sent to the device to which a connection is established. The responses are displayed in the Response text block. The UI components contained here also help in setting up various login parameters
To use the CLIBrowser Bean for an application, call the following frame instance.
CLIBrowser browser = new CLIBrowser(javax.swing.JFrame frame);
By default, CLIBrowser load a file into the tree. In case you want to load any file, use this browser instance for loading the XML file as well as the data file.
CLIBrowser browser = new CLIBrowser(java.lang.String fname);
Here fname is the command set file.
CLIBrowser browser = new CLIBrowser( java.lang.String cmdSet ,
javax.swing.JFrame frame );
Where the cmdSet and dataSet are the command set and data set files to be loaded.
Menu bar and Menu Items can be added to the browser panel by using the methods createMenu() and createMenuItem().
JMenu createMenu(String text,char mnemonic,
Here text is the name of the menu and mnemonic is the keyboard shortcut to the menu. sImage is the image icon for the menu.
JMenuItem createMenuItem( String sText, char mnemonic,
String actionCommand );
Here sText is the name of the menu item and mnemonic is the keyboard shortcut to the menu item. sImage is the image icon for the menu item. lis is the ActionListener instance for the menu item. actionCommand is the ActionCommand string for the menu item.
This package contains the Beans component for the CLI Tree, which is a tree representation of the CLI message file where the message file is converted to tree format for easy access and usage. It contains the CLITree class, which represents the CLI command structure as defined in a Command Set file. The tree along with the Data Set is used to construct the CLI commands. It also contains CLIMutaKbleTreeNodeclass to display the XML files in tree format. Each node in the tree has its details in CLIMutableTreeNode.
To Load the XML file into the CLITree:
String fileName = "../conf/unixcmds.ccs"
String dataFileName = "../conf/unixcmds.dat"
CLITree tree = new CLITree();
Multiple files can be loaded to the tree using loadXmlFile().
String loadedFiles = tree.getXMLFile();
Similarly, unloading an XML file from the Tree is also supported using unloadXmlFile().
There are methods available to find the number of files loaded, to get the selected node in the tree, and to get the root node in the tree, get the command code of a selected leaf. These features provide the developers to build applications rapidly.
Please refer to Java documentation for complete details.