|
| |Home | Products | Documents | Downloads | Purchase | Support | Company | Partners | Contact | |
Java EE (Java Enterprise Edition) is the new name for the Java platform. But J2EE (Java 2 Enterprise Edition) is still widely used. In this document J2EE and Java EE are interchangeable.
Table of contents
0. Close all other panels.
1. Get started.
2. The example panel.
3. Open MBean main panel.
4. The Attribute Panel.
5. Add attribute to Peek Panel.
6. Set attribute.
7. Add attribute to Poke Panel.
8. Working on Poke Panel.
9. Edit items on Poke Panel.
10. Export and save poke item.
11. Invoke operation.
12. View Time Series chart.
13. Working on notification.
14. Working on SuperWatchdog.
15. Add new watch item.
16. Set the environment for quick win.
Easy JMX (SuperDashboard) is a tool for JMX. This tutorial will show you how to:
Although EasyJMX has no dependency on other modules, but go through Easy EJB tutorial before going through this tutorial will be helpful. At the end of this tutorial, we will show you how to use a notification of MBean as a trigger of SuperWatchdog. If you are interested in that topic, you should go through SuperWatchdog tutorial before going through this tutorial.
See How to run tutorial for more information.
Let's run the example by clicking from the main menu Modules > EasyJMX > Run Example:

The example panel appears. There is a background program running simulating resource changes for this tutorial. So do not close this panel during the tutorial. The background process also creates an example domain and example MBean. We will see them later in this tutorial.
Now, we want to see the MBean tree. Click from the main menu Modules > EasyJMX > MBean:

The MBean Main Panel appears. This panel has two main parts. The MBean Tree Panel is on the left. The number of branched is quite different from application server to application server. The MBean Parade Panel is on the right. When you click on different branches on the tree, the MBean Parade Panel shows relevant information on different panels.
The following is from jBoss 4.00:
Each root branch is a domain on the tree. No matter which application server you use, there is a default domain, which is shown with a different icon. All MBeans of J2EE standard types are under this default domain.
In this tutorial, we are interested in CasinoExample domain. Let's click on it and expand it. Now, click on Attribute leaf of the tree, the click on Attribute tab on the right panel, so the active panel on the right panel is Attribute Table Panel. Resize Name column, so you can see the full names:

Each line on Attribute Table Panel is an attribute of CasinoExampleMBean. Let's click on NextNumber, so the line will be highlighted as shown on the above graph. Click on Detail button.
The Attribute Panel appears:
The panel on the top is View Panel. It shows information from the server. Here, the value is a random number (this example shows random number). The panel in the middle is Input Panel. The Access is R which means Read only, so the Input Panel is empty.
The button panel is at the bottom. It shows available actions for this attribute. Because the attribute is read only, so Set, Add poke and Export setAttribute buttons are disabled.
5. Add attribute to Peek Panel.
Let's click on Add peek button to add this attribute on the Peek Panel. The first panel appears is Choose Dashboard Panel which asks you to choose a dashboard:
Let's click on the Ok button to create a new dashboard. The Name Dashboard Panel appears asking for a name. Let's type CasinoExample-NextNumber into the field. Then click on the Ok button.
The Name Item Panel appears asking for a name for the attribute:
The default name is good. We do not need to change it, so click on the Ok button.
Now, we come back to the Attribute Panel. We are done with it. Let's click on the Close button and close this panel and back to MBean Main Panel. The new created Peek Panel is behind the MBean Main panel. If you use your mouse to drag the MBean Main Panel down a little, you will see CasinoExample-NextNumber Peek Panel. And the value of the attribute is changing every 5 seconds! What an easy way to monitor an attribute it is!

