================== Statistics Manager ================== Stats manager's goal is to store in database interesting data he can read on xPL network. To know which data should be stored, some XML files are used. Adding new statistics in database ================================= XML files --------- In order Stats Manager to know which data from xPL network to store in database and how to store it, XML files are used. These files are read by statmgr and define which xPL messages to listen and which data in these messages have to be store Folder hierarchy for XML files ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Here is the structure choosen to store xml files : //.xml Example: :: x10/x10.basic.xml computer/sensor.basic.xml Adding a new xml file ^^^^^^^^^^^^^^^^^^^^^ Xml files are provided by plugins. A plugin has to provide a file for each xpl message type. ^ So, several plugins can provide the same xml files. This problem is solved at plugin installation : * plugin installation lists plugin's xml files provided * plugin installation lists statmgr's xml files already installed * if there is a conflict (xml files already exists) : * tell user that there is a conflict * display a diff of the 2 (or more) conflicted files * ask user to choose one file (default : the file already installed) * plugin installation installs xml files and continue his installation Xml file description ^^^^^^^^^^^^^^^^^^^^ A xml file for statmgr defines : * a listener for the xpl schema * a mapping for the listener between xpl schema elements and database .. code-block:: xml .. note:: If xpl-trig and xpl-stat parts are identical, you can use **type="*"** Example for x10/x10.basic: :: Flow ==== To see flow about statistics and events, see :doc:`events page `. Developper notes ================ Stats manager read all xml files. for each files, it create listeners. Each listener will call a callback function that put data in database with good format.