# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#- JASMINe
#- Copyright (C) 2012 Bull S.A.S.
#- Contact: jasmine@ow2.org
#-
#- This library is free software; you can redistribute it and/or
#- modify it under the terms of the GNU Lesser General Public
#- License as published by the Free Software Foundation; either
#- version 2.1 of the License, or any later version.
#-
#- This library is distributed in the hope that it will be useful,
#- but WITHOUT ANY WARRANTY; without even the implied warranty of
#- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.#See the GNU
#- Lesser General Public License for more details.
#-
#- You should have received a copy of the GNU Lesser General Public
#- License along with this library; if not, write to the Free Software
#- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
#- USA
#-
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#- $Id$
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
######################
#  THE DbFill MODULE
######################


The dbfill module implements a command which allows to fill a database with dummy collects.
Collects (or events) can be published
- either by the Mule jprobe_dispatcher component,
- or by the JasmineEventSLBRemote EJB session,
- or by JDBC statements.

Note that a JASMINe Monitoring server must have been launched before to be able to use the dbfill tool,
except JDBC statements are used on a database other than h2 or hsqldb..

DbFill configuration file
-------------------------
The dummy collects are defined in a XML configuration file which looks like:

    <dbfill-config
        xmlns="org.ow2.jasmine.monitoring.jasmine-monitoring-integration-tests-modules:dbfill-config"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="org.ow2.jasmine.monitoring.jasmine-monitoring-integration-tests-modules:dbfill-config
                                  http://jasmine.ow2.org/xsds/dbfill-config-1.1.xsd"

        domain="domain-test" server="jasmine-monitoring" source-name="source-name-test" time-from="2012/01/01 00:00" time-to="2012/01/02 00:00">
        <event probe-id="1" value-name="currentCpuLoad" mbean="java.lang:type=OperatingSystem" period="5" min="0" max="100" delta-neg="5" delta-pos="5" />
        <event probe-id="1" value-name="currentProcessTime" mbean="java.lang:type=OperatingSystem" period="10" min="1000" max="1000000" delta-neg="0" delta="10" />
        .......
    </dbfill-config>

The <dbfill-config> element attributes allows to specify the common fields for all the dummy collects such as the domain, the server.
The time-from and time-to attributes allows to define the minimal and maximal bounds of the timestamps of the collects.

The <event> element attributes allows to specify the fields specific to the event, such its name, its period, ....
The 'min', 'max', 'delta-neg' and 'delta-pos' attributes are used to compute the value of the events.
The following value is the previous value +/- delta and beetween min and max.

Usage
-----

    $ jar [ property ]* -jar ..../dbfill-${VERSION}-jar-with-dependencies.jar

Available properties are:
- -Ddbfill.config=/path/my-configfile.xml allows to specify the dbfill configuration file used.
The default value is the configuration file named 'dbfill-config.xml' in the dbfill jar file,
- -Dpublisher.type=[ejb|mule|jdbc] allows to specify the publisher used.

If the publisher type is ejb
- -Dsmart.factory.host=<host> and -Dsmart.factory.port=<port> allow to specify the Easybeans Smart factory URL.
The default values are "localhost" and "2503" ie "smart://localhost:2503".

If the publisher type is mule
- -Djprobe.dispatcher.host=<host> and -Djprobe.dispatcher.port=<port> allow to specify he Mule jprobe_dispather URI.
The default values are "localhost" and "18564" ie "tcp://localhost:18564/JProbe".

If the publisher type is jdbc
- -Djdbc.url=<url>, -Djdbc.user=<user> and -Djdbc.passwd=<passwd> allow to specify database connection configuration.
The default values are "jdbc:h2:tcp://localhost:19001/db_jonas", "jonas" and "jonas".


Commands examples:
------------------

    $ jar -jar ..../dbfill-${VERSION}-jar-with-dependencies.jar
This command allows
- to publish events defined in the configuration file named 'dbfill-config.xml' in the dbfill jar file,
- via the JasmineEventSLBRemote EJB session using the Easybeans Smart URL "smart://localhost:2503".

    $ jar -Ddbfill.config=/path/my-configfile.xml -jar ..../dbfill-${VERSION}-jar-with-dependencies.jar
This command allows
- to publish events defined in the configuration file named /path/my-configfile.xml,
- via the JasmineEventSLBRemote EJB session using the Easybeans Smart URL "smart://localhost:2503".

   $ jar -Dpublisher.type=mule -Ddbfill.config=/path/my-configfile.xml -jar ..../dbfill-${VERSION}-jar-with-dependencies.jar
This command allows
- to publish events defined in the configuration file named /path/my-configfile.xml,
- via the Mule jprobe_dispatcher component using the URI tcp://localhost:18564/JProbe.

   $ jar -Dpublisher.type=jdbc -Djdbc.url=jdbc:postgresql://localhost:5432/db_jonas -Djdbc.user=jonas -Dpasswd=jonas -Ddbfill.config=/path/my-configfile.xml -jar ..../dbfill-${VERSION}-jar-with-dependencies.jar
This command allows
- to publish events defined in the configuration file named /path/my-configfile.xml,
- via JDBC statements with the database connection configuration specified via jdbc.url, jdbc.user and jdbc.passwd


Logs
----
There is two configuration fles for logs.
One for Mule, named log4j.properties, and present in the dbfill jar. The Mule log file is $HOME/jasmine-monitoring-dbfill-mule.log.
One for the dbfill command named logging.properties. You can use another one by using the java.util.logging.config.file system property.



