|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.common.core.utils.handlers.GCUBEHandler<HANDLED>
HANDLED - the type of the handled object.public abstract class GCUBEHandler<HANDLED>
A partial implementation of GCUBEIHandler.
In particular, a GCUBEHandler:
Lifetime for handlers that manage their own lifetime.
GCUBEHandler implements Lifetime but does not declare it.
Subclasses that commit to invoking those methods should do so. Those
that do not make this commitment define handlers that remain permanently in the State.Created state.
| Field Summary | |
|---|---|
protected HANDLED |
handled
The handled object. |
protected GCUBELog |
logger
Object logger. |
protected GCUBEProducer<Topic,Object> |
producer
Internal event producer. |
| Constructor Summary | |
|---|---|
GCUBEHandler()
Creates an instance. |
|
GCUBEHandler(HANDLED handled)
Creates an instance with a given handled object. |
|
| 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. |
|
State |
getState()
See Lifetime.getState(). |
|
protected
|
notify(TOPIC topic,
Event<TOPIC,?> e)
Notifies all subscribed monitors of an Event about an associated Topic. |
|
abstract void |
run()
Executes the task implemented by the handler. |
|
void |
setBlackboard(Map<String,Object> state)
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 |
setState(State state)
Sets the state of 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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected GCUBELog logger
protected HANDLED handled
protected GCUBEProducer<Topic,Object> producer
| Constructor Detail |
|---|
public GCUBEHandler()
public GCUBEHandler(HANDLED handled)
handled - the handled object.| Method Detail |
|---|
public void setLogger(GCUBELog logger)
setLogger in interface GCUBEIHandler<HANDLED>logger - the logger.public GCUBELog getLogger()
getLogger in interface GCUBEIHandler<HANDLED>
public abstract void run()
throws Exception
run in interface GCUBEIHandler<HANDLED>Exception - if the execution of the task does not complete normally.public HANDLED getHandled()
getHandled in interface GCUBEIHandler<HANDLED>public void setHandled(HANDLED handled)
setHandled in interface GCUBEIHandler<HANDLED>handled - the handled object.public Map<String,Object> getBlackboard()
getBlackboard in interface GCUBEIHandler<HANDLED>public void setBlackboard(Map<String,Object> state)
setBlackboard in interface GCUBEIHandler<HANDLED>state - the blackboard.public void clearBlackboard()
clearBlackboard in interface GCUBEIHandler<HANDLED>public String getId()
getId in interface GCUBEIHandler<HANDLED>public String getName()
getName in interface GCUBEIHandler<HANDLED>public void setName(String name)
setName in interface GCUBEIHandler<HANDLED>name - the name.public void undo()
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.
undo in interface GCUBEIHandler<HANDLED>
public void subscribe(Monitor monitor,
Topic... topics)
Monitor to one or more Topics.
subscribe in interface GCUBEIHandler<HANDLED>monitor - the monitor.topics - (optional) the topics. If omitted, the monitor is subscribed to Topic.LifetimeTopic.
public void unsubscribe(Monitor monitor,
Topic... topics)
Monitor from one or more Topics.
unsubscribe in interface GCUBEIHandler<HANDLED>monitor - the monitor.topics - (optional) the topics. If omitted, the monitor is subscribed to Topic.LifetimeTopic.
protected <TOPIC extends Topic> void notify(TOPIC topic,
Event<TOPIC,?> e)
Event about an associated Topic.
(optional) - the topic.e - the event.public State getState()
Lifetime.getState().
public void setState(State state)
throws IllegalArgumentException,
IllegalStateException
state - the state.
IllegalArgumentException - if the state is null
IllegalStateException - if the handler cannot transition to the state from its current state.public void setSecurityManager(GCUBESecurityManager manager)
setSecurityManager in interface GCUBEIHandler<HANDLED>manager - the manager.public void setScopeManager(GCUBEScopeManager manager)
setScopeManager in interface GCUBEIHandler<HANDLED>manager - the manager.public GCUBESecurityManager getSecurityManager()
getSecurityManager in interface GCUBEIHandler<HANDLED>public GCUBEScopeManager getScopeManager()
getScopeManager in interface GCUBEIHandler<HANDLED>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||