public class HdfsScriptRunner
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware
These are :
Name | Type | Description |
---|---|---|
cfg | org.apache.hadoop.conf.Configuration | Hadoop Configuration (relies on 'hadoop-configuration' bean or singleton type match) |
cl | java.lang.ClassLoader | ClassLoader used for executing this script |
ctx | org.springframework.context.ApplicationContext | Enclosing application context |
ctxRL | org.springframework.io.support.ResourcePatternResolver | Enclosing application context ResourceLoader (same as ctx) |
distcp | org.springframework.data.hadoop.fs.DistributedCopyUtil | programmatic access to DistCp |
fs | org.apache.hadoop.fs.FileSystem | Hadoop File System (relies on 'hadoop-fs' bean or singleton type match, falls back to creating one based on 'cfg') |
fsh | org.springframework.data.hadoop.fs.FsShell | File System shell, exposing hadoop 'fs' commands as an API |
hdfsRL | org.springframework.data.hadoop.io.HdfsResourceLoader | HdfsResourceLoader (relies on 'hadoop-resource-loader' or singleton type match, falls back to creating one automatically based on 'cfg') |
Note that the above variables are added only if found (have a non-null value) and the keys are not bound already.
To make the runner execute at startup, use setRunAtStartup(boolean)
.
HdfsResourceLoader
,
FsShell
,
ApplicationContext
Constructor and Description |
---|
HdfsScriptRunner() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
java.lang.Object |
call() |
boolean |
isRunAtStartup()
Indicates whether the script gets executed once the factory bean initializes.
|
protected void |
postProcess(java.util.Map<java.lang.String,java.lang.Object> args)
Method for post-processing arguments.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setArguments(java.util.Map<java.lang.String,java.lang.Object> arguments)
Sets the arguments for evaluating this script.
|
void |
setBeanClassLoader(java.lang.ClassLoader classLoader) |
void |
setConfiguration(org.apache.hadoop.conf.Configuration configuration)
Sets the Hadoop configuration to use.
|
void |
setEvaluate(EvaluationPolicy evaluation)
Sets the way the script is evaluated.
|
void |
setExtension(java.lang.String extension)
Sets the script extension.
|
void |
setLanguage(java.lang.String language)
Sets the script language.
|
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)
Indicates whether to evaluate the script at startup (default) or not.
|
void |
setScriptSource(org.springframework.scripting.ScriptSource script)
Sets the script source to evaluate.
|
protected void postProcess(java.util.Map<java.lang.String,java.lang.Object> args)
args
- The arguments.public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
configuration
- The configuration to set.public java.lang.Object call() throws java.lang.Exception
call
in interface java.util.concurrent.Callable<java.lang.Object>
java.lang.Exception
public void setBeanClassLoader(java.lang.ClassLoader classLoader)
setBeanClassLoader
in interface org.springframework.beans.factory.BeanClassLoaderAware
public void setScriptSource(org.springframework.scripting.ScriptSource script)
script
- The script to evaluate.public void setLanguage(java.lang.String language)
language
- The script language.public void setExtension(java.lang.String extension)
extension
- The extension to set.public void setEvaluate(EvaluationPolicy evaluation)
evaluation
- The evaluation.public void setArguments(java.util.Map<java.lang.String,java.lang.Object> arguments)
arguments
- The arguments to set.public boolean isRunAtStartup()
public void setRunAtStartup(boolean runAtStartup)
runAtStartup
- The runStartUp to set.public void setPreAction(java.util.Collection<java.util.concurrent.Callable<?>> actions)
actions
- The actions.public void setPostAction(java.util.Collection<java.util.concurrent.Callable<?>> actions)
actions
- The actions.