Chapter 67. Example server client

67.1. How to show the server version
67.2. How to list available resources
67.3. How to show a resource lifetime
67.4. How to show the supported activities of a resource
67.5. How to get a resource property
67.6. How to get a resource WS-EPR
67.7. How to destroy a resource

OGSA-DAI provides a simple command-line client for running generic operations to query the state of an OGSA-DAI server.

[Note]Note
OGSA-DAI example clients are intended to allow users to quickly test their deployment as well to provide basic examples of how to construct clients using the client toolkit. They are not intended to be robust applications for use in production environments. OGSA-DAI offers a toolkit which provides users with the tools to develop their own clients that use OGSA-DAI services - these clients are the simplest examples built using this toolkit.
[Important]Important
The OGSA-DAI command-line clients do not work for the Jersey technology preview without recompiling. The ServerProxy class only applies to the Axis/GT4 releases of OGSA-DAI and must be replaced by the Jersey specific JerseyServer class.

Replace the following line in the source code of the client:

ServerProxy server = new ServerProxy();

with this code:

import uk.org.ogsadai.client.toolkit.presentation.jersey.JerseyServer;
...
Server server = new JerseyServer();

Then replace any occurrences of ServerProxy by JerseyServer. Recompile the client and follow the instructions how to run it below.

The client takes the following arguments:

67.1. How to show the server version

Run the following, replacing SERVICES-BASE-URL:

$ java uk.org.ogsadai.client.toolkit.example.ServerClient \
  -u SERVICES-BASE-URL -c getVersion

For example:

67.2. How to list available resources

To print all the resources of a given type known to the server run the following, SERVICES-BASE-URL and RESOURCE-TYPE:

$ java uk.org.ogsadai.client.toolkit.example.ServerClient \
  -u SERVICES-BASE-URL [-t RESOURCE-TYPE] -c listResources

If no -t argument is given then all resources are listed.

For example:

67.3. How to show a resource lifetime

Run the following, replacing SERVICES-BASE-URL, RESOURCE-ID and RESOURCE-TYPE:

$ java uk.org.ogsadai.client.toolkit.example.ServerClient \
  -u SERVICES-BASE-URL -r RESOURCE-ID -t RESOURCE-TYPE    \
  -c getLifetime

For example:

67.4. How to show the supported activities of a resource

Run the following, replacing SERVICES-BASE-URL, RESOURCE-ID and RESOURCE-TYPE:

$ java uk.org.ogsadai.client.toolkit.example.ServerClient \
  -u SERVICES-BASE-URL -r RESOURCE-ID -t RESOURCE-TYPE    \
  -c getActivities

For example:

67.5. How to get a resource property

Run the following, replacing SERVICES-BASE-URL, RESOURCE-ID, RESOURCE-TYPE and RESOURCE-PROPERTY-NAME which should be the name of a resource property exposed by the resource. Section K.2, “Default resource property names” lists the default resource property names for each type of OGSA-DAI resource.

$ java uk.org.ogsadai.client.toolkit.example.ServerClient \
  -u SERVICES-BASE-URL -r RESOURCE-ID -t RESOURCE-TYPE    \
  -c getProperty -p RESOURCE-PROPERTY-NAME

For example:

67.6. How to get a resource WS-EPR

To print out the WS-EPR of a resource exposed by a service run the following, replacing SERVICES-BASE-URL, RESOURCE-ID and RESOURCE-TYPE:

$ java uk.org.ogsadai.client.toolkit.example.ServerClient \
  -u SERVICES-BASE-URL -r RESOURCE-ID -t RESOURCE-TYPE    \
  -c resolve

For example:

67.7. How to destroy a resource

To destroy a resource exposed by a service run the following, replacing SERVICES-BASE-URL, RESOURCE-ID and RESOURCE-TYPE:

$ java uk.org.ogsadai.client.toolkit.example.ServerClient \
  -u SERVICES-BASE-URL -r RESOURCE-ID -t RESOURCE-TYPE    \
  -c destroy

For example: