job.setJobName(name);
}
private Configuration createStreamJob(Configuration cfg, String[] args) {
// ugly reflection to add an extra method to #createJob
StreamJob job = new StreamJob();
job.setConf(cfg);
Field argv = ReflectionUtils.findField(job.getClass(), "argv_");
// job.argv_ = args
ReflectionUtils.makeAccessible(argv);
ReflectionUtils.setField(argv, job, args);
// job.init();
invokeMethod(job, "init");
// job.preProcessArgs();
invokeMethod(job, "preProcessArgs");
// job.parseArgv();
invokeMethod(job, "parseArgv");
// job.postProcessArgs();
invokeMethod(job, "postProcessArgs");
// job.setJobConf();
invokeMethod(job, "setJobConf");
// return job.jobConf_;
Field jobConf = ReflectionUtils.findField(job.getClass(), "jobConf_");
ReflectionUtils.makeAccessible(jobConf);
return (Configuration) ReflectionUtils.getField(jobConf, job);
}