GridRUS Quick Start Guide

Introduction

The quick start document guides you through the steps to deploy an instance of the GridRUS web service as well as inserting and querying usage records. For advance deployment scenario and configuration, please consult the Deployment Guide in the GridRUS Service module.

Installing GridRUS using the OMII Stack Installer

The OMII distribution bundles GridRUS in the Managed Programme component. Please follow the instruction given in the OMII Distribution User Guide Managed Programme section to install GridRUS.

Once you have verified the GridRUS service and client have been setup successfully, you can proceed to the section "Inserting Usage Records" in this guide.

Installing GridRUS from the binary distribution

If you are installing GridRUS separately from the OMII release. You need to follow the instruction given here.

Pre-requisites

The following pre-requisites and the indirect dependencies must be installed and tested prior to installing GridRUS.

  • Open Middleware Infrastructure Institute - Client (3.4.0): Open Middleware Infrastructure Institute - Client (3.4.0) must be installed and tested according to the OMII installation procedure. This is ONLY REQUIRED if you intend to use the GridRUS client tools. The installation directory will be referred to as OMIICLIENT_HOME in this document. The GridRUS tools assume the default to be $HOME/OMIICLIENT unless specified.
  • Open Middleware Infrastructure Institute - Server (3.4.0): Open Middleware Infrastructure Institute - Server (3.4.0) must be installed and tested according to the OMII installation procedure. This is ONLY REQUIRED if you intend to deploy a GridRUS service instance. This will be referred to as OMII_HOME in this document. The GridRUS tools assume this to be /usr/local/OMII unless specified.
  • Apache Ant - 1.6+: Apache Ant (version 1.6 or above) must be installed and available in your PATH in order to install the GridRUS client and server distribution without using the OMII Stack Installer.

Downloading GridRUS

Official GridRUS binary releases can be downloaded here. You can also obtain the continuous build to enjoy the latest bug fixes and cutting-edge features.

Distributions are packaged in .tar.gz and .zip formats. Packages named GridRUS-X.Y.Z-bin-server.[tar.gz] is the server binary distribution, while GridRUS-X.Y.Z-bin-client.[tar.gz|zip] is the client binary distribution. Package named GridRUS-X.Y.Z-src.[tar.gz] contains the source distribution.

To follow the Quick Start Guide, you must download the the server and client distribution

To build a binary release from source code, please consult the Developer Guide for instruction.

Installing the GridRUS service

  1. Please ensure the OMII container is not running.
  2. Place the GridRUS-X.Y.Z-server.[tar.gz|zip] archive in a temporary directory (e.g. /tmp).
  3. Unpack the archive using the GNU tar or the zip command.
    $> cd /tmp
    
    $> tar zxvf gridrus-X.Y-server.tar.gz
    
    or
    
    $> unzip gridrus-X.Y-server.zip
    
    $> ls -l gridrus-server
    drwxr-xr-x    8 wwhl  wwhl       272 May 27 12:26 .
    drwx------   18 wwhl  wwhl       612 May 27 13:10 ..
    -rw-r--r--    1 wwhl  wwhl    100872 May 26 15:01 LICENCE.3RDPARTY.txt
    -rw-r--r--    1 wwhl  wwhl      1531 May 26 15:01 LICENCE.txt
    -rw-r--r--    1 wwhl  wwhl      4274 May 27 12:21 build.xml
    drwxr-xr-x    3 wwhl  wwhl       102 May 26 15:01 config
    drwxr-xr-x   43 wwhl  wwhl      1462 May 27 12:26 docs
    -rw-r--r--    1 wwhl  wwhl  16385683 May 27 12:21 gridrus.war
  4. If you have a previous version of GridRUS service installed, you need to first uninstall it using the command,
    $> ant uninstall -Domii.server.home=${OMII_HOME} 
  5. To install, execute the installation Ant script,
    $> cd gridrus-server
    $> ant install -Domii.server.home=${OMII_HOME} 
  6. Look for the line "BUILD SUCCESSFUL" in the output which indicates the installation has completed successfully.

