previous next trail start tutorial home feedback openwings.org

Running the Demo Applications

The demo applications provided with Openwings come as installable jar files.  They can be found in the Openwings home directory (that is, where you installed Openwings--sometimes referred to as <OW_HOME>) under <OW_HOME>/openwings-${VERSION}/demos/.

First, make sure you have started the Openwings core as discussed in the previous section. If everything is configured correctly on your system, an Openwings Explorer window will appear automatically. You may wish to print this page and refer to it as you step through the demonstration.

[Starting the Openwings Core and the Openwings Explorer on Windows]

Running the ow.bat (or ow.csh) script starts the Openwings core. Behind the scenes, the core spawns a running instance of the tomcat web server and the jini reggie lookup service. It also starts a container manager on your platform, which manages Openwings components and the execution of Openwings processes. Finally, the script causes the Openwings Explorer main window to appear.

[The Openwings Explorer]

Select New Tree View from the File menu. The Openwings Explorer will display all Openwings cores currently found to be running on the discoverable network.

[A discovered platform node in a Tree View]

After a few seconds, a node should have appeared with the name of your local platform. This is because you started a container manager on your local platform when you ran ow.bat or ow.csh. If no node appears after waiting several minutes or if you see obvious errors, check the troubleshooting section.

Now expand the node by clicking on the small expansion icon to the left of the platform's name.

[An Expanded Platform Node]

A list will appear showing all of the components currently installed (ignore any Services and MBeans for now; they will be covered later in the tutorial). A component is the unit of deployment in Openwings. Components are simply Jar files that have been packaged in a special way. As a developer of Openwings-aware applications, you will be creating components, installing them, and running them.

The list also contains several process nodes. The Openwings core automatically executes processes for the Openwings install service, the jini reggie lookup service and the web server (openwings-Installer, jini and jakarta-tomcat respectively). You may also see nodes for the Openwings LogAccess and Security processes.

Installing HelloWorld

Next, we'll install some demo components.

The first step is to install the HelloWorld synchronous demo components. There are three components that make up this demo:

  1. HelloWorldProvider_im
  2. HelloWorldUser_im
  3. HelloWorldServiceSync_im

