Home  Documentation   Demonstrations   Download

AMICO: Documentation / AMICO Modules / Process Runner

 

Runs a group of programs. As many of AMICO modules are implemented as standalone (Java) applications, it is convenient to have a program that can run at once all the modules that are necessary for some scenario.

How To Run

     java -jar "%AMICO_HOME%/bin/amico-process-runner.jar" [<conf-url>]

 


Configuration File

Configuration file contains a list of processes with command line strings that are used to create processes. Processes are automatically started, after time offset specified in the configuration file. Within command string, you can also use system variables. AMICO process runner accept both the Windows and Unix syntax for systems variables regardless of the system in runs (Windows use a form %VARIABLE_NAME%, while Unix systems use syntax $VARIABLE_NAME).

 

<?xml version="1.0" encoding="UTF-8"?>


<process-runner title="Demo #1" show-gui="yes"

     <!-- Title will be displayed as process runner window caption -->


    
<!-- id attributed is important if you control the process runner thorugh its API. -->

     <!-- auto-start - defines if the process will be started as soon as process runner starts,
           or that will be done manually or thought API. A default value is true. -->

     <!-- timeOffsetMs - used if auto-start is true. Starts process after given milliseconds value. Default value is 0.-->

    <process id="communicator" auto-start="true" title="The Communicator" description="Core communication engine.">
          java -jar "%AMICO_HOME%/bin/amico.jar" file:conf/communicator/config.xml

    </process>

    <process id="rfid-reader" auto-start="true" timeOffsetMs="2000" title="RFID Reader" description="Reads RFID tags.">

             java -jar "%AMICO_HOME%\modules\rfid-reader\sensors-rfid.jar" COM5 localhost 3311 user-id 32 16 24

    </process>

    <process id="face-detector" auto-start="false" title="Face Detection Sensor" description="Face detector">

            "%AMICO_HOME%modules\vision\face-detection\facedetection.exe"
                 --cascade="%AMICO_HOME%\modules\vision\face-detection\haarcascade_frontalface_alt_tree.xml"
                 0

    </process>

</process-runner>


User interface

Process runner creates a simple graphical interfaces. It also included a tabbed representation of consoles where each process has a separate tab, with text area where console output of the processes is written, and with buttons for starting and stopping the processes. NOTE: This interface appears only if you set attribute show-gui="yes" in the main configuration file.

 

 


XML-RPC Application Programmers Interfaces (API)

Process runner exposes a XML-RPC interface with the following methods:

 

Return type Method name Argument(s) Description
string startProcess string processId Starts a process with a specified ID (ID is define within the configuration file of the process runner). Always returns an empty string*.
string killProcess string processId Kills a process with a specified ID (ID is define within the configuration file of the process runner). Always returns an empty string*.
string restartProcess string processId Restarts a process with a specified ID (ID is define within the configuration file of the process runner). It kills the process first, and that starts it again. Always returns an empty string*.
string restartProcess string processId,

int pauseMs

The same as the previous command, but enable waiting between killing and restarting.
string getProcessStatus string processId Return the status of the process with a specified ID (ID is define within the configuration file of the process runner).
string exit   Kills all running processes and stops the process runner.


* AS XML-RPC does not support function with void return type, startProcess, killProcess, restartProcess, and exit are defined with as string type, but they always return an empty string.

Example of using XML-RPC from other programs

 

This is simple Java program that call startProcess method using Apache Java XML-RPC library. You can also use AMICO XML-RPC interface to control the process runner.

 

import java.util.Vector;
import org.apache.xmlrpc.*;

 

public class XmlRpcTest {   

    public static void main( String args[] ) {
        try {
            XmlRpcClient xmlrpc = new XmlRpcClient ( "http://localhost:3097/RPC2" );

            Vector params = new Vector ();
            params.addElement( "communicator" );

            xmlrpc.execute( "amico_processes.startProcess", params );
        } catch (Exception e) {

            e.printStackTrace();
        }

    }

}

 

 

Validation Logos