9.2.2.1 JSP : An Overview
9.2.2.2 Using JSP To View MBean Attributes
9.2.2.3 Performing Operations on MBeans
9.2.2.4 Customizing Java Server Pages
9.2.2.5 Registering MBeans at Run Time
9.2.2.6 Deregistering MBeans at Run Time
Java Server Pages (JSP) technology enables rapid development of web-based applications that are platform independent. Java Server Pages technology separates the user interface from content generation enabling designers to change the overall page layout without
altering the underlying dynamic content.
Java Server Pages technology uses XML-like tags that encapsulate the logic that generates the content for the page. The AdventNet HTML Adaptor exposes agent information in the form of HTML pages served by JSP. These pages are generated at run time by the HTML Adaptor.
9.2.2.2 Using JSP To View MBean Attributes
Information regarding all the MBeans registered with the MBean server of the Multi-Protocol agent can be viewed through the Java Server pages. Follow the steps below to view the MBean attributes:
Ensure the agent is running at the required port.
Enter the URL http://<agentHost>:<portnumber> in the HTML browser (use https if SSL is enabled).
The HTTP Console Login page is displayed. Specify the User name and password for authentication and select Login. The default User Name is jmx and password is root.
On successful authentication, the JSP Home page is displayed. It has a left side tree view in which all the MBeans are grouped under their respective domains. These are the domain names with which the MBeans are registered in the MBean server. Clicking a domain, the MBeans registered under this domain are listed in the left side tree. When you click a particular MBean, the corresponding MBean information is displayed on the right side frame.
Note : In the URL, agentHost denotes the machine where the agent is running. In case the query is being made from the same machine where the agent is running, localhost can be used as the machine name. Portnumber denotes the port at which the HTML Adaptor is started. A sample URL: http://localhost:8030. If SSL support is enabled for the agent, then the URL to be used is : https://<agentHost>:<portnumber>.
For more information regarding SSL, please refer to the topic "Using SSL for communication through HTML Adaptor" For a scalar MBean, the attributes of the selected MBean are listed in table format with the following information: Attribute Name, Attribute Type, Attribute Access, Attribute Value, and Attribute Description. Values of read-write attributes are presented in editable text field. Inorder to modify these values edit the values and press the Save button.
Attributes of tabular data type are displayed as a table format. New rows can be added using the New Row button at the bottom of the page. The Delete button can be used to delete a row from the table. To delete a row you must first select the row and then press the Delete Modifications can be done by selecting the corresponding row, changing the values in the editable text box and pressing the Save button.
In case the attribute value is of type array, then a link is provided in the attribute value column and on clicking the link the values are listed in a separate page.
9.2.2.3 Performing Operations on MBeans
In addition to viewing MBean attributes, the Java Server pages also allow you to perform operations on MBeans. If operations can be performed on an MBean, then the Operations button is displayed at the right-top corner of the MBean attribute page.
Pressing this button, presents a page with the list of operations. Selecting an operations hyperlink displays the following information pertaining to the MBean operation:
Operation Name: The name of the MBean operation.
Return Type: The data type of the value returned after performing the operation.
Description: Short description about the operation.
Button with the name of the operation.
You can perform an operation by pressing this button. Apart from these, SET operations are provided with text fields to specify the attribute values.
9.2.3.4 Customizing Java Server Pages
The Java Server pages can be customized for the following:
9.2.3.4.1 Customizing number of rows and session time
Follow the steps given below to customize the following :
The number of rows to be displayed per page for tables . The default number of rows displayed per page is 10.
The maximum session time for the application. The default session time is 28800 seconds.
Ensure the agent is running at the required port.
Enter the URL http://<agentHost>:<portnumber> in the HTML browser.
The HTTP Console Login page is displayed. Specify the User name and password for authentication and select Login. The default User Name is jmx and password is root.
On successful authentication, the JSP Home page is displayed. Select Customization Tab from the opening page displayed. This displays the customization screen on the right-frame.
To customize number of rows or session time, modify the respective Attribute value and press the Save button.
9.2.3.4.2 Customizing stylesheets
You can customize the font name, size, color, background color etc displayed in the Java Server pages by modifying the Stylesheet.css file available in <Agent Toolkit Home>/jmxprojects/<projectname>/agent/bin/tomcat/webapps/AdventNetAgentWFC/style directory.
9.2.3.4.3 Editing and Compiling Java Server Pages
The layout of the JavaServlet pages can be modified by editing the corresponding JSP file available in <Agent Toolkit Home>/jmxprojects/<projectname>/agent/bin/tomcat/webapps/AdventNetAgentWFC/jsp directory. For example, to modify the layout of Scalar MBeans, the Scalar.JSP file has to be edited, to modify the layout of Table MBeans, the Table.jsp file has to be edited.
After making the necessary changes, the corresponding JSP file has to be compiled for the changes to get reflected. This can be done by running the CompileJSP.bat/sh file available in <Agent Toolkit Home>/jmxprojects/projectname/agent/bin/tomcat/webapps/AdventNetAgentWFC/bin directory.
In the event of frequent changes to be done to the jsp files it may not be possible to compile the file each and every time the change is made. To overcome this, you can make the necessary changes in the web.xml file available in <AdventNet>\JavaAgent\jmxprojects\<projectname>\agent\bin\tomcat\webapps\AdventNetAgentWCF\WEB-INF directory.
The web.xml file contains the servlet and servlet mapping tags for each jsp file generated. Whenever a request is made, this file is read and based on the mapping the corresponding class file is executed. Hence, you can remove the servlet and servlet mapping tags of the jsp file for which changes are to be made. Now, when a request is made, the tomcat webserver will compile the jsp converted java file and create a new class file.
9.2.3.6 Registering MBeans at Run Time
Java Server pages also allows you to create and register MBeans at agent run time. This feature can be used to add new management interfaces to the Multi-Protocol agent without having to restart the agent. Follow the steps given to create and register MBeans:
Ensure the agent is running at the required port.
Enter the URL http://<agentHost>:<portnumber> in the HTML browser (use https if SSL is enabled).
The HTTP Console Login page is displayed. Specify the User name and password for authentication and select Login. The default User Name is jmx and password is root.
On successful authentication, the JSP Home page is displayed.
Select Register MBean Tab, from the opening page displayed.
Enter the following details:
Domain name
Keys
Class name
XML file name (required only for registering Model MBeans)
Class Loader name (optional)
Press Submit button at the bottom of the page.
Note: If authentication is enabled for HTML Adaptor, access to registering MBeans is available only for Admin users.
Domain Name: This is the Domain under which the MBean has to be registered. Here, you may specify a Domain under which MBeans are already registered or a new Domain. For example, JMImplementation, Adaptors, and Services are some Domain names.
Keys: Each MBean is uniquely identified by its Object name comprised of two parts namely: Domain name and Key/Value pair. Here, the word "Keys" denotes the Key/Value pair of the MBean that has to be registered. Some Examples of Key/Value pairs are:
type=xxx, table=rooidtable. An example for Object name is MyDomain:table=rooidtable.
Class Name: For registering an MBean the corresponding class file name along with its package name has to be specified here. The MBean is registered only if the specified class file is present in the Class path of the Agent. In case you want to register an MBean which is not in the class path of the MBean Server, you have to use the Class Loader option.
XML File Name: This is an optional field and is required only to register a Model MBean. The xml file name with the absolute path has to specified in this field. XML file contains the meta data required to initialize the default values of the Model MBean.
Class Loader: This field is optional. When this field is empty, the default class loader is used to load the MBean class file. The default class loader searches for the class file only in directories specified in the CLASSPATH environment variable. If the class file is not present in the class path, the MBean is not registered. If you want to register an MBean whose class file is located in some other place, for example from a network, you have to specify the Class Loader which can load the class file from its location.
Now, the MBean is registered with the MBean server of the Multi-Protocol agent. Its attributes and operations are also exposed by the HTML Adaptor and they can be accessed using the HTML Client (Web browser).
9.2.3.7 Deregistering an MBean at Run Time
Similar to the Register MBean option explained in the previous section, MBeans that are registered with the MBean server of the Multi-Protocol agent can be deregistered at run time from the HTML client (Web browser). To deregister an MBean that is registered with the MBean server of the Multi-Protocol agent, follow the steps given below:
Select UnRegister MBean Tab from the opening page displayed.
Specify the following details:
Domain name
Keys
Press the Submit button.
Domain Name: This is the Domain under which the MBean is registered in the MBean server of the Multi-Protocol agent. For example, Agent_Sample_Mib, Adaptors, and Services are some Domain names.
Keys: Each MBean is uniquely identified by its Object name comprised of two parts namely: Domain name and Key/Value pair. Here, the word "Keys" denotes the Key/Value pair of the MBean that has to be registered. Some Examples of Key/Value pairs are: type=xxx, table=rooidtable. An example for Object name is MyDomain:table=rooidtable.
This option deregisters the MBean with the Object name specified from the MBean server of the Multi-Protocol agent.
Note: The MBeanServerDelegate registered under the domain name JMImplementation cannot be deregistered.