Command Line Tools
Some of the features of gridsafe are available as command line tools. These are intended for scripted administrative tasks because database access credentials are required to use the command line tools.
The command line tools are deployed as a single jar file and can be run as follows:
$ java -jar gridsafe-apps.jar -p database.properties Global Options: -U Run with user -h, --help Print usage information and exit -X, --level Specify the debug level -P Specifiy a property value. e.g. -Pprop=val -T, --trace Show stack trace in debug -R Run with role -p, --properties Specify a properties file to load Commands: XMLGenerator- Generates XML formatted records GetProperty- Query Config Properties ReportGenerator- Generates reports UploadUsageRecord- Reads Usage records and inserts them in the database SetProperty- Set configuration properties AdminForms- Admin GUI forms
In the above example database.properties is a java properties files that provides the database access credentials:
db_driver=com.mysql.jdbc.Driver db_username=demo db_password=demo db_name=jdbc:mysql://localhost/demo
Or you can add these properties to the embedded configuration files when building the jar-file.
Individual actions can be invoked by specifying the name of the action (and any arguments) on the command line.
$ java -jar gridsafe-apps.jar -p database.properties SetProperty my-property=my-value $ java -jar gridsafe-apps.jar -p database.properties GetProperty my-property my-value
Additional help can be obtained for each sub-command using the -h flag.
$ java -jar gridsafe-apps.jar -p database.properties -h SetProperty
Some of these commands use functions where the behaviour depends on the permissions of the logged in user. As database login credentials ar needed to use the command line tools access control cannot be enfoced on the command line. However the -U and -R flags can ge used to set the current user and the current roles for example to generate the reports as seen by differnet users.
You can add new commands to this tool by adding a java class that implements the uk.ac.ed.epcc.safe.accounting.apps.Command interface and adding a classdef alias for this class.