Obtaining Meta Data

This page deals shows how to access meta data about the service and the underlying data resources.

The version of the service

Listing Data Resources

This has been shown on an earlier page in the chapter The Basics.

Supported Activities and Activity Metadata

A data resource usually supports only a subset of all activities provided by OGSA-DAI. For example, relational data resources generally support the SQLQuery activity but they may not support SQLUpdate or XPathQuery. To find out which activities are supported by the data resource you're connected to you can retrieve a list of names from the service.

String[] activities = service.getSupportedActivities();

The names can then be used to find out more about a specific activity. For example, let's say out data service supports SQLQuery. Then we can retrieve a more detailed description of the activity using the DataService.getActivityMetaData() method.

ActivityMetaData metadata = service.getActivityMetaData("SQLQuery");
System.out.println("Description of activity " + metadata.getName() + ":");
System.out.println(metadata.getDescription());

Product Information of a Data Resource

The data resource information usually contains the name, vendor and version of the database product. Providing this information is not mandatory for an OGSA-DAI data resource so the DataResourceInfo object may be null or empty.

DataResourceInfo info = service.getDataResourceInfo();
System.out.println("Name:    " + info.getName());
System.out.println("Vendor:  " + info.getVendor());
System.out.println("Version: " + info.getVersion();

Accessing Data Service and Resource Properties

In general, properties that are published by a data service can be accessed with the following methods:

If a property can be converted to a Java type that is provided by OGSA-DAI you can use the createFromProperty method of that class to convert the property into a specific object. For example:

Property[] property = service.getProperty(DataResourcePropertyNames.DATABASE_SCHEMA);
DatabaseSchemaMetaData schema = DatabaseSchemaMetaData.createFromProperty(property[0]);

The QName constants representing the names of all available properties can be found in the class DataResourcePropertyNames and DataResourceManagerPropertyNames.

Note that the data service will throw a InvalidPropertyNameException if a resource property is not available.