The NextNumber is too big. It is very difficult to win. So, we need to the attribute NumberOfDigits to a small number. Let's click on NumberOfDigits, so the line is hightlighted. Then click on the Detail button.
The Attribute Panel appears again. But this time it is for attribute NumberOfDigits, whose Access is RW (Read and Write). So the Input Panel is not empty, the buttons on button panel are all enabled.
The Input type is Keyboard by default. We are going to use this type for this tutorial, so no not change it.
Now, we want the number of digits for NextNumber be one. So, type 1 in the Value field and click on the Set button.
Now, click on the Close button to close this panel and go back to the MBean Main Panel. Look at the Peek Panel under the MBean Main Panel. The number of digits becomes 1 now. We successfully set the attribute!
7. Add attribute to Poke Panel.
The initial winning number is -1. But NextNumber is always be positive. To be able to win the game, we need to change winning number to be positive.
Let's click on the WinningNumber and highlighted that line on Attribute Table Panel. Then click on the Detail button. The Attribute Panel appears again. This time it is for the WinningNumber.
Let's type 5 in the Value field. Do not click on Set button. This time we want click on the Add poke button to add the action of set attribute to the Poke Panel, so it is easier to invoke it later.
The Choose Dashboard Panel appears again. Although there is already a dashboard named CasinoExample-NextNumber. But it is for Peek, not relevant for Poke, so it does not appear on the Choose Dashboard Panel.
Let's click on the Ok button. The Name Dashboard Panel appears. Let's type CasinoExample-SetWinningNumber and click on the Ok button.

And, of course, Name Item Panel appears asking for item name. We just simply click on the Ok button to go back to The Attribute Panel. Click on the Close button to close the Attribute Panel, we come back to the MBean Main Panel. If you have dragged the MBean Main Panel low enough, you will see the new created Poke Panel is under the MBean Main Panel.

The MBean Main Panel is a modular dialog. You can not working on other windows without closing it. Let's close it. There are three buttons at the bottom of the panel. Remember is for remembering the state of the tree without closing the panel. Cancel closes the panel without remembering anything. Close is equivalent to Remember plus Cancel.
Let's close this panel by clicking on the Close button.
Let's drag CasinoExample-SetWinningNumber poke panel down a little, so we can see the number on CasinoExample-NextNumber panel.
If you lost a small panel (the small panel goes under a big panel and can not be seen), click on the Window menu on the top menu bar. You can find the lost panel there.
Click on WinningNumber and highlight the line on CasinoExample-SetWinningNumber panel. Then click on the Invoke button.
A small confirmation window appears:
Click on the Yes button and invoke it.
Now, watch the number on CasinoExample-NextNumber. We will win in about 30 seconds. When NextNumber equals the winning number (5), the game stops and we won. This version of CasinoExample, not like the one for EasyEJB, does not announce the winning state, but does emit notification. We will discuss that later in this turorial.
We can re-start the game be giving a new winning number. Now with WinningNumber is highlighted, click on the Edit button.
The Edit SetAttribute Panel appears. The main part of this panel is the Attribute Panel without non-applicable buttons. The extra part is the Item name field at the bottom.
Now, let's change the Value from 5 to 1. Then we have the following choices:
Click on the Ok button, so the new value will be remembered for later use.
Click on the Set button to set the new value immediately.
This time let's click on the Set button to see the immediate result. Click on the Cancel button and go back to CasinoExample-SetWinningNumber panel. Within seconds, we will see the number become 1 (our new winning number) and stay in that value. We have successfully edited an item on the Poke Panel and set it.
10. Export and save poke item.
EasyJMX can work with SuperScheduler and SuperWatchdog to schedule MBean jobs. Let's click on Export setAttribute button to export setAttribute operation to a file, so we can use it as a job for SuperWatchdog later in this turorial.
Now, we are done with Poke. Let's click on the Save button and save it, so we can use it later.
The saved file can be used for SuperScheduler and SuperWatchdog to set an Mbean task or chore as well.
Let's click on the Close button to close this poke panel.
Now, we need to re-open the MBean Main Panel. This time let's click on the Add button on the CasinoExample-NextNumber panel. The action of this button is the same as that from the main menu Modules > EasyJMX > MBean.
The MBean Main Panel appears with the state it remembered, because we closed it by clicking the Close button. Let's click on Operation tree leaf on the left panel. Click reset on the right panel.

Let's click on the Detail button. The Operation Panel appears. The Operation Panel has a similar structure as the Attribute Panel: the View Panel is on the top, the Input Panel is in the center and the button panel is at the bottom. The reset operation does not need any input parameters, so the Input Panel is empty.
Let's click on the Invoke button to invoke this operation. The method reset of CasinoExampleMBean on the server side will be called. The following panel will appear to show the result of the call:

This reset operation returns void, so the return value shown here is null. If an operation returns a real value, the value will be shown here. The Detail button may be enabled if applicable.
Now, you can see the impact of the operation: the number of digits for NextNumber is not 8, as original. We have successfully invoked an operation.
Let's click on the Close button on the Return Value Panel, then click on the Close button on the Operation Panel. We come back to the MBean Main Panel. Click Cancel button to close the MBean Main Panel.
Now we come back to the Peek Panel. We want to see the other side of Peek Panel. Let's click on the Time Series tab.
This example contains only one attribute, so there is only one X-Y chart. But the Peek Panel is capable to host multi attributes. You can add new attribute on the Attribute Panel by clicking on the Add peek button. Or click on the Restore button on the Peek Panel to add pre-saved attributes. That is out of scope of this tutorial.
Note: this example contains only one attribute, so the Pie tab is always 100%. Actually the Pie tab is not applicable for this example.
Now, let's re-open the MBean Main Panel. Click on Notification tree leaf on the left panel. Click on casinoExample.winner on the right panel to highlighted the line.
Than click on the Detail button on the right panel. The Notification Panel appears.
We want to export this notification to a file, so SuperWatchdog can use it as a trigger. Click on casinoExample.winner on the Type box to highlighted it, then click on Export button. The Name Item Panel appears:
Click on the Ok button, the exported file will be saved quietly. The saved directory is:
<acelet-scheduler-home>/dashboard (for Unix)
<acelet-scheduler-home>\dashboard (for Windows)
where <acelet-scheduler-home> is the installed directory (default is acelet-scheduler).
We have collected information for the notification and saved. Click the Close button to close the Notification Panel. Click on the Cancel button to close MBean Main Panel. But leave both CasinoExample-NextNumber panel and CasinoExample panel open.
Let's start SuperWatchdog by clicking on the main menu Modules > SuperWatchdog > Watchdog Doer.
The Watchdog Doer panel appears.
Click on the Add button on Watchdog Doer panel. Type CasinoExample-SetWinningNumber as the name:
Click on the Set job button. The Set Job Panel appears:
Click on MBean to highlight it, then click on the Define button. Browse MBean Panel appears.
Remember we have exported a poke item as WinningNumber at step 10 of this tutorial? The file WinningNumber.mbeanSetAttribute is the file. EasyJMX automatically add an extension for it. Let's highlight this file and click on the Ok button. MBean SetAttribute Panel appears.

The MBean SetAttribute Panel is similar with Edit SetAttribute Panel. The differences are:
Item name is not editable here. Item name is for easy reading only. It does not affect execution. There is no reason to edit it here.
There are not action buttons, which are not applicable for SuperWatchdog.
The Value is 5, as we typed earlier in this tutorial. We do not need to change anything, so just click on the Ok button to close this panel. We come back to the Set Job Panel. Click on the Ok button to close the Set Job Panel. We come back to the Chore Panel now. There is something on Job field indicating a job is set.

Let's click on the Set Trigger button. The Set Trigger Panel appears.

Click on the Browse button. The Browse Notification Panel appears.

Remember we exported a notification at step 13 of this tutorial named "winner"? The file winner.mbeanNotification is the file. EasyJMX added an extension on it automatically. Highlight the item and click on the Ok button. The Notification Panel appears. This Notification Panel is the same as we saw earlier in this tutorial. Nothing needs to be changed here, click on the Ok button and close the Notification Panel. We come back to the Set Trigger Panel. Now there is something on the MBean item field, indicating the notification is set. Let's click on the Ok button and close the Set Trigger Panel. Now, we come back to the Chore Panel. Let's click on the Ok button to close it.
We are on the Watchdog Doer Panel. An watch item is created. Drag the Watchdog Doer Panel a little bit lower, so we can see what is going on on the CasinoExample-NextNumber.

Every thing is done for Watchdog: we have set a job as a setAttribute job for the attribute WinningNumber. We have set a trigger as a notification from the MBean as winner notification. When a luck event happens, we win the casino game. A notification will trigger this watch item. This item will reset the WinningNumber. Even the new WinningNumber is the same as old one, the casino game will restart again.
16. Set the environment for quick win.
You probably still remember that we have invoked operation reset earlier. The number of digits of NextNumber is 8, the WinningNumber is -1. We will never win. We need to set the WinningNumber be a positive number, we need to set the NumberOfDigits be 1 for quick game.
Reopen the MBean Main Panel. Go back to the step 6 and 7 of this tutorial and set above two attribute.
Wait for some seconds, you will see an item on the Activity Panel of the Watchdog Doer Panel. That is a chore activity triggered by winning notification.
17. The end.
We are done with this tutorial for EasyJMX. You can close all panels if you like.