|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.umd.cloud9.util.HadoopTask
public abstract class HadoopTask
An abstract class representing a generic Hadoop task. This class provides a way to package together one or more MapReduce job in a common parameter-passing interface. The standard way to invoke a HadoopTask is:
Configuration config = new Configuration();
config.set("param1", value1);
config.set("param2", value2);
...
ConcreteHadoopTask task = new ConcreteHadoopTask(config);
task.run();
To implement a concrete HadoopTask, extend this class and implement
runTask() and getRequiredParameters():
public static final String[] RequiredParameters = { "a", "b", "c" };
public String[] getRequiredParameters() {
return RequiredParameters;
}
public void runTask() throws Exception {
// set up and run the MapReduce job
}
Code in the abstract HadoopTask class will handle checking to make sure all required parameters are present.
| Constructor Summary | |
|---|---|
HadoopTask(Configuration conf)
Creates a HadoopTask. |
|
| Method Summary | |
|---|---|
Configuration |
getConf()
Returns the Configuration object associated with this HadoopTask. |
abstract String[] |
getRequiredParameters()
Returns the required parameters for this HadoopTask. |
void |
run()
Runs this HadoopTask |
abstract void |
runTask()
Called by run() after verifying that required parameters are
present. |
void |
setConf(Configuration conf)
Sets the Configuration object associated with this HadoopTask. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HadoopTask(Configuration conf)
conf - | Method Detail |
|---|
public Configuration getConf()
getConf in interface Configurablepublic void setConf(Configuration conf)
setConf in interface Configurableconf - the Configuration object associated with this HadoopTask
public void run()
throws Exception
Exception
public abstract void runTask()
throws Exception
run() after verifying that required parameters are
present. This is an abstract method that must be implemented by the
concrete class.
Exceptionpublic abstract String[] getRequiredParameters()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||