Accessing a Registry (OGSI services only)

When accessing a data resource over the Grid using OGSA-DAI, the first stage is generally to locate a specific Data Service. There are several ways to do this:

This exercise will show you how to obtain a list of data services from a DAISGR. These are the steps:

Once you have listed all registered data services, you can obtain the URL of a suitable data service.

  1. We'll assume that you know the URL of a public DAISGR for example
    String registryURL = "http://localhost:8080/ogsa/services/ogsadai/DAIServiceGroupRegistry";
    
  2. Get a Registry object from the OGSIServiceFetcher:
    Registry registry = OGSIServiceFetcher.getInstance().getRegistry( registryURL );
    
    That's all, the Registry object is now ready to use.
  3. You can retrieve a list of all data services that are registered with the following command:
    URL[] services = sgr.getServices( OGSIConstants.GDSF_PORT_TYPE );
    
    This searches for all services implementing the GridDataServiceFactoryPortType portType. The name of the portType is encoded as a QName and is defined in uk.org.ogsadai.service.ogsi.OGSIConstants. The return type is an array of URLs.
  4. For each service you can retrieve additional metadata from the registry.
    ServiceMetaData metadata = sgr.getServiceMetaData(services[0]);
    
    The service metadata object holds the URL of the service and the names of the portTypes that this service implements. The metadata that the registry returns is accessed as follows:
    URL serviceURL = metadata.getURL();
    QName[] portTypes = metadata.getPortTypes();
    
  5. Services may also register additional information, or metadata, with the registry. These are represented by an array of XML elements and can be retrieved from the ServiceMetaData object as follows:
    Element[] description = metadata.getElements();
    

See OGSA-DAI/examples/tutorials/clienttoolkit/ListingRegisteredFactories.java for an example.