www.ibm.comLANDP Webpage

LANDP Java Beans - Supervisor

Introduction

This tutorial shows you how to use the LANDP JavaBeans to construct a simple supervisor application that executes an 'SI' function call to determine what is loaded in your LANDP Workgroup.

Customising a Suitable LANDP Client

The Supervisor server is present on all LANDP workstations and requires no common definitions. The LANDP Java Manager server will be used in this tutorial, although it is only required if you are running multiple client applications on the same JVM.

Create a workgroup directory in EHCCUS called LDPBEANS, and in it place the LANCONF.SPC file containing the following vectors:

LANCONF  NAME=LDPBEANS,
WSNAMES=JB
LWSCONF NAME=JB,
TYPE=NT,
SERVER=JAVA,
PAR&JAVA=(Y,,,,)

The next step is to validate these configuration files, then distribute the LANDP runtime files. The LANDP distribution stage is described in detail in part 4 of the LANDP Installation and Customization manual

Creating the Java Client Application

First you must create a new class that you develop into your application. Before you begin, make sure you have imported the LANDP Java Beans into the Visual Age environment.

Next place a Supervisor and a RmtReq bean onto the workspace.

Now you must initialise the beans.

Now add three Buttons to our JFrame to issue the LANDP commands.

Now change the text of these buttons to the functions you want to perform.

Our Interface is now complete. Now we need to add connection between the beans so that they perform functions when a button is clicked.

You must create two connections needed to register and unregister the application with the Java Manager. First we shall make the connection that registers with the Java Manager.

Now we shall make a connection that unregisters the application.

You now need to connect the 'actionPerformed' event of the 'Connect' Button to the 'connect' method of the Supervisor Bean.

Next you need to connect the 'actionPerformed' event of the 'System Status' Button to the 'systemStatus()' method of the Supervisor Bean and display the results to Standard Out. This is performed as follows:

We now need to write the method to format the result of the systemStatus call. The following example shows how to format the result into a tabular format and then print to standard out.

The application is now complete. From the menu bar at the top of the screen, select Bean->Save Bean to save your work.

Testing the Application

To test the class you have created you should export it from the Visual Age environment and run it from within the LANDP environment.

The class has now been exported. You also need to copy the LDPBEANS.JAR file from the LANDP install directory into the same location as your jar file.

Use a command prompt to start LANDP, and run the supervisor application with the following command. You need to have the java executable on your path.

java -classpath supervisor.jar;LDPBEANS.JAR supervisor.SPVSample

A window should open on the screen. Press 'Connect' to connect to the Supervisor. Pressing 'System Status' will display the currently running LANDP processes in the command prompt. Press 'Disconnect' and close the window to exit gracefully from the client.

Introduction New to LANDP? Make the most of LANDP Solving LANDP problems Feedback