Installing the GridRUS client

  1. Place the GridRUS-X.Y.Z-client.[tar.gz|zip] archive in a temporary directory (e.g. /tmp).
  2. Unpack the archive using the GNU tar or the zip command.
    $> cd /tmp
    
    $> tar zxvf gridrus-X.Y-client.tar.gz
    
    or
    
    $> unzip gridrus-X.Y-client.zip
    
    $> ls -l gridrus-client
    drwxr-xr-x    9 wwhl  wwhl     306 May 27 12:26 .
    drwx------   18 wwhl  wwhl     612 May 27 13:10 ..
    -rw-r--r--    1 wwhl  wwhl  100872 May 26 15:01 LICENCE.3RDPARTY.txt
    -rw-r--r--    1 wwhl  wwhl    1531 May 26 15:01 LICENCE.txt
    drwxr-xr-x   12 wwhl  wwhl     408 May 27 12:21 bin
    -rw-r--r--    1 wwhl  wwhl    3098 May 27 12:21 build.xml
    drwxr-xr-x    3 wwhl  wwhl     102 May 26 15:01 data
    drwxr-xr-x   43 wwhl  wwhl    1462 May 27 12:26 docs
    drwxr-xr-x   15 wwhl  wwhl     510 May 27 12:21 lib
  3. If you have a previous version of GridRUS client installed, you need to first uninstall it using the command,
    $> ant uninstall -Domii.client.home=${OMIICLIENT_HOME}
  4. To install, execute the installation Ant script,
    $> cd gridrus-client
    $> ant install -Domii.client.home=${OMII_CLIENT_HOME}
  5. Look for the line "BUILD SUCCESSFUL" in the output which indicates the installation has completed successfully.

Running the GridRUS Service

Restart the OMII container after the installation has completed.

$> cd ${OMII_HOME}/jakarta-tomcat-5.0.25/bin
$> ./start_base.sh
Starting up tomcat
Using CATALINA_BASE:   /usr/local/OMII/jakarta-tomcat-5.0.25
Using CATALINA_HOME:   /usr/local/OMII/jakarta-tomcat-5.0.25
Using CATALINA_TMPDIR: /usr/local/OMII/jakarta-tomcat-5.0.25/temp
Using JAVA_HOME:       /usr/local/jdk1.4
Waiting....!....!.... Started.
$>

The default setup uses an embedded XML database based on the eXist framework. Please consult the Deployment Guide for advance configuration instruction.

To verify the GridRUS service is deployed successfully, consult the GridRUS log file $OMII_HOME/jakarta-tomcat-5.0.25/logs/gridrus.log and look for the lines

...
2006-05-23 11:28:45,505 INFO  [ApplicationContextConfigurator] GridRUS machinery initialised
...

The GridRUS service is initialised correctly if there is no ERROR messages originated from the gridrus webapp in the log file.

You may use the installation test tool to verify the service has been properly deployed

$> cd /tmp/gridrus-service
$> ant test-install -Dtomcat.port=${YOUR_TOMCAT_PORT}

Inserting Usage RecordsInserting Usage Records

Assuming you have access to a GridRUS service (i.e. The OMII container trusts the certificate configured in your OMII Client distribution) and you have been given the URL endpoint of the remote GridRUS service. You can start inserting and querying the GridRUS instance.

For example, you have deployed a GridRUS instance on the localhost by following the Quick Start guide. To ensure the service is running, you can use a browser to inspect the WSDL document of the GridRUS instance at https://localhost:18443/gridrus/services/gridrus?WSDL.

Create a Usage Records (URs) document containing the Usage Record (UR) to be inserted and save the file in $HOME/usagerecords.xml, for example

<?xml version="1.0" encoding="UTF-8"?>
<UsageRecords xmlns="http://www.gridforum.org/2003/ur-wg"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     >
    <UsageRecord>
        <RecordIdentity xmlns:ns1="http://www.gridforum.org/2003/ur-wg" ns1:recordId="record1"></RecordIdentity>
        <Status>1</Status>
    </UsageRecord>
    <UsageRecord>
        <RecordIdentity xmlns:ns1="http://www.gridforum.org/2003/ur-wg" ns1:recordId="record2"></RecordIdentity>
        <Status>0</Status>
    </UsageRecord>
</UsageRecords>

The Usage Records document contains two usage records.

To insert the usage records into a GridRUS instance, you can use the command gridrus-insert

Tip: The gridrus-* commands are installed in gridrus/bin inside the OMII Client distribution. Add the directory to your PATH environment, so that the gridrus-* commands are available to your shell.

$> ${OMIICLIENT_HOME}/gridrus/bin/gridrus-insert -help
usage: gridrus-insert [options] path-to-usage-records-file
                      [path-to-usage-records-file..]
GridRUS Usage Records Upload Client
 -s <service-endpoint-address>   The endpoint address of the Resource
                                 Usage Service
 -sn <service-name>              Logical name of the Resource Usage
                                 Service defined in ~/.gridrus/services.properties
                
$> ${OMIICLIENT_HOME}/gridrus/bin/gridrus-insert \
    -s "https://localhost:18443/gridrus/services/gridrus" \
    ${HOME}/usagerecords.xml
2/2 records have been inserted successfully

The gridrus-insert command writes insertion status to the standard output. If the record is a duplicate or invalid, an error message would be printed for each erroneous record.

Updating a Usage Record

Given a record has been inserted, a record can be updated by using the gridrus-update command.

