This page shows how to access meta data about the service and the underlying data resources.
DAIVersion version = service.getVersion();
version.getMajor(); version.getMinor();
version.isWSRF(); version.isWSI();
This has been shown on an earlier page in the chapter The Basics.
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 our 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());
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();
In general, properties that are published by a data service can be accessed with the following methods:
Property property = service.getProperty(DataResourcePropertyNames.PERFORM_DOCUMENT_SCHEMA);
QName[] names = { DataResourceManagerPropertyNames.PERFORM_DOCUMENT_SCHEMA, DataResourcePropertyNames.PRODUCT_INFO }; Property[] properties = service.getProperties(names);
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.PRODUCT_INFO); DataResourceInfo info = DataResourceInfo.createFromProperty(property);
Constants representing the names of all available properties can be found in the class uk.org.ogsadai.dataresource.DataResourcePropertyNames. For example:
Note that the data service will throw a InvalidPropertyNameException if a resource property is not available.
Back: Control Flow | Up: Using the Client Toolkit | Next: Transforming Data |
© International Business Machines Corporation, 2002-2006 | © The University of Edinburgh, 2002-2006 |