SOFA Application example

To demonstrate the viability of the SOFA PROTOTYPE implementation, we provide a simple SOFA application called logdemo. The SOFA implemention user's manual describes in detail the steps for creating a SOFA application, employing this logdemo application as an on-the-fly example. This document provides a brief overview of how to set-up a SOFAnode and start the logdemo application; as a convenience, the full source code of the logdemo application is available below.

The full source code of the logdemo as well as its ready-to-run compiled form is is available in the binary distribution of the SOFA implementation. After successful installation of the distribution, this application is immediately ready to run.

Steps for executing of the logdemo

The commands used in the following text suppose that the bin directories of JDK and the SOFA distribution are included in the PATH environment variable. The executables in the bin directory of the SOFA distribution are written in the Perl; on UNIX-like machines it can be executed directly, on Windows machines it can be executed in the form perl nameOfTheScript argumentsOfTheScript ... - this way is presented in the following examples, it suppose the perl executable in your PATH variable and the bin directory of the SOFA distribution as your current working directory. If you are using the Active Perl distribution for Windows, you can use the program pl2bat to create batch files for launching perl scripts.

  1. Run rmiregistry.

    The rmiregistry is part of the JDK. It starts a remote object registry (for JAVA RMI) on the specified port on the current host. The registry default port is 1099 (the SOFA default configuration assume the port 2000). The rmiregistry command produces no output and is typically run in the background. The rmiregistry must not have the CLASSPATH environment variable set.

    Starting rmiregistry on UNIX-like machines:

    $ unset CLASSPATH
    $ rmiregistry 2000 &
    

    Starting rmiregistry on Windows machines:

    C:\> set CLASSPATH=
    C:\> start rmiregistry 2000
    

  2. Run orbd.

    The orbd is part of the JDK. It is used to enable clients to transparently locate and invoke objects on servers in the CORBA environment. You must provide the port number where the orbd will listen for incoming requests (the SOFA default configuration assume the port 2001). The orbd command produces no output and is typically run in the background.

    Starting orbd on UNIX-like machines:

    $ orbd -ORBInitialPort 2001 &
    

    Starting orbd on Windows machines:

    C:\> start orbd -ORBInitialPort 2001
    

  3. Run TIR.

    TIR (Type Information Repository) is part of the SOFA distribution. TIR serves as a storage for component's specifications. The command tir produce output with information about launching progress.

    Starting TIR on UNIX-like machines:

    $ tir &
    

    Starting TIR on Windows machines:

    C:\> start perl tir
    

  4. Run the deployment dock registry.

    The deployment dock registry is part of the SOFA distribution. It is used to enable locate the SOFA deployment docks. The produced output in the case of successful launching is DeplDockRegistry is running.

    Starting deployment dock registry on UNIX-like machines:

    $ ddockreg &
    

    Starting deployment dock registry on Windows machines:

    C:\> start perl ddockreg
    

  5. Run the deployment dock.

    The deployment dock is part of the SOFA distribution. It is the basic entity of SOFA runtime environment. The produced output in the case of successful launching is DeplDock NameOfDock is registered and running.

    Starting deployment dock on UNIX-like machines:

    $ ddock NameOfDock
    

    Starting deployment dock on Windows machines:

    C:\> perl ddock NameOfDock
    

  6. Generate the specfile for the application.

    On UNIX-like machines:

    $ genspecfile ::CUNI::SOFA::demos::logdemo::logdemo[0.0.1] nameOfGeneratedSpecFile
    

    On Windows machines:

    C:\> perl genspecfile ::CUNI::SOFA::demos::logdemo::logdemo[0.0.1] nameOfGeneratedSpecFile
    

    In the specfile, you can change the middleware used in the connector and/or specify, how the application should be distributed over the deployment docks. For now, do not change anything, i.e. the connector will be local and all components of the application will be launched in the single deployment dock.

    (Examples of specfiles: everything is local, Logger in another dock and RMI connectors.)

    Note: If you set up the components to be launched in several docks, you must run all docks.

  7. Prepare application for launching.

    On UNIX-like machines:

    $ makeAppl nameOfGeneratedSpecFile.ssf
    

    On Windows machines:

    C:\> perl makeAppl nameOfGeneratedSpecFile.ssf
    

    You can see how the connector is generated (meaning of the output).

  8. Run SOFA application (in this case application logdemo).

    The SOFA applications are launched by command lanchAppl, which is part of the SOFA distribution. It takes two arguments: 1st the full name of the application, 2nd name of the deployment dock in which the application should be launched. The command produce output with information about launching progress.

    Launching application on UNIX-like machines:

    $ launchAppl ::CUNI::SOFA::demos::logdemo::logdemo[0.0.1] NameOfDock
    

    Launching application on Windows machines:

    C:\> perl launchAppl ::CUNI::SOFA::demos::logdemo::logdemo[0.0.1] NameOfDock
    

  9. Run the updateTool to show the dynamic update and update the Logger component.

    The updateTool is part of the SOFA distribution. It provides the management interface for initiating the dynamic update.

    Running update tool on UNIX-like machines:

    $ updateTool NameOfDock
    

    Running update tool on Windows machines:

    C:\> perl updateTool NameOfDock
    

    The output of the updateTool:

    > updateTool  NameOfDock
    Obtaining depldock registry...OK
    Obtaining reference to depldock...OK
    Creating connector to depldock...OK
    Choose component for update
    ===========================
    0 ... logger:vishnu1 (::CUNI::SOFA::demos::logdemo::Logger[0.0.1])
    1 ... do nothing
    0
    Choose new component to update
    ==============================
    0 ... ::CUNI::SOFA::demos::logdemo::Logger[0.0.2]
    1 ... ::CUNI::SOFA::demos::logdemo::logdemo[0.0.1]
    2 ... ::CUNI::SOFA::demos::logdemo::Tester[0.0.1]
    3 ... do nothing
    0
    Obtaining and parsing new deployment descriptor...OK
    Updating component...OK
    

  10. Terminate the application

    The SOFA applications could be terminated by killAppl command. The command accepts as the argument the name of the deployment dock, then it prints the running applications and user can choose the application for terminating.

    Terminating application on UNIX-like machines:

    $ killAppl NameOfDock
    

    Terminating application on Windows machines:

    C:\> perl killAppl NameOfDock
    

Full source code of the logdemo application