$> ${OMIICLIENT_HOME}/gridrus/bin/gridrus-update -help
usage: gridrus-update [options] path-to-usage-records-file
                      [path-to-usage-records-file..]
GridRUS Usage Records Update Client
 -s <service-endpoint-address>   The endpoint address of the Resource
                                 Usage Service
 -sn <service-name>              Logical name of the Resource Usage
                                 Service defined in ~/.gridrus/services.properties

$> ${OMIICLIENT_HOME}/gridrus/bin/gridrus-update -s "https://localhost:18443/gridrus/services/gridrus" \
    ${HOME}/usagerecord.xml
2/2 records have been updated successfully

The gridrus-update command updates records with the same ur:RecordIdentity with new content.

Querying Usage Records

To query records already inserted into the Resource Usage Service, you can use the gridrus-extract command with an XPath Pattern expression. The ur: XML prefix is preset to the namespace of the Usage Record specification.

$> ${OMIICLIENT_HOME}/gridrus/bin/gridrus-extract -help
usage: gridrus-extract [options] query
GridRUS Usage Records Extraction Client
 -s <service-endpoint-address>   The endpoint address of the Resource
                                 Usage Service
 -sn <service-name>              Logical name of the Resource Usage
                                 Service defined in ~/.gridrus/services.properties
 query                                                   The query expression

$> ${OMIICLIENT_HOME}/gridrus/bin/gridrus-extract -s "https://localhost:18443/gridrus/services/gridrus" \
    "/ur:UsageRecord/ur:Status[text()='1']"
<?xml version="1.0" encoding="UTF-8"?>
<UsageRecords xmlns="http://www.gridforum.org/2003/ur-wg"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     >
    <UsageRecord>
        <RecordIdentity xmlns:ns1="http://www.gridforum.org/2003/ur-wg" ns1:recordId="record1"></RecordIdentity>
        <Status>1</Status>
    </UsageRecord>
</UsageRecords>

Deleting a Usage Record

Similar to the gridrus-extract command, you can delete records that satisfies a given pattern

$> ${OMIICLIENT_HOME}/gridrus/bin/gridrus-delete
usage: gridrus-delete [options] query
GridRUS Usage Records Deletion Client
 -s <service-endpoint-address>   The endpoint address of the Resource
                                 Usage Service
 -sn <service-name>              Logical name of the Resource Usage
                                 Service defined in ~/.gridrus/services.properties

$> ${OMIICLIENT_HOME}/gridrus/bin/gridrus-delete -s "https://localhost:18443/gridrus/services/gridrus" \
    "/ur:UsageRecord/ur:Status[text()='1']"
1 record deleted

Frequently used GridRUS Services

For most gridrus-* command, the user needs to specify the endpoint URL to the GridRUS service to be used. This is cumbersome to remember and type.

GridRUS clients allow user to specify the service by name by storing frequently used service locations in a properties file.

Create a directory .gridrus in the user's home directory

$> mkdir ~/.gridrus

Create a file named services.properties in the directory you have just created. The content of the file contains a list of name-value pairs. The value being the endpoint address (URI) of the the GridRUS service. For example

imperial=http://www.ic.ac.uk/gridrus/services/gridrus
ngs=http://www.ngs.ac.uk/gridrus/services/gridrus

Once the entries are defined, user can refer to the service by name. For example, to use the Imperial GridRUS service,

$> ${OMIICLIENT_HOME}/gridrus/bin/gridrus-submit -sn imperial uname.jsdl

Shutting down GridRUS

GridRUS persists records to long-term persistence store automatically. However, it is still wise to shutdown the container gracefully.

$> cd ${OMII_HOME}/jakarta-tomcat-5.0.25/bin
$> ./shutdown_base.sh
Shutting down tomcat
Server running under PID of 17171 detected
Waiting... HTTP server stopped.
Waiting Process stopped.

You should see a message in the GridRUS log file $OMII_HOME/jakarta-tomcat-5.0.25/logs/gridrus.log

..
2006-05-23 12:57:46,584 INFO  [ApplicationContextConfigurator] GridRUS machinery shutdown properly
2006-05-23 12:57:46,585 INFO  [ResourceUsageService] Resource Usage Service destroyed
..

What next?

By now, You should have successfully deployed the GridRUS Web Service that uses an embedded eXist XML database. You should have successfully inserted, updated, extracted and deleted usage records using the GridRUS tools.

If you will be administering a GridRUS Web Service, you are advised to consult the Deployment Guide in the GridRUS Service module to configure the GridRUS service for production usage according to your architectural requirement and backend infrastructure.

If you are an end-user of a GridRUS Web Service, you are advised to read through the Usage Record specification to understand the features of the record format. You can find more information on the GridRUS client-side tools in the User Guide in the GridRUS Client module.