org.gcube.common.core.utils.handlers
Class GCUBESequentialHandler<HANDLED>

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.GCUBEHandler<HANDLED>
      extended by org.gcube.common.core.utils.handlers.GCUBEComplexHandler<HANDLED>
          extended by org.gcube.common.core.utils.handlers.GCUBESequentialHandler<HANDLED>
Type Parameters:
HANDLED - the type of the object handled by the component handlers.
All Implemented Interfaces:
GCUBEIHandler<HANDLED>, Lifetime<HANDLED>

public class GCUBESequentialHandler<HANDLED>
extends GCUBEComplexHandler<HANDLED>
implements Lifetime<HANDLED>

An extension of GCUBEComplexHandler for handlers which chain the execution of their component handlers. A GCUBESequentialHandler propagates its state across the chain as a blackboard based on which component handlers may may communicate in a decoupled fashion. For further decoupling, a GCUBESequentialHandler recognises components which have the semantics of GCUBEHandlerConnectors and connects them to components which immediately precede them and immediately follow them in the chain.

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

Field Summary
 
Fields inherited from class org.gcube.common.core.utils.handlers.GCUBEHandler
handled, logger, producer
 
Constructor Summary
GCUBESequentialHandler(GCUBEIHandler<? extends HANDLED>... components)
          Creates an instance with a list of component handlers.
 
Method Summary
protected  List<GCUBEIHandler<? extends HANDLED>> connectComponents()
          Invoked internally before a run to insert and configure GCUBEHandlerConnectors before running.
 void run()
          Executes the task implemented by the handler.
 
Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEComplexHandler
addHandlers, getHandlers, removeHandler, setLogger, undo
 
Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEHandler
clearBlackboard, getBlackboard, getHandled, getId, getLogger, getName, getScopeManager, getSecurityManager, getState, notify, setBlackboard, setHandled, setName, setScopeManager, setSecurityManager, setState, subscribe, unsubscribe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gcube.common.core.utils.handlers.lifetime.Lifetime
getState
 
Methods inherited from interface org.gcube.common.core.utils.handlers.GCUBEIHandler
clearBlackboard, getBlackboard, getHandled, getId, getLogger, getName, getScopeManager, getSecurityManager, setBlackboard, setHandled, setLogger, setName, setScopeManager, setSecurityManager, subscribe, undo, unsubscribe
 

Constructor Detail

GCUBESequentialHandler

public GCUBESequentialHandler(GCUBEIHandler<? extends HANDLED>... components)
Creates an instance with a list of component handlers.

Parameters:
components - the component handlers.
Method Detail

run

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

Specified by:
run in interface GCUBEIHandler<HANDLED>
Specified by:
run in class GCUBEHandler<HANDLED>
Throws:
Exception - if the execution of the task does not complete normally.

connectComponents

protected List<GCUBEIHandler<? extends HANDLED>> connectComponents()
Invoked internally before a run to insert and configure GCUBEHandlerConnectors before running. In particular, existing connectors are configured and new GCUBEHandlerConnectors are inserted in between non-connector components.

Returns:
the list of component handlers augmented with configured connectors.


Copyright © 2012. All Rights Reserved.