The HelloWorldProvider component provides a service. The HelloWorldUser component uses that service. Finally, HelloWorldServiceSync is the interface component that both Provider and User depend upon. (There is also a component called HelloWorldSimpleUser, but it's not needed for this step.)

Sometimes components are referred to as installable images. To help distinguish these installable images from ordinary Jar files, we append the "_im" suffix to the component name ("im" stands for "image").

Sidebar: More About HelloWorld

The HelloWorld demo application provided with Openwings illustrates inter-component dependency resolution and fail-over to other service providers.

The HelloWorld demo is divided into two parts: synchronous and asynchronous. More information about these two types of communication can be found in the Connector Services section of the Introduction and in the Connector Generation section of the Developing Components trail. In this section we are providing an example so that you can see how simple components work.

The developer of the synchronous HelloWorld demo divided it into four distinct components:

  • HelloWorldServiceSync_im - defines the service contract.
  • HelloWorldProvider_im - implements a HelloWorldServiceSync provider; provides a sequentially numbered "Hello World" message to all users.
  • HelloWorldSimpleUser_im - implements a HelloWorldServiceSync user that will connect to one provider and show one hello world message.
  • HelloWorldUser_im - implements a HelloWorldServiceSync user that will connect to all found providers and display their messages every 10 seconds in a window. This is a more sophisticated version of HelloWorldSimpleUser.

The developer of the asynchronous HelloWorld demo divided it into five components:

  • HelloWorldServiceAsync_im - defines the service contract.
  • HelloWorldPublisher_im- publishes hello world events.
  • HelloWorldSubscriber_im - implements a HelloWorldServiceAsync interface making it available to listen for hello world events.
  • OpenJMSClient_im - the client side of Sun Microsystems's Java Messaging Service.
  • OpenJMSServer_im - the server side of Sun Microsystems's Java Messaging Service.

To begin, right-click on the platform node corresponding to your local platform. From the pop-up menu that appears, select "Install Component..." (On a Macintosh mouse with one button, a control-click simulates a right-click).

[How to Install Components in the Openwings Explorer]

From the dialog that appears, select Browse. Next, a file selection dialog will appear. Navigate to the <OW_HOME>/openwings-${VERSION}/demos/ folder, and select these three files: HelloWorldProvider_im.jar, HelloWorldUser_im.jar, and HelloWorldServiceSync_im.jar. Then click Open.

[Selecting Components to Install]

Finally, click OK to install the components you selected. If the Openwings Explorer shows dialog boxes indicating that the components were successfully installed, click OK to close each of those dialog boxes.

You can verify that the components were successfully installed in two ways. One way is to go to the Openwings home directory on disk, <OW_HOME>, and observe that the new folders listed below were created:

  1. <OW_HOME>/HelloWorldProvider_im-0.1/
  2. <OW_HOME>/HelloWorldUser_im-0.1/
  3. <OW_HOME>/HelloWorldServiceSync_im-0.1/

Each of these folders will contain additional folders and files. The purpose of these files will be covered later.

The other way to verify that the components were successfully installed is to verify that they appear in the list of components in the Openwings Explorer. Two of the three components you added should appear as executable (yellow): HelloWorldProvider_im and HelloWorldUser_im. The remaining component, HelloWorldServiceSync_im, will be non-executable (gray). If you installed all three of the components, and Provider or User still appear gray, then the components could not resolve -- check out the troubleshooting section, particularly the subsections entitled "Installation" and "Execution".

Running HelloWorld

The next step is to run the HelloWorldProvider component and the HelloWorldUser component. Right-click on the component node and select "Run..." from the pop-up menu. In the Run Component dialog box, leave the settings as they are and click Run.

[Running a Component]

Run both the Provider and the User components in this way. If you prefer, you can double-click a component to run it with the default settings instead of using the pop-up menu.

At this point you should see two new process nodes appear in the tree view, one corresponding to HelloWorldProvider and one corresponding to HelloWorldUser. Each time a component is started (executed), a new process will appear here. Notice how each running component has a unique 32-character identifier attached to it. It is possible to run several instances of a component, so this unique identifier is used to differentiate between processes.

The HelloWorldProvider process will run silently in the background.  This process does one thing: it provides a service named HelloWorldServiceSync. When HelloWorldUser runs, it opens a window and displays a message each time a HelloWorldProvider is found or lost. It does this by looking up (using) the service that is being provided by the Provider. The User will receive and display a "Hello World!" message every 10 seconds from each HelloWorldProvider that is running.

[The HelloWorldUser Process presents a User Interface]

To stop a process from running, right-click it's process node in the tree view and select Stop Process. Try stopping the HelloWorldProvider process now. When a dialog appears telling you that the process was successfully stopped, click OK.

[Stopping a Process]

The HelloWorldUser window that appeared earlier should now display a message that the Provider has been lost, since the HelloWorldServiceSync service is no longer being provided.

Now stop the HelloWorldUser process the same way. Alternatively, you can click the exit button in the HelloWorldUser window.

Uninstalling HelloWorld

To uninstall components, first make sure that the components are not running. (Components that are running cannot be uninstalled, but will be marked for eventual uninstall when Openwings is restarted.) Make sure you have stopped both the HelloWorldProvider process and the HelloWorldUser process that you ran in the earlier step.

Now try uninstalling the HelloWorldProvider component by right-clicking on it and selecting "Uninstall Component...". In the dialog that appears, ignore the checkbox and click OK.

[Uninstalling a Component]

If a dialog box appears notifying you that the component was successfully uninstalled, click OK. Uninstall the HelloWorldUser component in the same way. Both components should disappear from the tree view. You can verify that a component was uninstalled by going to the Openwings home directory and observing that the HelloWorldProvider_im-0.1 and HelloWorldUser_im-0.1 folders have been deleted.

Other Demo Applications

The next series of demo applications (Launcher, Image, and HelloWorldAsynchronous) use Openwings Service User Interfaces (Service UIs). Service UIs allows user interfaces to be published along with services. We provide an extensive example in the Service UI Development trail in the Developing Components section of the tutorial.

Launcher. The Launcher demo application listens for services with published Service UIs and allows you to launch them easily. Use the Openwings Explorer to install the Launcher component. It's located here: <OW_HOME>/openwings-${VERSION}/demos/Launcher_im.jar.

The Launcher component is configured to run immediately after installation (For more information about how to do this with your components, see the Developing Components trail).

[The Launcher]

Image. To try the image demo, you'll need to install three components. This demo also needs Launcher to be running in order for its picture to be displayed (see above).

  1. Image_im
  2. ImageService_im
  3. ImageUI_im

The Image Service displays a list of pictures. To see how this service works, click on the Launcher tile labeled "ImageService", and the following window will appear:

The buttons at the top are used to change the picture being displayed. From left to right, they are "beginning", "back", "stop", "next" and "end". To open a playlist, use the button at the top right hand corner with a "V" symbol on it. Click on it you will see a list of three playlists available for viewing:

  • Predator
  • Small Predator
  • Ocean

Click on one of the selections (example: Ocean) and then click on the far left button to start the playlist from the beginning of the list. A series of ocean images will be displayed. The frequency of image display can be determined by using the slider bar at the bottom of the window. Slide the bar to the far left and pictures change quickly. Slide the bar to the right and the picture changes more slowly.

Asynchronous Hello World. There is also an asynchronous version of HelloWorld for you to try. It works very similar to the synchronous version, but it uses OpenJMS to send events. Installable OpenJMS components are included in the demos directory.

  • HelloWorldSubscriber_im - implements the service contract (executable)
  • HelloWorldPublisher_im - publishes the hello world service (executable)
  • HelloWorldServiceAsync_im - defines the service contract
  • OpenJMSServer_im - this is the OpenJMS message server component (executable)
  • OpenJMSClient_im - this component contains classes needed by users of OpenJMS

Once all of these components are installed, the demo can be run. Start the OpenJMSServer (if it's not already running), HelloWorldPublisher, and HelloWorldSubscriber. The HelloWorldSubscriber brings up a window that prints out messages received from the Publisher.

Summary

Feel free to experiment installing, running and uninstalling the demo components. Try starting two or more HelloWorldProviders and observe the results in the window displayed by HelloWorldUser. You should see messages generated by both providers.


The next few sections of this tutorial give further details for all the HelloWorld components. We discuss interfaces as contracts and provide descriptions of the synchronous and asynchronous services you are seeing in this example.

Next: The HelloWorld demos

back to top

Copyright 2003, General Dynamics Decision Systems. All rights reserved.

previous next trail start tutorial home feedback openwings.org