= Execution Manager Cookbook = This document includes instructions about installing and running the SENSEI Execution Manager. [[PageOutline(2-3,Table of Contents,inline)]] == Introducion == The Execution Manager executes Execution Plans that the SQR created as a result of requests from Resource Users. The requests are either for retrieving information or executing actuation tasks. As the Figure shows, the Execution Manager consists of two logical internal components, the Request Management that executes the Execution Plan and the Request Monitoring that monitors the request execution in case of long-term requests. === Request Management === The Request Management executes short term requests received via the requestInformation operation as well as long term requests received via the requestSubscription or updateSubscription operations. The Request Management will process the requests and in the first case return information received from the Resources and in the second case set up sessions between Resources and Resource Users. === Request Monitoring === The Request Monitoring monitors the availability and reliability of REPs in order to provide a good quality of long term requests. After set up the a long term subscription by the Request Management, the Request Monitoring will set up the needed subscriptions to monitor the intended resources. When the Request Monitoring is notified that a change happened, it will notify the requesting ressource user. [[Image(em.png)]] == Installation == === Requirements === For the Execotion Managet, the following aditional Software is required: * Java JDK or SDK, version 6.0 or higher. (tested with version 1.6.0_20) http://java.sun.com/javase/downloads/widget/jdk6.jsp * MqSQL Server, version 5.0 or higher http://dev.mysql.com/downloads/mysql === Software Download === The Execution Manager and additional needed software packages are available from the following [wiki:ExecutionManager-dwl link]. To ensure the links berween the packages, all the software packsges have to be unpacked into the same directory === MYSQL Setup === After installing mysql a a new database with the name `sensei_em` has to be created. This could be done with an mysql frontend or by executing the following command on the commmand line: {{{ mysql --user YOURMYSQLUSERNAME -p -e"create database sensei_em;" }}} Then add mysql structure as defined in file executionManager/doc/database.sql. This can be done with the command {{{ mysql --user YOURMYSQLUSERNAME -p sensei_em < executionManager/doc/database.sql }}} === Execution Manager Configuration === open the File executionManager/xml/EmConfigs.xml and change the lines {{{ root root }}} according to your mysql settings, and the lines {{{ localhost 8180 }}} according to your preferences, where the REI Interface shall be deployed. == Run the Execution Manager == === Startscripts === For your conveniance, start scripts for the Execution Manager had beed created. For staring the Execution Manager, change to the directory executionManager/scripts and execute the command following command on Linux: {{{ ./runExecutionManager.sh }}} or on Windows: {{{ runExecutionManager.bat }}} === Interfaces === The Execution Manager provides the REI interface on the given IP Adress and Port as defined in the Configuration File. Therefore, the REI interface of the Execution Manager can be accesed on the URL: {{{ http://IP_OF_EM:PORT_OF_EM/subscribe }}} === Example of REI Request === An example of a subscription request with one REP on the REI interface can be seen here. Thix XML Structure is tranmitted via http POST or GET to the REI interface of the execution manager. It can be seen that the Taskplan is embedded in a REI and a Requestsubscription structure. {{{ WKRT_SENSOR 0 0 Room123 http://sensei/Room http://sensei/hasIndoorTemperature 10000.0 true GREATER_THAN 25 http://localhost:8179/notify/input0/SID00 100000 false POST http://localhost:8190/s/temp123 http://localhost:8179/notify/input0/SID00 10000 1 1 25 }}}