org.springframework.data.hadoop.cascading
Class CascadingRunner

java.lang.Object
  extended by org.springframework.data.hadoop.cascading.CascadingRunner
All Implemented Interfaces:
Callable<CascadingStats>, DisposableBean, InitializingBean

public class CascadingRunner
extends Object
implements InitializingBean, Callable<CascadingStats>

Simple runner for executing Cascades or Flows. By default, the runner waits for the jobs to finish and returns its status. To make the runner execute at startup, use setRunAtStartup(boolean).

Author:
Costin Leau

Field Summary
protected  org.apache.commons.logging.Log log
           
protected  UnitOfWork<? extends CascadingStats> uow
           
protected  boolean waitToComplete
           
 
Constructor Summary
CascadingRunner()
           
 
Method Summary
 void afterPropertiesSet()
           
 CascadingStats call()
           
 void destroy()
           
protected  CascadingStats execute()
           
 boolean isWaitForCompletion()
          Indicates whether the 'runner' should wait for the UnitOfWork to complete (default).
 void setPostAction(Collection<Callable<?>> actions)
          Actions to be invoked after running the action.
 void setPreAction(Collection<Callable<?>> actions)
          Actions to be invoked before running the action.
 void setRunAtStartup(boolean runAtStartup)
          Sets the run at startup.
 void setUnitOfWork(UnitOfWork<? extends CascadingStats> uow)
          Sets the unit of work.
 void setWaitForCompletion(boolean waitForCompletion)
          Indicates whether the 'runner' should wait for the UnitOfWork to complete (default) after submission or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

waitToComplete

protected boolean waitToComplete

uow

protected UnitOfWork<? extends CascadingStats> uow

log

protected org.apache.commons.logging.Log log
Constructor Detail

CascadingRunner

public CascadingRunner()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

call

public CascadingStats call()
                    throws Exception
Specified by:
call in interface Callable<CascadingStats>
Throws:
Exception

setRunAtStartup

public void setRunAtStartup(boolean runAtStartup)
Sets the run at startup.

Parameters:
runAtStartup - The runAtStartup to set.

setPreAction

public void setPreAction(Collection<Callable<?>> actions)
Actions to be invoked before running the action.

Parameters:
actions -

setPostAction

public void setPostAction(Collection<Callable<?>> actions)
Actions to be invoked after running the action.

Parameters:
actions -

execute

protected CascadingStats execute()

destroy

public void destroy()
Specified by:
destroy in interface DisposableBean

setUnitOfWork

public void setUnitOfWork(UnitOfWork<? extends CascadingStats> uow)
Sets the unit of work. Can be of type Flow or Cascade.

Parameters:
uow - the new unit of work.

isWaitForCompletion

public boolean isWaitForCompletion()
Indicates whether the 'runner' should wait for the UnitOfWork to complete (default).

Returns:
whether the runner waits for the unit to complete or not.

setWaitForCompletion

public void setWaitForCompletion(boolean waitForCompletion)
Indicates whether the 'runner' should wait for the UnitOfWork to complete (default) after submission or not.

Parameters:
waitForCompletion - whether to wait for the unit to complete or not.