|
| |Home | Products | Documents | Downloads | Purchase | Support | Company | Partners | Contact | |
Welcome to EasyEJB! You can peek and poke running EJBs without programming! Your keyboard is necessary only when you want to poke values onto EJBs.
It is recommended that you run your J2EE server and Acelet-Scheduler on the same machine (localhost) for this tutorial. Your screen may or may not be exactly the same with our screen shots, especially when values change.
Please close all other windows before run this tutoral.
By the way, you can press the F1 key to access context sensitive help system
from any window throughout the whole program.
On this tutorial, we will play a simple casino game. Here is the description:
Each time EasyEJB calls the J2EE server, AceletCasinoExample generates a random
number, as the lucky number. EasyEJB shows this number on your screen.
The initial bidding number is -1, so you never win, the game goes for ever.
You can call method setWinningNumber( ) to put a bidding number. When your bidding number equals
the lucky number, you win. EasyEJB
announces your victory on the screen and the game will not generate new
numbers until you give another winning number. Good luck!
Tips: call remote method setNumberOfDigits( ) to set a smaller number,
for example, 2, even 1. It would be much easier to win.
EasyEJB is a tool for inspect your EJBs. See Overview
for more information.
1. Get started
Go to the main menu. Click on Module > EasyEJB > EJB to open the EJB main Panel.
2. You may have many EJBs in your application server. If the classes/stubs of these EJBs are not on the CLASSPATH when you started Acelet-Scheduler, you may get a warning window, depends on which application server you use.
The EJB Panel appears. The EJB Panel lists all available EJBs for PeekPoking.
You may have many EJBs, please select AceletCasinoExmple on the JNDI name combo box. When you change different JNDI name, all other GUI component change automatically accordingly. Let's click on the Create button.
3. The Define EJB Instance Panel appears.
This EJB is a stateless session bean. It has only one home method with no input parameter, so the Input Panel is empty and disabled.
Let's click on the Ok button.
4. We come back to the EJB Panel. Now, there is one instance EJB created, so the EJB instance and Remote method boxes are not empty any more. Let's scroll down the Remote method box and select getResult( ). When a method is selected, the action buttons below the Remote method box will change accordingly. Some methods are not peek-able, so both Add peek and Export peek buttons are disabled.
Note: Some of the remote methods are generated by your application server when the EJB was deployed.
5. Let's click on the Invoke button. It will call the remote method once. A return value window appear showing a random number:

6. Let's click on the Add peek button, so the item will be added on Peek Kaleidoscope Panel for monitoring.
7. The Name Item Panel appears for you to name the item. The default name if the name of the method. Let's click on the Ok button.
8. The Choose PeekPoke Panel appears. The PeekPoke box lists all available panels. We do not have any existing PeekPoke panels, so the box contains only one name <New>. That is not a real name, just indicates to create a new panel. Let's click on the Ok button.
9. We have not given a name for the new PeekPoke yet, so the Name PeekPoke Panel appears. Let's type MyFirstPeek as the name, then click on the Ok button.
10. Now you can see there is a new panel under the EJB Panel. If you drag EJB Panel down a little, you can see the new item is added in the Peek Kaleidoscope Panel. The number is changing! We are monitor a return value of an EJB's method!

11. We want to win this casino game. To win it quickly, we need to change the number of digits of the result number.
Let's scroll down the Remote method and highlight setNumberOfDigits( ). Now, the both Add Peek and Export peek buttons are disabled. this method returns void, so it does not make sense to monitor the return value, so it is not peek-able.

12. Let's click on the Invoke button to manually call this method. Input Parameter Panel appears.
EasyEJB can not get information about the name of the parameters. But it knows the type for each parameter, so the EasyEJB uses the data type as the name for each parameter. The parameter required for setNumberOfDigits( ) is int. Let's type 1 and click on the Ok button.

A message window appears inform us the operation is done.

We can see the number of digits for getResult item on the Peek Kaleidoscope Panel became 1 as the result of our method call.
13. But the lucky number are all positive number. The initial bid number is -1. We have to change the bid number to be a positive one. We may call this method many times later. So we need to add this item to the Poke Panel. Let's highlight setWinningNumber( ) method and click on the Add poke button.

