|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.data.hadoop.mapreduce.JarRunner
public class JarRunner
Factory bean for executing Hadoop jars. Tries a best-effort in passing the configuration to the jar and preventing malicious behaviour (such as System.exit()).
See the reference documentation for more details.
Using the Tool
interface is highly recommended in all cases.
setRunAtStartup(boolean)
.
Constructor Summary | |
---|---|
JarRunner()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
Integer |
call()
|
protected ClassLoader |
createClassLoaderForJar(Resource jar,
ClassLoader parentCL,
Configuration cfg)
|
protected Object |
invokeTargetObject(Configuration cfg,
Object target,
Class<Object> targetClass,
String[] args)
|
protected Class<T> |
loadClass(String className,
ClassLoader cl)
|
protected void |
postExecution(Configuration cfg)
|
protected void |
preExecution(Configuration cfg)
|
protected Configuration |
resolveConfiguration()
|
protected Class<T> |
resolveTargetClass(Configuration cfg)
|
protected Object |
resolveTargetObject(Class<Object> type)
|
void |
setArchives(Resource... archives)
Sets the archives to be unarchive to the map reduce cluster. |
void |
setArguments(String... arguments)
Sets the arguments. |
void |
setBeanClassLoader(ClassLoader classLoader)
|
void |
setCloseFs(boolean closeFs)
Indicates whether or not to close the Hadoop file-systems resulting from the custom code execution. |
void |
setConfiguration(Configuration configuration)
Sets the configuration. |
void |
setFiles(Resource... files)
Sets the files to be copied to the map reduce cluster. |
void |
setJar(Resource jar)
Sets the target code jar. |
void |
setLibs(Resource... libJars)
Sets the jar files to include in the classpath. |
void |
setMainClass(String className)
Sets the target class by name. |
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 |
setProperties(Properties properties)
Sets the properties. |
void |
setRunAtStartup(boolean runAtStartup)
Indicates whether the jar should run at container startup or not (the default). |
void |
setUser(String user)
Sets the user impersonation (optional) for running this job. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JarRunner()
Method Detail |
---|
public Integer call() throws Exception
call
in interface Callable<Integer>
Exception
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void setRunAtStartup(boolean runAtStartup)
runAtStartup
- The runAtStartup to set.public void setPreAction(Collection<Callable<?>> actions)
actions
- public void setPostAction(Collection<Callable<?>> actions)
actions
- protected ClassLoader createClassLoaderForJar(Resource jar, ClassLoader parentCL, Configuration cfg)
protected Object resolveTargetObject(Class<Object> type)
protected Object invokeTargetObject(Configuration cfg, Object target, Class<Object> targetClass, String[] args) throws Exception
Exception
protected void preExecution(Configuration cfg)
protected void postExecution(Configuration cfg)
public void setMainClass(String className)
className
- the target class nameprotected Configuration resolveConfiguration()
protected Class<T> resolveTargetClass(Configuration cfg) throws Exception
Exception
protected Class<T> loadClass(String className, ClassLoader cl)
public void setJar(Resource jar)
jar
- public void setArguments(String... arguments)
arguments
- The arguments to set.public void setConfiguration(Configuration configuration)
configuration
- The configuration to set.public void setProperties(Properties properties)
properties
- The properties to set.public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
public void setCloseFs(boolean closeFs)
closeFs
- the new close fspublic void setLibs(Resource... libJars)
mydir/*.jar
), which the
Spring container will automatically resolve.
libJars
- The jar files to include in the classpath.public void setFiles(Resource... files)
mydir/*.txt
), which the
Spring container will automatically resolve.
files
- The files to copy.public void setArchives(Resource... archives)
mydir/*.zip
), which the
Spring container will automatically resolve.
archives
- The archives to unarchive on the compute machines.public void setUser(String user)
user
- user/group information
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |