Configuration
There are two main ways of configuring Grid-SAFE:
- Java Properties
- Database structure.
Java Properties
Most of these are set in the service.properties file that is shipped as part of the application war or aar file. However these values can be augmented in various ways:
- Additional properties can be set on the Java command line
- The Properties Database table can be used to set additional properties or to override the defaults. Users with sufficient privileges can edit this table via web forms.
- Properties can be overridden or additional properties set by placing a properties file called deploy-config.properties in the classpath of the application. This mechanism cannot be used to set the configuration parameters used to define the database connection.
- When deployed in tomcat additional configuration parameters can be set in Parameter elements inside the Context element of the application configuration XML file.
<?xml version="1.0" encoding="UTF-8"?> <Context> <Resource name="jdbc/DemoDB" auth="Container" type="javax.sql.DataSource" username="demo" password="demo" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/demo" minEvictableIdleTimeMillis="30000" timeBetweenEvictionRunsMillis="10000" numTestsPerEviction="-1" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" maxActive="20" maxIdle="2"/> <Parameter name="connection.pool" value="jdbc/DemoDB" override="false" /> <Parameter name="logdir" value="/var/demo" override="false" /> <Parameter name="log4j.appender.H.File" value="${logdir}/Demo.log" override=" false" /> <Parameter name="error.email_notify_address" value="example@example.com" overrid e="false" /> </Context>
We recommend this mechanism for setting the database connection parameters as it allows the database credentials to be managed independantly from the grid-SAFE build process.
Database Structure
Some behaviours can be modified by changing the database structure. For example optional accounting properties will only be saved whwere an appropriate database field exists. The database structure can be modified using any of the standard Mysql administration tools. The Grid-SAFE application also provides some built-in functions for modifying the database structure that are available to users with sufficient privileges.
Admin Forms
Grid-SAFE also provides a number of high level administration forms for common operations such as creating new accounting tables. These administration forms should be significantly easier to use than making equivalent changes using the basic configuration options. The majority of these are also available from the command-line.
Common Conventions
There are a number of common conventions used for configuration properties:
- Any property name starting with class. defines a java class. For example most database tables have a handler class that is defined by the class.table-name property. The value of these parameters can either be a canonical java class-name or a classdef alias name.
- Any property of the form classdef.alias-name defines a classdef alias. Alias names can be used as the values of class. parameters. Also only class with defined aliases will appear in the admin form pull-down lists.