A LANDP SNA Application Using the LANDP Java Beans
This guide is intended to give you a basic understanding of how to use the
LANDP JavaBeans to create a simple SNA application that enables us to read and send
messages to a SNA Host. The difficulty level of this tutorial is advanced.
We suggest you complete the
LANDP MSRE Bean Tutorial before attempting this one.
Step 1: Creating a new Class
Create a new class for us to develop into our application. The name of the
class will be SNASample, in a package called 'sna'. We shall continue to
use the 'LANDP Beans' project that we created in the
Supervisor Bean tutorial
This class should be a subclass of 'javax.swing.JFrame'.
We need to import 'com.ibm.landp', 'com.ibm.landp.spv' and
'com.ibm.landp.sna', and use the 'com.ibm.landp.sna.LandpSNAConst'
interface. If you can not remember how to do this, refer to the
Supervisor Bean tutorial.
Step 2: Placing LANDP beans onto the workspace.
- Place a Supervisor, RmtReq and SNAServer bean onto the workspace.
Refer to the Supervisor Bean tutorial
if you can not remember how to do this.
- In the component palette, choose the 'Other' category from the drop down list.
- Choose the Variable Bean ('[]').
- Move the cursor onto a free area of the workspace and click the left
button. Add a second variable bean to the workspace. The variable
beans shall be used to represent our SNA Session and SNA Message.
Step 3: Changing the type of the variables to HostMessage and HostSession.
- Right click on the first variable bean.
- Select change type from the pop up menu.
- Enter HostSession into the text field. Click OK.
- Now, right click on this bean again and chose 'change bean name' from the pop up menu.
- Enter HostSession. Click OK. The name displayed under the bean
should now be HostSession. Repeat the above process to change the
type of the second variable bean to HostMessage, and the name to Host Message.
Step 4: Initialising the Beans.
- Open the property sheet for the RmtReq Bean by double clicking the icon.
- For the field labelled 'mode' select 'MODE_OWN_PID'. Then close then property sheet.
- Now right click on the RmtReq bean and select Connect -> this from the pop up menu.
- Move the cursor over the Supervisor bean and single click the left mouse button.
- Select 'Connectable Features -> req'. Then click 'OK'.
- Now right click the RmtReq bean and select Connect -> this from the pop up menu.
- Move the cursor over the SNAServer bean and single click the left mouse button.
- Select Connectable Features -> req then click 'OK'.
- Open the property sheet for the SNAServer bean. In the 'name' field,
enter the name of the SNA session to be used (i.e.SNA## where ## is a session id).
We must now add beans to our JFrame to allow us to read and write data. The following
image shows the template we wish to create.

By using the component palette, place the appropriate beans onto your
JFrame and set the 'text' property of each bean so that it matches the
above template.
Note: If you can not remember how to do this, please
refer to the Supervisor Bean tutorial
where we added beans to a JFrame and set their text properties.
Now we have our Interface set up, we can start making connections
between the visual beans and our LANDP beans.
Step 5: Connecting the WindowOpened Event
Connect the 'windowOpened' event of the JFrame to the 'register()'
method of the RmtReq bean. This is so that we register the application
with the Java Manager when it is run.
- Right click on the title bar of the Application
- Select 'Connect->windowOpened' from the pop up menu.
- Move the cursor over the RmtReq bean and click the left mouse button.
- Select the 'register()' method.
- Right Click on this connection.
- Select 'Connect->Normal Result' from the pop up menu.
- Move the cursor over the Supervisor bean and click the left mouse button.
- Select the 'Connect()' method. These connection ow register with the
Java Manager and connect to the Supervisor when the application is started.
Step 6: Connecting the WindowClosing Event
Connect the 'windowClosing' event of the JFrame to the 'unregister()'
method of the RmtReq bean. This is so that we deregister the application
with the Java Manager when it is closed.
- Right click on the title bar of the Application (where it says "LANDP JavaBeans")
- Select 'Connect->Connectable Features' from the pop up menu.
- Choose the 'windowClosing' event.
- Move the cursor over the RmtReq bean and click the left mouse button.
- Select the 'unregister()' method.
Step 7: Connecting the "Open Session" Button
Connect the 'Action Performed' event of the 'Open Session' button
to the 'openSession()' method of the SNAServer Bean.
- Right click on the 'Open Session' button.
- Select Connect->actionPerformed from the pop up menu.
- Move the cursor over the SNAServer Bean and click the left mouse button.
- Select openSession().
Notice that the line is dashed and incomplete. This is because 'openSession()'
requires parameters and it is not complete until we supply these parameters.
Step 8: Connecting the openSession() Parameters
- Right click on the text field labelled 'Timeout'.
- Select 'Connect->Text' from the pop up menu.
- Move the cursor over the dashed connection. Click the left mouse button.
- Select the 'time' parameter from the pop up menu.
- Right click on the text field labelled 'Session'.
- Select 'Connect->Text' from the pop up menu.
- Move the cursor over the dashed connection. Click the left mouse button.
- Select the 'sessionNumber' parameter from the pop up menu.
The application now has the capability to open a session with a SNA
server. However we also need to be able to close sessions.
Step 9: Connecting the "Close Session" Button
Connect the 'Action Performed' event of the 'Close Session' button to the
'closeSession()' method of the SNAServer Bean.
- Right click on the 'Close Session' button.
- Select Connect->actionPerformed from the pop up menu.
- Move the cursor over the SNAServer Bean and click the left mouse button.
- Select closeSession().
Notice that the line is dashed and incomplete. This is because
'closeSession()' requires parameters and it is not complete until
we supply these parameters.
Step 10: Connecting the closeSession() Parameters
- Right click on the text field labelled 'Session'.
- Select 'Connect->Text' from the pop up menu.
- Move the cursor over the dashed connection. Click the left mouse button.
- Select the 'sessionNumber' parameter from the pop up menu.
Step 11: Connecting the "Get Session" Button
Connect the 'Action Performed' event of the 'Get Session' button to the 'getSession()'
method of the SNAServer Bean.
- Right click on the 'Get Session' button.
- Select Connect->actionPerformed from the pop up menu.
- Move the cursor over the SNAServer Bean and click the left mouse button.
- Select getSession().
Notice that the line is dashed and incomplete. This is because
'getSession()' requires parameters and it is not complete until
we supply these parameters.
Step 12: Connecting the getSession() Parameters
- Right click on the text field labelled 'Session'.
- Select 'Connect->Text' from the pop up menu.
- Move the cursor over the dashed connection. Click the left mouse button.
- Select the 'sessionNumber' parameter from the pop up menu.
When the getSession method is executed, a HostSession object is returned.
As we need to make method calls to this object, the Host Session variable
on the workspace shall act as a place holder for the object.
Next we must connect the 'Normal Result' event of the connection made in step 11 to
the HostSession Variable.
Step 13: Connecting the Normal Result of the getSession() method.
- Right click on the connection made in step 9.
- Select Connect->Normal Result from the pop up menu.
- Move the cursor over the HostSession variable and click the left mouse button.
- Select 'this'.
Now every time the get session button is clicked, the HostSession variable will
represent the required session. We have now completed connections to our SNAServer bean.
We have now completed connections to our SNAServer bean. Your screen should now look
like the following image:

Step 14: Connecting the actionPerformed Event of the "Open LU" Button
Connect the 'actionPerformed' event of the 'Open LU' button to the 'openLU()' method
of the HostSession object.
- Right click on the 'Open LU' button.
- Select Connect->actionPerformed from the pop up menu.
- Move the cursor over the HostSession object and click the left mouse button.
- Select openLU().
Notice that the line is dashed and incomplete. This is because 'openLU()' requires
parameters and it is not complete until we supply these parameters.
Step 15: Connecting the openLU() Parameters
- Right click on the text field labelled 'Timeout'.
- Select 'Connect->Text' from the pop up menu.
- Move the cursor over the dashed connection. Click the left mouse button.
- Select the 'time' parameter from the pop up menu.
- Right click on the text field labelled 'Application'.
- Select 'Connect->Text' from the pop up menu.
- Move the cursor over the dashed connection. Click the left mouse button.
- Select the 'application' parameter from the pop up menu.
- Right click on the JCheckbox named 'Handle BID'.
- Select 'Connect->Selected' from the pop up menu.
- Move the cursor over the dashed connection. Click the left mouse button.
- Select the 'bIDHandleSNA' parameter from the pop up menu.
Step 16: Connecting the actionPerformed Event of the "Close LU" Button
Connect the 'actionPerformed' event of the 'Close LU' button
to the 'closeLU()' method of the HostSession object.
- Right click on the 'Close LU' button.
- Select Connect->actionPerformed from the pop up menu.
- Move the cursor over the HostSession object and click the left mouse button.
- Select closeLU().
Notice that the line is dashed and incomplete. This is because 'closeLU()'
requires parameters and it is not complete until we supply these parameters.
Step 17: Connecting the closeLU() Parameters
- Right click on the text field labelled 'Timeout'.
- Select 'Connect->Text' from the pop up menu.
- Move the cursor over the dashed connection. Click the left mouse button.
- Select the 'time' parameter from the pop up menu.
- Right click on the text field labelled 'Application'.
- Select 'Connect->Text' from the pop up menu.
- Move the cursor over the dashed connection. Click the left mouse button.
- Select the 'application' parameter from the pop up menu.
At this stage, we now have an application that can open a session with a
SNA server, and open an LU-LU connection using this Session.
All that remains is for our application to be able to send and receive
messages to our host application.
Step 18: Connecting the actionPerformed Event of the "Read Host" Button.
Connect the 'actionPerformed' event of the 'Read Host' button to the
'readHost()' method of the HostSession object.
- Right click on the 'Read Host' button.
- Select Connect->actionPerformed from the pop up menu.
- Move the cursor over the HostSession object and click the left mouse button.
- Select readHost().
This method returns a HostMessage object. We shall use the HostMessage
variable to represent this message.
Step 19: Connecting the Normal Result of the readHost() method.
Connect the 'Normal Result' event of the connection made in step 18 to
the HostMessage Variable.
- Right click on the connection made in step 18.
- Select Connect->Normal Result from the pop up menu.
- Move the cursor over the HostMessage variable and click the left mouse button.
- Select 'this'.
The JTextArea labelled Message shall be used to display the result of a
readHost command. To enable this we need to connect the text property
of the HostMessage variable to the text property of the JTextArea.
Step 20: Connecting the HostMessage Text to the JTextArea
To enable this we need to connect the text property of the HostMessage
variable to the text property of the JTextArea.
- Right click on the HostMessage variable.
- Select 'Connect->Connectable Features' from the pop up menu.
- Choose the 'text' property.
- Move the cursor over the JTextArea labelled Message and click the left mouse button.
- Select 'text' from the pop up menu.
All that remains to complete our SNA application is the facility to send a
message to the host application.
Step 21: Connecting the "Send Host" Button
Connect the 'actionPerformed' event of the 'Send Host' button to
the 'HostMessage(String)' method of the HostMessage object.
- Right click on the 'Send Host' button.
- Select Connect->actionPerformed from the pop up menu.
- Move the cursor over the HostMessage object and click the left mouse button.
- Select 'Connect->Connectable Features' from the pop up menu.
- Chose the HostMessage constructor that accepts a string as a parameter.
Notice that the line is dashed and incomplete. This is because
'HostMessage(String)' requires a parameter and it is not complete
until we supply this parameter.
Step 22: Connecting the HostMessage() Parameters.
- Right click on the text field labelled 'Command'.
- Select 'Connect->Text' from the pop up menu.
- Move the cursor over the dashed connection. Click the left mouse button.
- Select the 'message' parameter from the pop up menu.
This connection now constructs a new HostMessage object with the
command specified in the Command text field every time we click send
host. We now want to send this message to the application.
Step 23: Connecting the Normal Result of the sendHost() method.
Connect the 'Normal Result' event of the connection made in step 16 to
the sendHost() method of the HostSession object.
- Right click on the connection made in step 16.
- Select Connect->Normal Result from the pop up menu.
- Move the cursor over the HostMessage variable and click the left mouse button.
- Select 'sendHost()'.
The application is now complete. From the menu bar at the top of the screen,
select Bean->Save Bean to save your work.