Registry Service Tutorial
Introduction
This guide explains how to use the GRIA Registry Service. In the guide we create a registry, register a data-stager, query the registry and unregister the resource.
The TutorialHelpers.java class is required.
The full Java file for the Registry Service Tutorial can be downloaded.
Guide to the GRIA Registry Service
Create a TutorialHelpers object and get a ProxyFactory object from it:
TutorialHelpers helpers = new TutorialHelpers();
ProxyFactory proxyFactory = helpers.getFactory();
Create a Proxy to the Registry Service:
RemoteCltMgtRegistryService registryService = proxyFactory.createProxy(ConversationID.getEPR(REGISTRY_SERVICE_ENDPOINT),RemoteCltMgtRegistryService.class);
Create a Registry at the Registry Service:
CltMgtRegistryResourceConversation registry = registryService.createRegistry("My Registry");
Create a Proxy to the Data Service:
RemoteDataService dataService = proxyFactory.createProxy(ConversationID.getEPR(DATA_SERVICE_ENDPOINT),RemoteDataService.class);
Create a Data Stager at the Data Service:
DataConversation data = dataService.createStagingArea("My Data");
Register the data stager's EPR at the registry:
try {
registry.registerResource(data.getEndpointRef());
In order to discover resources in the registry call getRegisteredResources on the registry:
for (EndpointReferenceType epr : registry.getResources()) {
System.out.println("Resource :" + ConversationID.getURLReferenceFromEPR(epr));
}
Now we can unregister the data stager:
registry.unregisterResource(data.getEndpointRef());
Clean up resources at the services:
} catch (RemoteException e) {
throw new RuntimeException(e);
} finally {
data.destroy();
registry.destroy();
}