Skip to content
Snippets Groups Projects
usage.md 3.06 KiB
Newer Older
# Usage

NB: JRE 17 must be used to run the program.

## CLI

The command line interface is internationalized: messages are available in French or English.

```
AgroMetInfo-SEASON-handler [-hV] [--verbose] --config=<PATH>

Description:
Log directory can be configured using the environment variable AGROMETINFO_LOGS. Default value: logs/.

      --config=<PATH>   Configuration file (.properties file)
  -h, --help            Show this help message and exit.
  -V, --version         Print version information and exit.
      --verbose         Verbose mode

Exit codes:
   0   Successful program execution. (notice leading space ' ')
  64   Usage error: user input for the command was incorrect.
```

Default usage is:

```sh
$JAVA_HOME/bin/java -jar target/season-handler-0.1-SNAPSHOT.jar --config src/test/resources/config-good-with-stages.properties
```

## Configuration file

The configuration file use the [`.properties`](https://fr.wikipedia.org/wiki/.properties#Format) format.

A valid example is available in the test sources at `src/test/resources/config-good-with-stages.properties`:

```properties
## AgroMetInfo-SEASON-handler configuration

simulation.path.0 = src/test/resources/simulation-good-with-stages.properties

## JMS configuration

# Set the InitialContextFactory class to use
java.naming.factory.initial = org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory

# Use the following property to configure the default connector
# ActiveMQ
java.naming.provider.url = tcp://localhost:61616?reconnectAttempts=-1

queue.newSafranDataQueueLookup = agrometinfo-new-safran-data
queue.treatmentQueueLookup = treatment
topic.simulationDoneTopicLookup = simulation-done

## Same as in running SEASON-cli.

season.results.table.owner = season
season.results.table.reader = season-read

## Persistence unit "simulation"

simulation.javax.persistence.jdbc.driver = org.postgresql.Driver
simulation.javax.persistence.jdbc.url = jdbc:postgresql://localhost/season?ApplicationName=season-cli-simulation-dev
simulation.javax.persistence.jdbc.user = season
simulation.javax.persistence.jdbc.password = season
simulation.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
simulation.hibernate.show_sql = false
# Configuring Connection Pool
simulation.hibernate.connection.provider_class=org.hibernate.hikaricp.internal.HikariCPConnectionProvider
simulation.hibernate.hikari.minimumIdle = 2
simulation.hibernate.hikari.maximumPoolSize = 5
simulation.hibernate.hikari.idleTimeout = 30000
#
simulation.results.role.owner = season
simulation.results.role.reader = season-reader
```

### SEASON simulations

To change the SEASON simulation to run each time a new SAFRAN integration is done, simply change the path `simulation.path.0`.

To add a second SEASON simulation, add a new path with `simulation.path.1`, and so on for other simulations.

The SEASON simulation format is described in the SEASON sources at `src/site/markdown/simulationproperties.md`.

### Runtime configuration

The other lines are for the configuration of JMS, JDBC and SEASON database roles.
This configuration must be adapted to the environment.