org.gcube.common.core.utils.handlers
Interface GCUBEIHandler<HANDLED>

Type Parameters:
HANDLED - the type of the handled object.
All Known Subinterfaces:
Lifetime<HANDLED>
All Known Implementing Classes:
GCUBEComplexHandler, GCUBEHandler, GCUBEHandlerConnector, GCUBENotificationProbe, GCUBEParallelHandler, GCUBEScheduledHandler, GCUBESequentialHandler, GCUBEServiceHandler, GCUBEStagingServiceHandler, GCUBEStatefulServiceHandler, GCUBETestProbe, LocalMonitor, RICall.RICallHandler, Scheduler, StagingCall.StagingHandler, WSCall.WSCallHandler

public interface GCUBEIHandler<HANDLED>

Characterises the behaviour of handlers, i.e. objects that model arbitrary tasks.

A handler:

Author:
Fabio Simeoni (University of Strathclyde)
See Also:
GCUBEHandler

Method Summary
 void clearBlackboard()
          Clears the blackboard.
 Map<String,Object> getBlackboard()
          Returns the blackboard.
 HANDLED getHandled()
          Returns the handled object.
 String getId()
          Returns the identifier of the handler.
 GCUBELog getLogger()
          Returns the logger.
 String getName()
          Returns the name of the handler, by default, the name of its class.
 GCUBEScopeManager getScopeManager()
          Returns the scope manager of the handler.
 GCUBESecurityManager getSecurityManager()
          Returns the security manager of the handler.
 void run()
          Executes the task implemented by the handler.
 void setBlackboard(Map<String,Object> blackboard)
          Sets the blackboard.
 void setHandled(HANDLED handled)
          Sets the handled object.
 void setLogger(GCUBELog logger)
          Sets the logger.
 void setName(String name)
          Sets the name of the handler.
 void setScopeManager(GCUBEScopeManager manager)
          Sets a scope manager for the handler.
 void setSecurityManager(GCUBESecurityManager manager)
          Sets a security manager for the handler.
 void subscribe(Monitor monitor, Topic... topics)
          Subscribes a Monitor to one or more Topics.
 void undo()
          Reverts the actions of the handler.
 void unsubscribe(Monitor monitor, Topic... topics)
          Unsubscribes a Monitor from one or more Topics.
 

Method Detail

setLogger

void setLogger(GCUBELog logger)
Sets the logger.

Parameters:
logger - the logger.

getLogger

GCUBELog getLogger()
Returns the logger.

Returns:
the logger.

run

void run()
         throws Exception
Executes the task implemented by the handler.

Throws:
Exception - if the execution of the task does not complete normally.

getHandled

HANDLED getHandled()
Returns the handled object.

Returns:
the handled object.

setHandled

void setHandled(HANDLED handled)
Sets the handled object.

Parameters:
handled - the handled object.

getBlackboard

Map<String,Object> getBlackboard()
Returns the blackboard.

Returns:
the blackboard.

setBlackboard

void setBlackboard(Map<String,Object> blackboard)
Sets the blackboard.

Parameters:
blackboard - the blackboard.

clearBlackboard

void clearBlackboard()
Clears the blackboard.


getId

String getId()
Returns the identifier of the handler.

Returns:
the identifier.

getName

String getName()
Returns the name of the handler, by default, the name of its class.

Returns:
the name.

setName

void setName(String name)
Sets the name of the handler.

Parameters:
name - the name.

subscribe

void subscribe(Monitor monitor,
               Topic... topics)
Subscribes a Monitor to one or more Topics.

Parameters:
monitor - the monitor.
topics - (optional) the topics. If omitted, the monitor is subscribed to Topic.LifetimeTopic.

unsubscribe

void unsubscribe(Monitor monitor,
                 Topic... topics)
Unsubscribes a Monitor from one or more Topics.

Parameters:
monitor - the monitor.
topics - (optional) the topics. If omitted, the monitor is subscribed to Topic.LifetimeTopic.

undo

void undo()
Reverts the actions of the handler. By default, it simply debug-logs the invocation. If required, override as per handler semantics. For robustness, do not assume the invocation occurs after the execution of the handler.


setScopeManager

void setScopeManager(GCUBEScopeManager manager)
Sets a scope manager for the handler.

Parameters:
manager - the manager.

getScopeManager

GCUBEScopeManager getScopeManager()
Returns the scope manager of the handler.

Returns:
the manager.

setSecurityManager

void setSecurityManager(GCUBESecurityManager manager)
Sets a security manager for the handler.

Parameters:
manager - the manager.

getSecurityManager

GCUBESecurityManager getSecurityManager()
Returns the security manager of the handler.

Returns:
the manager.


Copyright © 2012. All Rights Reserved.