Spring for Apache Hadoop

org.springframework.data.hadoop.cascading
Class CascadingRunner

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

public class CascadingRunner
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean, java.util.concurrent.Callable<cascading.stats.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  cascading.management.UnitOfWork<? extends cascading.stats.CascadingStats> uow
           
protected  boolean waitToComplete
           
 
Constructor Summary
CascadingRunner()
           
 
Method Summary
 void afterPropertiesSet()
           
 cascading.stats.CascadingStats call()
           
 void destroy()
           
protected  cascading.stats.CascadingStats execute()
           
 boolean isWaitForCompletion()
          Indicates whether the 'runner' should wait for the UnitOfWork to complete (default).
 void setPostAction(java.util.Collection<java.util.concurrent.Callable<?>> actions)
          Actions to be invoked after running the action.
 void setPreAction(java.util.Collection<java.util.concurrent.Callable<?>> actions)
          Actions to be invoked before running the action.
 void setRunAtStartup(boolean runAtStartup)
          Sets the run at startup.
 void setUnitOfWork(cascading.management.UnitOfWork<? extends cascading.stats.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 cascading.management.UnitOfWork<? extends cascading.stats.CascadingStats> uow

log

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

CascadingRunner

public CascadingRunner()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

call

public cascading.stats.CascadingStats call()
                                    throws java.lang.Exception
Specified by:
call in interface java.util.concurrent.Callable<cascading.stats.CascadingStats>
Throws:
java.lang.Exception

setRunAtStartup

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

Parameters:
runAtStartup - The runAtStartup to set.

setPreAction

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

Parameters:
actions -

setPostAction

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

Parameters:
actions -

execute

protected cascading.stats.CascadingStats execute()

destroy

public void destroy()
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean

setUnitOfWork

public void setUnitOfWork(cascading.management.UnitOfWork<? extends cascading.stats.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.

Spring for Apache Hadoop