Registry-Publisher

From Gcube Wiki
Revision as of 14:12, 12 April 2013 by Roberto.cirillo (Talk | contribs) (Sample usages)

Jump to: navigation, search


In conjunction with the IC-Client, the Registry-Publisher represents the mediation layer gCube Services, based on FWS, will rely on to interact with the Information Service as a whole.



Design

The Registry-Publisher is a Java library providing the implementation of two interfaces (RegistryPublisher and ScopedPublisher) that allow services to publish GCUBEResource as well as their state in the IS.

More specifically:

  • by implementing the org.gcube.common.core.informationsystem.publisher.RegistryPublisher interface, the library allows gCube services to publish GCUBEResources and instances' states as of the gCube Resource Model defined in Common-gcore-resources;
  • by implementing the org.gcube.informationsystem.publisher.ScopedPublisher interface, the library allows gCube services to publish GCUBEResources and instances' states as of the gCube Resource Model defined in Common-gcore-resources in multi scope way;

Publishing a resource

In order to publish a Resource the Registry-Publisher contacts the IS-Registry service of the current scope by invoking its appropriate operations.

Interfaces

The only different between RegistryPublisher interface and ScopedPublisher interface is:

  • RegistryPublisher interface publish resources on the current scope specified by ScopeProvider;
  • ScopedPublisher interface publish resources on a List of scopes, calling for every scope the RegistryPublisher interface

RegistryPublisher interface

The following operation can be used to manage profiles on the IS:

  • register() – which takes as input parameter a resource (gCUBEResource), and returns the resource updated and filled of;
  • update() – which takes as input parameter a message containing a resource and updates a resource previously registered in the IS.
  • remove() – which takes as input parameter a resource and removes the corresponding resource previously registered in the IS;

ScopedPublisher interface

The following operation can be used to manage profiles on the IS:

  • register() – which takes as input parameter a resource (gCUBEResource), a list of String that identify operational scope (GCUBEScope) and returns the resource updated and filled of ;
  • update() – which takes as input parameter a resource, a list of String that identify operational scope (GCUBEScope) and updates a resource previously registered in the IS.
  • remove() – which takes as input parameter a resource, a list of String that identify operational scope (GCUBEScope) and removes the corresponding resource previously registered in the IS;


Sample usages

Here it is an example of GenericResource registration by RegistryPublisher interface:

ScopeProvider.instance.set("/gcube/devsec");
GenericResource generic = Resources.unmarshal(GenericResource.class, PublisherTest.class.getClassLoader().getResourceAsStream("generic2.xml"));
RegistryPublisher rp=RegistryPublisherFactory.create();
Resource r=rp.create(generic);