org.springframework.data.hadoop.hive
Class HiveRunner

java.lang.Object
  extended by org.springframework.data.hadoop.hive.HiveRunner
All Implemented Interfaces:
Callable<List<String>>, InitializingBean

public class HiveRunner
extends Object
implements Callable<List<String>>

Basic runner for Hive scripts inside a Spring environment. For more advanced functionality, consider using Spring Batch and the HiveTasklet. To make the runner execute at startup, use setRunAtStartup(boolean).

Author:
Costin Leau

Constructor Summary
HiveRunner()
           
 
Method Summary
 void afterPropertiesSet()
           
 List<String> call()
           
protected  List<String> executeHiveScripts()
           
 void setHiveClientFactory(HiveClientFactory hiveClientFactory)
          Sets the hive client for this tasklet.
 void setHiveTemplate(HiveOperations hiveTemplate)
          Sets the hive template.
 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)
          Indicates whether the scripts should run at container startup or not (the default).
 void setScripts(Collection<HiveScript> scripts)
          Sets the scripts to be executed by this tasklet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HiveRunner

public HiveRunner()
Method Detail

afterPropertiesSet

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

call

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

setRunAtStartup

public void setRunAtStartup(boolean runAtStartup)
Indicates whether the scripts should run at container startup or not (the default).

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 -

executeHiveScripts

protected List<String> executeHiveScripts()

setScripts

public void setScripts(Collection<HiveScript> scripts)
Sets the scripts to be executed by this tasklet.

Parameters:
scripts - The scripts to set.

setHiveClientFactory

public void setHiveClientFactory(HiveClientFactory hiveClientFactory)
Sets the hive client for this tasklet.

Parameters:
hiveClientFactory - hiveFactory to set

setHiveTemplate

public void setHiveTemplate(HiveOperations hiveTemplate)
Sets the hive template.

Parameters:
hiveTemplate - the new hive template