Difference between revisions of "Advanced Topics"

From GCube System
Jump to: navigation, search
(How to publish the state)
(ISClient interface)
 
(67 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== How to publish the state ==
+
== Interfacing the Information System ==
...
+
 
 +
The gCore Framework has been designed to work independently from a IS specific Implementation.
 +
In order to let the gCF unbound from a IS, implementation both query & publishing interfaces have been
 +
designed.
 +
The gCF implements then a dynamic class loader that ( reading an implementation file that contains the mapping btw
 +
the IS interfaces and their implementations) can abstract over the IS technology.
  
== How to persist the state ==
+
=== ISQuery interface ===
 +
 
 +
The ISQuery interface designs the minimal query behavoiur accepted by the ISClient.
 +
The query contains the textual query expression and specify a time-to-live for their results
 +
(that can be exploited by future caching mechianism)
 +
The definition is parametric with respect the type of the exptected results.
 +
This is not required for the interface, though it may for its implementations; in addition , it allows full typing
 +
of the ISClient interface.
 +
 
 +
<pre>
 +
public interface ISQuery<RESULT> {
 +
  /**
 +
    * Returns the time-to-live of the results of the query.
 +
    * @return the time-to-live.
 +
    */
 +
  public long getTTL();
 +
 
 +
  /**
 +
    * Sets the time-to-live of the results of the query.
 +
    * @param ttl the time-to-live.
 +
    */
 +
  public void setTTL(long ttl);
 +
 
 +
  /**
 +
    * Returns the textual expression of the query.
 +
    * @return the expression.
 +
    */
 +
  public String getQueryExpression();
 +
 
 +
  /**
 +
    * Sets the textual expression of the query.
 +
    * @param exp the expression.
 +
    */
 +
  public void setQueryExpression(String exp);
 +
}
 +
</pre>
 +
 
 +
=== ISClient interface ===
 +
 
 +
The IS Client interface defines only two methods:
 +
 
 +
<pre>
 +
public <RESULT> List<RESULT> execute(ISQuery<RESULT> query, GCUBEScope scope) throws ISMalformedQueryException,ISUnsupportedQueryException,ISException;
 +
</pre>
 +
 
 +
<pre>
 +
public <RESULT> ISInputStream<RESULT> executeByRef(ISQuery<RESULT> q, GCUBEScope s) throws ISMalformedQueryException,ISUnsupportedQueryException,ISException;
 +
</pre>
 +
 
 +
The two execute methods take as parameter:
 +
*the ISQuery Object (with all parameters filled correctly otherwise the ISClient throws an ISMalformedQueryException);
 +
*a GCUBEScope object that specifies the query scope;
 +
 
 +
The return type in the first case is a List object specified as Type parameter in the related ISquery object, in the second case is a ISInputStream  that implements the java.lang.iterable interface.
 +
 
 +
 
 +
In order to get the implementation of the ISClient Interface, the GHNContext exposes the static method getImplementation:
 +
 
 +
<pre>
 +
ISClient client =  GHNContext.getImplementation(ISClient.class);
 +
</pre>
 +
 
 +
The IS Client Interface predefines a list of abstract queries that model the queries used by the gCF.
 +
 
 +
In particular we have general queries over GCUBEResources:
 +
 
 +
*GCUBECollectionQuery
 +
*GCUBECSInstanceQuery
 +
*GCUBECSQuery
 +
*GCUBEExternalRIQuery
 +
*GCUBEGenericResourceQuery
 +
*GCUBEGHNQuery
 +
*GCUBEMCollectionQuery
 +
*GCUBERIQuery
 +
*GCUBEServiceQuery
 +
*GCUBETPQuery
 +
*GCUBEVREQuery
 +
 
 +
 
 +
Queries over GCUBEWSResource:
 +
 
 +
*WSResourceQuery
 +
 
 +
Generic queries:
 +
 
 +
*GCUBEGenericQuery
 +
 
 +
 
 +
In order to get the implementation specific ISQuery Object, IS Client exposes the method getQuery, that dynamically loads the ISQuery implementation of the given ISQuery interface:
 +
 
 +
<pre>
 +
public <RESULT, QUERY extends ISQuery<RESULT>> QUERY getQuery(Class<QUERY> clazz) throws ISUnsupportedQueryException;
 +
</pre>
 +
 
 +
i.e.
 +
 
 +
<pre>
 +
GCUBERIQuery queryRI = client.getQuery(GCUBERIQuery.class);
 +
</pre>
 +
 
 +
 
 +
==== Sample usage ====
 +
 
 +
see [[https://technical.wiki.d4science.research-infrastructures.eu/documentation/index.php/ExistClient#Implementation_Overview ExistClient]]
 +
 
 +
=== ISPublisher interface ===
 +
 
 +
The ISPublisher interface defines methods to register/unregister/update these kind of objects on the IS:
 +
 
 +
*GCUBEResources
 +
*GCUBEWSResources
 +
*Topics
 +
 
 +
In particular GCUBEResources profiles are modeled as java classes inside the framework:
 +
*GCUBEService
 +
*GCUBERunningInstance
 +
*GCUBEHostingNode
 +
*GCUBECS
 +
*GCUBECSInstance
 +
*GCUBECollection
 +
*GCUBEMCollection
 +
*GCUBEExternalRunningInstance
 +
*GCUBEGenericRescource
 +
 
 +
gCUBE Client/Services can exploit the IS-Publisher to store/update/remove GCUBEResource profiles from/to the IS:
 +
 
 +
<pre>
 +
 
 +
/**
 +
*  Register a GCUBEResource on the Information System
 +
*
 +
* @param resource The GCUBEResource to register
 +
* @param scope the scope in which the resource is going to be registered
 +
* @param the GCUBESecurityManager for contacting the IS
 +
* @throws ISPublisherException Exception
 +
*/
 +
 
 +
public String registerGCUBEResource(GCUBEResource resource,GCUBEScope scope, GCUBESecurityManager manager)throws
 +
 
 +
GCUBEPublisherException;
 +
 +
/**
 +
* Remove a GCUBEResource from the Information System
 +
*
 +
* @param ID the ID related to the GCUBEResource to remove
 +
* @param the GCUBEResource type to remove
 +
* @param scope the scope from which the resource is going to be removed
 +
* @param manager the GCUBESecurityManager for contacting the IS
 +
* @throws ISPublisherException Exception
 +
*/
 +
public  void removeGCUBEResource(String ID,String type,GCUBEScope scope,GCUBESecurityManager manager) throws ISPublisherException;
 +
 +
/**
 +
* Update a GCUBEResource in the Information System
 +
 
 +
* @param resource the new GCUBEResource to update
 +
* @param manager the GCUBESecurityManager for contacting the IS
 +
* @throws ISPublisherException Exception
 +
*/
 +
public void updateGCUBEResource(GCUBEResource resource,GCUBEScope scope,GCUBESecurityManager manager) throws ISPublisherException;
 +
 
 +
</pre>
 +
 
 +
 
 +
GCUBEWSResource class then, defines WS-Resource-Properties to publish to the IS (the publication mechanism is completely
 +
hidden by the gCF). The gCF exploits these mothods to implement the WS-Resource-Properties registration/unregistation from/to IS:
 +
 
 +
<pre>
 +
/**
 +
* Enables WS-resource registration on a Information System
 +
*
 +
* @param resource The Gcube WSResouce to register
 +
* @param scope optional scope (overrides the scope specified by the GCUBEWSResource)
 +
* @throws ISPublisherException Exception
 +
*/
 +
public void registerWSResource(GCUBEWSResource resource,GCUBEScope ...scope) throws ISPublisherException;
 +
 +
/**
 +
*  Removes the registration of a GCube WS-Resource from the InformationSystem
 +
*
 +
* @param resource  The Gcube WSResouce to unregister
 +
* @param scope optional scope (overrides the scope specified by the GCUBEWSResource)
 +
* @throws ISPublisherException Exception
 +
*/
 +
public void removeWSResource(GCUBEWSResource resource,GCUBEScope ...scope) throws ISPublisherException;
 +
 
 +
</pre>
 +
 
 +
As noticed, the ISPublisher methods take as parameters the GCUBEScope and the GCUBESecurityManager of the caller in order to
 +
prepare the IS Services stubs with the correct Scope and security Settings.
 +
 
 +
==== Sample usage ====
 +
 
 +
In Order to get the ISPublisher implementation object from its itnerface ( as for the ISClient), the GHNContext offers the
 +
getImplementation method:
 +
 
 +
<pre>
 +
ISPublisher publisher  =GHNContext.getImplementation(ISPublisher.class);
 +
</pre>
 +
 
 +
In order to register a GCUBEResource profile ( i.e. a GCUBEService) on the IS, this is the sample code:
 +
 
 +
<pre>
 +
FileReader fis = new FileReader (args[0]);
 +
GCUBEService resource =GHNContext.getImplementation(GCUBEService.class);
 +
resource.load(fis);
 +
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {  public boolean isSecurityEnabled() {return true;}};
 +
GSSCredential cred =org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[1]);
 +
managerSec.useCredentials(cred);
 +
ISPublisher publisher  =GHNContext.getImplementation(ISPublisher.class);
 +
publisher.registerGCUBEResource(resource, GCUBEScope.getScope("/gcube/devsec"), managerSec);
 +
</pre>
 +
 
 +
=== ISNotifier interface ===
 +
Topics publishers can use the ISNotifier interface, to let their Topics being published on the IS and subscribed for
 +
notification to.
 +
 
 +
<pre>
 +
/**
 +
* Registers the consumer to the given list of topics
 +
*
 +
* @param notifications the list of IS Notification to register to
 +
* @param consumer the {@link BaseNotificationConsumer} to callback whenever a notification is received
 +
* @param context the {@link GCUBEServiceContext} of the consumer
 +
* @param scope the {@link GCUBEScope}s in which to register the consumer, it is used instead of the one included in the context
 +
*
 +
* @throws ISNotifierException if the registration fails
 +
*/
 +
public <T extends BaseNotificationConsumer> void registerToISNotification(List<QName> notifications, T consumer, GCUBESecurityManager manager, GCUBEScope ... scope) throws ISNotifierException;
 +
 +
/**
 +
* Unregisters the consumer from the given list of topics
 +
*
 +
* @param notifications the list of IS Notifications from which to unregister the {@link EndpointReferenceType}
 +
* @param context the {@link GCUBEServiceContext} of the consumer
 +
* @param scope the {@link GCUBEScope}s in which to register the consumer, replacing the one included in the context
 +
 +
* @throws ISNotifierException if the unregistration fails
 +
*/
 +
public void unregisterFromISNotification(List<QName> notifications, GCUBESecurityManager manager, GCUBEScope ... scope) throws ISNotifierException ;
 +
 
 +
 
 +
/**
 +
* Registers a list of topics as IS Notifications
 +
*
 +
* @param producerEPR the {@link GCUBEServiceContext} of the producer
 +
* @param notifications the list of IS Notifications to register
 +
* @param context the {@link GCUBEServiceContext} of the producer
 +
* @param scope the {@link GCUBEScope}s in which to register the IS notification, it is used instead of the one included in the context
 +
*
 +
* @throws ISNotifierException if the registration fails
 +
*/
 +
public void registerISNotification (EndpointReferenceType producerEPR, List<? extends Topic> notifications,
 +
GCUBESecurityManager manager, GCUBEScope ... scope) throws ISNotifierException ;
 +
 
 +
/**
 +
* Unregisters a list of new topics as source of IS Notifications
 +
*
 +
* @param producerEPR the {@link GCUBEServiceContext} of the producer
 +
* @param notifications the list of IS Notification to unregister
 +
* @param security manager the {@link GCUBESecurityManager} of the producer
 +
* @param scope the {@link GCUBEScope}s in which to unregister the IS notification, it is used instead of the one included in the context
 +
 +
* @throws ISNotifierException if the unregistration fails
 +
*/
 +
public void unregisterISNotification (EndpointReferenceType producerEPR, List<? extends Topic> notifications,
 +
GCUBESecurityManager manager,  GCUBEScope ... scope) throws ISNotifierException;
 +
 
 +
/**
 +
* Checks if the producer registration is completed or not
 +
*
 +
* @param the topic to check
 +
* @param EnpointReferenceType of the producer
 +
* @param security manager the {@link GCUBESecurityManager} of the producer
 +
* @param scope the {@link GCUBEScope}s in which to register the IS notification
 +
* @return true if the registration is completed, false otherwise
 +
*/
 +
public boolean isTopicRegistered(QName Topic, EndpointReferenceType producerEpr, GCUBESecurityManager manager,  GCUBEScope scope) throws ISNotifierException;
 +
</pre>
 +
 
 +
==== Resource Properties as Topics ====
 +
In order to publish one or more Resource Properties as Topics in the IS, one needs to override in the ws-resoure class the getTopics() method in order to provide the names of the RP that he/she wants to publish as Topics
 +
 
 +
Example:
 +
<pre>
 +
 
 +
 
 +
 
 +
public class DeployerResource extends GCUBEWSResource {
 +
 +
protected static final String RP_NAME = "Name";
 +
protected static String[] TopicNames={RP_NAME};
 +
 
 +
@Override
 +
public String[] getTopicNames(){
 +
        return TopicNames;
 +
}
 +
 
 +
</pre>
 +
 
 +
And, that's all. GCF automatically publishes on behalf of the resource the Topics, as it does with the RP
 +
 
 +
==== Generic Topics ====
 +
In order to publish a Topic not directly bound to a Resource Property, the following steps must be followed.
 +
 
 +
1) Define your own Topic in your WSResource
 +
 
 +
Example:
 +
<pre>
 +
public static final String NS = "http://gcube-system.org/namespaces/vremanagement/deployer";
 +
 
 +
private SimpleTopic deployedPackagesT = new SimpleTopic(new QName(NS, “TopicName"));
 +
</pre>
 +
 
 +
 
 +
… and the Topic notification message in the WSDL
 +
 
 +
<pre>
 +
<xsd:element name=" DeployedPackagesNotificationMessage" type="tns:DeployedPackagesNotificationMessageType"/>
 +
</pre>
 +
 
 +
2) Retrieve the ISNotifier implementation
 +
 
 +
Example:
 +
<pre>
 +
ISNotifier notifier = GHNContext.getImplementation(ISNotifier.class);
 +
</pre>
 +
 
 +
3) Register the Topic
 +
 
 +
Example:
 +
<pre>
 +
List <SimpleTopic> list = new ArrayList< SimpleTopic >();
 +
list.add(deployedPackagesT );
 +
notifier.registerISNotification(this.getEPR(), list, this.getServiceContext());
 +
</pre>
 +
 
 +
4) Send the notification whenever it is needed, according to the notification message defined in the WSDL
 +
 
 +
Example:
 +
<pre>
 +
DeployedPackagesNotificationMessageType message = new DeployedPackagesNotificationMessage ();
 +
message.setX(…);
 +
message.setY(…)
 +
 
 +
deployedPackagesT.notify(message);
 +
</pre>
 +
 
 +
== Service security ==
 +
 
 +
=== Configuring gContainer with Security ===
 +
 
 +
=== Configuring gCube Service with Credentials ===

Latest revision as of 11:19, 5 May 2009

Interfacing the Information System

The gCore Framework has been designed to work independently from a IS specific Implementation. In order to let the gCF unbound from a IS, implementation both query & publishing interfaces have been designed. The gCF implements then a dynamic class loader that ( reading an implementation file that contains the mapping btw the IS interfaces and their implementations) can abstract over the IS technology.

ISQuery interface

The ISQuery interface designs the minimal query behavoiur accepted by the ISClient. The query contains the textual query expression and specify a time-to-live for their results (that can be exploited by future caching mechianism) The definition is parametric with respect the type of the exptected results. This is not required for the interface, though it may for its implementations; in addition , it allows full typing of the ISClient interface.

public interface ISQuery<RESULT> {
	   /**
	    * Returns the time-to-live of the results of the query.
	    * @return the time-to-live.
	    */
	   public long getTTL();

	   /**
	    * Sets the time-to-live of the results of the query.
	    * @param ttl the time-to-live.
	    */
	   public void setTTL(long ttl);

	   /**
	    * Returns the textual expression of the query.
	    * @return the expression.
	    */
	   public String getQueryExpression();

	   /**
	    * Sets the textual expression of the query.
	    * @param exp the expression.
	    */
	   public void setQueryExpression(String exp);
}

ISClient interface

The IS Client interface defines only two methods:

public <RESULT> List<RESULT> execute(ISQuery<RESULT> query, GCUBEScope scope) throws ISMalformedQueryException,ISUnsupportedQueryException,ISException;	
public <RESULT> ISInputStream<RESULT> executeByRef(ISQuery<RESULT> q, GCUBEScope s) throws ISMalformedQueryException,ISUnsupportedQueryException,ISException;

The two execute methods take as parameter:

  • the ISQuery Object (with all parameters filled correctly otherwise the ISClient throws an ISMalformedQueryException);
  • a GCUBEScope object that specifies the query scope;

The return type in the first case is a List object specified as Type parameter in the related ISquery object, in the second case is a ISInputStream that implements the java.lang.iterable interface.


In order to get the implementation of the ISClient Interface, the GHNContext exposes the static method getImplementation:

ISClient client =  GHNContext.getImplementation(ISClient.class);

The IS Client Interface predefines a list of abstract queries that model the queries used by the gCF.

In particular we have general queries over GCUBEResources:

  • GCUBECollectionQuery
  • GCUBECSInstanceQuery
  • GCUBECSQuery
  • GCUBEExternalRIQuery
  • GCUBEGenericResourceQuery
  • GCUBEGHNQuery
  • GCUBEMCollectionQuery
  • GCUBERIQuery
  • GCUBEServiceQuery
  • GCUBETPQuery
  • GCUBEVREQuery


Queries over GCUBEWSResource:

  • WSResourceQuery

Generic queries:

  • GCUBEGenericQuery


In order to get the implementation specific ISQuery Object, IS Client exposes the method getQuery, that dynamically loads the ISQuery implementation of the given ISQuery interface:

public <RESULT, QUERY extends ISQuery<RESULT>> QUERY getQuery(Class<QUERY> clazz) throws ISUnsupportedQueryException;

i.e.

GCUBERIQuery queryRI = client.getQuery(GCUBERIQuery.class);


Sample usage

see [ExistClient]

ISPublisher interface

The ISPublisher interface defines methods to register/unregister/update these kind of objects on the IS:

  • GCUBEResources
  • GCUBEWSResources
  • Topics

In particular GCUBEResources profiles are modeled as java classes inside the framework:

  • GCUBEService
  • GCUBERunningInstance
  • GCUBEHostingNode
  • GCUBECS
  • GCUBECSInstance
  • GCUBECollection
  • GCUBEMCollection
  • GCUBEExternalRunningInstance
  • GCUBEGenericRescource

gCUBE Client/Services can exploit the IS-Publisher to store/update/remove GCUBEResource profiles from/to the IS:


/**
 *  Register a GCUBEResource on the Information System
 *
 * @param resource The GCUBEResource to register
 * @param scope the scope in which the resource is going to be registered
 * @param the GCUBESecurityManager for contacting the IS
 * @throws ISPublisherException Exception
 */

public String registerGCUBEResource(GCUBEResource resource,GCUBEScope scope, GCUBESecurityManager manager)throws 

GCUBEPublisherException;
	
/**
 * Remove a GCUBEResource from the Information System
 *
 * @param ID the ID related to the GCUBEResource to remove
 * @param the GCUBEResource type to remove
 * @param scope the scope from which the resource is going to be removed
 * @param manager the GCUBESecurityManager for contacting the IS
 * @throws ISPublisherException Exception
 */
public  void removeGCUBEResource(String ID,String type,GCUBEScope scope,GCUBESecurityManager manager) throws ISPublisherException;
	
/**
 * Update a GCUBEResource in the Information System

 * @param resource the new GCUBEResource to update 
 * @param manager the GCUBESecurityManager for contacting the IS
 * @throws ISPublisherException Exception
 */
public void updateGCUBEResource(GCUBEResource resource,GCUBEScope scope,GCUBESecurityManager manager) throws ISPublisherException;


GCUBEWSResource class then, defines WS-Resource-Properties to publish to the IS (the publication mechanism is completely hidden by the gCF). The gCF exploits these mothods to implement the WS-Resource-Properties registration/unregistation from/to IS:

/**
 * Enables WS-resource registration on a Information System
 * 
 * @param resource The Gcube WSResouce to register
 * @param scope optional scope (overrides the scope specified by the GCUBEWSResource) 
 * @throws ISPublisherException Exception
 */
public void registerWSResource(GCUBEWSResource resource,GCUBEScope ...scope) throws ISPublisherException;
	
/**
 *  Removes the registration of a GCube WS-Resource from the InformationSystem
 *
 * @param resource  The Gcube WSResouce to unregister
 * @param scope optional scope (overrides the scope specified by the GCUBEWSResource) 
 * @throws ISPublisherException Exception
*/
public void removeWSResource(GCUBEWSResource resource,GCUBEScope ...scope) throws ISPublisherException;

As noticed, the ISPublisher methods take as parameters the GCUBEScope and the GCUBESecurityManager of the caller in order to prepare the IS Services stubs with the correct Scope and security Settings.

Sample usage

In Order to get the ISPublisher implementation object from its itnerface ( as for the ISClient), the GHNContext offers the getImplementation method:

ISPublisher publisher  =GHNContext.getImplementation(ISPublisher.class);

In order to register a GCUBEResource profile ( i.e. a GCUBEService) on the IS, this is the sample code:

FileReader fis = new FileReader (args[0]);
GCUBEService resource =GHNContext.getImplementation(GCUBEService.class);
resource.load(fis);
GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {  public boolean isSecurityEnabled() {return true;}};
GSSCredential cred =org.diligentproject.dvos.authentication.util.ProxyUtil.loadProxyCredentials(args[1]);
managerSec.useCredentials(cred);
ISPublisher publisher  =GHNContext.getImplementation(ISPublisher.class);
publisher.registerGCUBEResource(resource, GCUBEScope.getScope("/gcube/devsec"), managerSec);

ISNotifier interface

Topics publishers can use the ISNotifier interface, to let their Topics being published on the IS and subscribed for notification to.

/**
	 * Registers the consumer to the given list of topics
	 * 
	 * @param notifications the list of IS Notification to register to
	 * @param consumer the {@link BaseNotificationConsumer} to callback whenever a notification is received
	 * @param context the {@link GCUBEServiceContext} of the consumer 
	 * @param scope the {@link GCUBEScope}s in which to register the consumer, it is used instead of the one included in the context
	 * 
	 * @throws ISNotifierException if the registration fails
	 */
	 public <T extends BaseNotificationConsumer> void registerToISNotification(List<QName> notifications, T consumer, GCUBESecurityManager manager, GCUBEScope ... scope) throws ISNotifierException;
	
	/**
	 * Unregisters the consumer from the given list of topics 
	 * 
	 * @param notifications the list of IS Notifications from which to unregister the {@link EndpointReferenceType}
	 * @param context the {@link GCUBEServiceContext} of the consumer
	 * @param scope the {@link GCUBEScope}s in which to register the consumer, replacing the one included in the context
	 *  
	 * @throws ISNotifierException if the unregistration fails
	 */
	public void unregisterFromISNotification(List<QName> notifications, GCUBESecurityManager manager, GCUBEScope ... scope) throws ISNotifierException ;


	/**
	 * Registers a list of topics as IS Notifications
	 * 
	 * @param producerEPR the {@link GCUBEServiceContext} of the producer 
	 * @param notifications the list of IS Notifications to register
	 * @param context the {@link GCUBEServiceContext} of the producer
	 * @param scope the {@link GCUBEScope}s in which to register the IS notification, it is used instead of the one included in the context
	 * 
	 * @throws ISNotifierException if the registration fails
	 */
	public void registerISNotification (EndpointReferenceType producerEPR, List<? extends Topic> notifications, 
			GCUBESecurityManager manager, GCUBEScope ... scope) throws ISNotifierException ;

	/**
	 * Unregisters a list of new topics as source of IS Notifications
	 * 
	 * @param producerEPR the {@link GCUBEServiceContext} of the producer
	 * @param notifications the list of IS Notification to unregister
	 * @param security manager the {@link GCUBESecurityManager} of the producer
	 * @param scope the {@link GCUBEScope}s in which to unregister the IS notification, it is used instead of the one included in the context
	 *  
	 * @throws ISNotifierException if the unregistration fails
	 */
	public void unregisterISNotification (EndpointReferenceType producerEPR, List<? extends Topic> notifications,
			GCUBESecurityManager manager,  GCUBEScope ... scope) throws ISNotifierException;

	/**
	 * Checks if the producer registration is completed or not 
	 * 
	 * @param the topic to check
	 * @param EnpointReferenceType of the producer
	 * @param security manager the {@link GCUBESecurityManager} of the producer
	 * @param scope the {@link GCUBEScope}s in which to register the IS notification
	 * @return true if the registration is completed, false otherwise
	 */
	public boolean isTopicRegistered(QName Topic, EndpointReferenceType producerEpr, GCUBESecurityManager manager,  GCUBEScope scope) throws ISNotifierException;

Resource Properties as Topics

In order to publish one or more Resource Properties as Topics in the IS, one needs to override in the ws-resoure class the getTopics() method in order to provide the names of the RP that he/she wants to publish as Topics

Example:




public class DeployerResource extends GCUBEWSResource {
 
 protected static final String RP_NAME = "Name"; 
 protected static String[] TopicNames={RP_NAME};

 @Override
 public String[] getTopicNames(){
         return TopicNames;
 } 

And, that's all. GCF automatically publishes on behalf of the resource the Topics, as it does with the RP

Generic Topics

In order to publish a Topic not directly bound to a Resource Property, the following steps must be followed.

1) Define your own Topic in your WSResource

Example:

public static final String NS = "http://gcube-system.org/namespaces/vremanagement/deployer";

private SimpleTopic deployedPackagesT = new SimpleTopic(new QName(NS, “TopicName"));


… and the Topic notification message in the WSDL

<xsd:element name=" DeployedPackagesNotificationMessage" type="tns:DeployedPackagesNotificationMessageType"/>

2) Retrieve the ISNotifier implementation

Example:

ISNotifier notifier = GHNContext.getImplementation(ISNotifier.class);

3) Register the Topic

Example:

List <SimpleTopic> list = new ArrayList< SimpleTopic >();
list.add(deployedPackagesT );
notifier.registerISNotification(this.getEPR(), list, this.getServiceContext());

4) Send the notification whenever it is needed, according to the notification message defined in the WSDL

Example:

DeployedPackagesNotificationMessageType message = new DeployedPackagesNotificationMessage ();
message.setX(…);
message.setY(…)

deployedPackagesT.notify(message);

Service security

Configuring gContainer with Security

Configuring gCube Service with Credentials