14. It is similar with clicking on Add peek button: Name Item Panel appears.

Click the Ok button. Because there is one input parameter for this method, the Input Parameter Panel appears.

Let's type 5 as our bid number and click on the Ok button to close this panel.
15. The Choose PeekPoke Panel appears asking us to choose a PeekPoke. Remember that we have seen this panel before. We did created a new Peek Kaleidoscope Panel. But that was a peek panel. Now we need a poke panel. The Choose PeekPoke Panel only lists applicable panels, so it is empty. Just as we did before, click on the Ok button to create a new Poke Panel. The Name PeekPoke Panel appears. Let's type in MyFirstPoke and click on the Ok button.

16. We can see part of the MyFirstPoke panel appears under the EJB Panel.
Before we work on that panel, let's click on the Export poke button to export the data to a file. We will use that poke file later for our SuperScheduler or SuperWatchdog tutorial. Or you can Restore it into an open Poke Panel. Let's click on the Export poke button. The Name Item Panel appears. The default name is good, so we click on the Ok button to close this panel. There will be one more panel: the Input Parameter panel for the value of the parameter, just like before, we type in 5 and click on the Ok button.

A file named setWinningNumber.ejbPoke was saved under <Acelet-Scheduler-Home>\peekPoke directory quietly. The base name of it is the item name we specified on the Name Item Panel. The file extension is ejbPoke.
17. We can see the new MyFirstPoke panel. But if you click on it, EasyEJB will not allow you to work on it, because the EJB Panel is a modular dialog: you have to close this panel before you can work on other panels. At this point, we are done with the EJB panel, so let's click on the Ok button to close the EJB Panel.
18. We are on MyFirstPoke panel now. Drag the panel a little lower and more to the right like the screenshot here. We can see our casino game is still going.

Let's highlight setWinningNumber item on MyFirstPoke panel and click on the Invoke button. We are setting the bid number to be 5 as we specified earlier. Within about 30 seconds, we will see the announcement of our victory.

19. The game stopped. Let's edit the poke item so the game can continue. Click on the Edit button on MyFirstPoke panel. The Edit Data Panel appears.

The Info Panel shows information about the item. The Input Panel is similar with the Input Parameter Panel, which we have seen before. Now you have choices for data:
For this tutorial, let's change the value to be 4 and click on the Invoke button, then click on the Cancel button to invoke it with temporary value. You will see the game re-started and we will win as the lucky number becomes 4.
20. Congratulations! you know how to Peek and Poke your EJB now! Enjoy PeekPoke!
If you want to go through this tutorial again, you need to reset the example. We are not going to provide screenshots for you to follow, but just tell you how to do it:
21. Let's learn the Poke Panel more carefully. There are two groups of buttons on the tool bar, separated by a wider space. The first group of buttons is action buttons for individual items. The second group of buttons is for the whole panel. The Add button displays a slim down version of the EJB Panel: you can add items to the current panel only.
There are three panels on the Peek Kaleidoscope Panel. The main panel of it is the Peek Panel. The tool bar is similar with the one on the Poke Panel. You can click on the Time Series tab to see time series chart.

The Pie tab is not applicable for this example. If you have a few items which consist of a logical entity, then the Pie chart will give you a good graphic view.
22. Now, let's explain the potential error and remote methods we mentioned earlier.
When EasyEJB works on EJBs, it needs stubs. Stubs are program objects generated when you compile or deploy your EJBs. If those stubs are not available, EasyEJB can not work on those EJBs. This is why you may get that errors. Some application servers make their stubs downloadable, so you do not need to put them on the CLASSPATH when you start Acelet-Scheduler.
When EasyEJB works on EJBs, it can get information of EJB from either local stub or remote objects. You can define your preference by opening Modules > EasyEJB > Preference:

With the default value EasyEJB gets information from remote object. With this setting, you do not need put your stubs on your local CLASSPATH, if your server automatically download stubs. You will see some generated remote methods. If you check that box, EasyEJB will get information of EJB from local stubs. The stubs must be available on the CLASSPATH. It will be faster. You will not see generated methods.
This is our Super PeekPoke tutorial. You can get more information from EasyEJB.