OW2 > SOFA2
SOFA2
 
Font size:      

Usage of SOFA 2

Overview

As described in the runtime architecture, the SOFA 2 runtime environment consits of several parts. To launch SOFA 2 application, all these runtime parts have to be executed first. The SOFA 2 archive (see Download) contains directory bin, in which launching scripts reside (there are two variants of each script: script_name.sh for the UNIX-like systems and script_name.bat for Windows systems.

Launching scripts

  • setenv.(sh|bat) contains configuration variables for all other scripts. The default values are suitable for executing all runtime elements on a single machine. The meaning of each varible is described inside the script.
  • sofa-node.(sh|bat) executes the repository, global connector manager, and dock dock registry - all in a single process and on a single machine. If you want to execute them separately, use the following three scripts (and do not use this one).
    • sofa-repository.(sh|bat) executes the repository.
    • sofa-dockregistry.(sh|bat) executes the dock registry. During launching the dock registry, the rmi registry is also launched and is used by other SOFA runtime elements.
    • sofa-conman.(sh|bat) executes the global connector manager.
  • sofa-dock.(sh|bat) executes a deployment dock. As a parameter, the script takes a name of the dock.
  • sofa-launch.(sh|bat) launches a SOFA 2 application. It takes two parameters: the name and version of the launched deployment plan.
  • sofa-shut.(sh|bat) shuts down launched application. It takes one parameter: the component instance ID (the ID is printed by the sofa-launch script or, alternatively, it can be obtained by the sofa-ps script).
  • sofa-ps.(sh|bat) prints out running applications/components. Without parameters, it prints out applications (i.e. top-level components) running in the SOFAnode. With a parameter (any), it prints out all components running in the SOFAnode.
  • sofa-caps.(sh|bat) prints out capabilities of deployment docks. First parameter is the name of the deployment dock. Without parameters, it prints out capabilities of all running deployment docks in a SOFAnode.

Execution order

The recommended order of lauching runtime entities is following:

  1. repository
  2. dock registry
  3. global connector manager
  4. deployment docks (as many as you want, each of them must have unique name)
Then you can launch applications.

Example

The SOFA 2 archive contains in the repository ready-to-run LogDemo application. Its architecture is shown on the following figure.

LogDemo architecture

The repository contains two deployment plans for this application. First one executes all components in the single deployment dock with the name nodeA while second one distributes components over two docks with the names nodeA and nodeB.

To execute the application locally, launch the deployment dock with the name nodeA (after executing all other runtime elements) and then launch the application via command

sofa-launch.(sh|bat) org.objectweb.dsrg.sofa.examples.logdemo.deplplan.Local -v bd34d46cd589a26edc134e30c455a99be00a967a
      
Note
The second parameter (the "ugly" string) of the launching script is the version identifier of the deployment plan.

To execute the application distributely, launch the deployment docks with the name nodeA and nodeB(again after executing all other runtime elements) and then launch the application via command

sofa-launch.(sh|bat) org.objectweb.dsrg.sofa.examples.logdemo.deplplan.Distributed -v 999b4e2a8c57f024722425b103f8f29bdcb4f84b
      

To stop the application, call the sofa-shut.(sh|bat) command with the component instance ID (printed out during launching).

The second example is a more complex version of the LogDemo, which architecture is shown on the following figure.

Hierarchical LogDemo architecture

Again, there are two deployment plans prepared: first one executes all components in the single deployment dock with the name nodeA while second one distributes components over two docks with the names nodeA and nodeB. The application can be launched by commands:

sofa-launch.(sh|bat) org.objectweb.dsrg.sofa.examples.logdemo.deplplan.ComposedLocal -v 668d0bcf54b7dd842aff168ea6593bc5bd577444
sofa-launch.(sh|bat) org.objectweb.dsrg.sofa.examples.logdemo.deplplan.ComposedDistrib -v 683538122196010e002c378b46f2d647087ab652