In this tutorial we present how to run two components.
Here we create the Observer design pattern in components.
Create two components names "mycompany.mymodule.observable" and "mycompany.mymodule.observer".
As the CDML are edited, you can build the components by deleting, running the buildST.xml scripts for each project, and finally refresh the two projects.
Add a Bundle dependency to inria.smarttools.componentsmanager and a Package dependency to "javax.swing".
We define one component (Observable) as the PON activator.
Please create and edit a World file into the "mycompany.mymodule.observable" package.
The edit the Activator of Observable.
Go to the "Run..." window, click on Equinox Framework and create a new Runtime.
Set a name
Unset all bundles from Eclipse, and set these bundles : inria.smarttools.componentsmanager, inria.smarttools.ds.local, inria.smarttools.core, inria.smarttools.dynamic and inria.smarttools.lib only.
Click on add required bundles.
Set a level 1 or 2 to Observable, and true to Auto-start.
Set componentsmanager's Auto-start to false.
Remove argument except "-clean" and "-console", but add "-d64" in the VM arguments.
Apply the settings and run.
The PON platform will start and connect two components.
The observable-1 component instance display a Swing view. Put something, and fire a notification.
The observer-1 component instance should receive the notification, and display a message in the console.
You learn how to set up an PON runtime with Equinox, and how to configure the componentsManager with a World file.
Note that you can start the ComponentsManager with a personnalized World with a System Property called "smarttools.worldfile". So you can leave the Observable Activator without loading a World and starting the CM. You will have to start the CM and not the Observable anymore.
Last modified: $Date$