Created
June 24, 2014 14:04
-
-
Save josiah14/89c5474145c8dd196df9 to your computer and use it in GitHub Desktop.
etl refactor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PersonnelETL extends BaseCommand { | |
@Override | |
protected final int run(CommandLine line) throws Exception { | |
return runETLProcess( | |
line, | |
ObjectGraph.create( | |
new PersonnelModule( | |
getConf(), | |
line.getOptionValue(OPTION_CLIENT), | |
line.getOptionValue(OPTION_POPULATION), | |
line.getOptionValue(OPTION_DATA_VERSION) | |
) | |
) | |
); | |
} | |
... | |
} | |
public abstract class BaseCommand extends Command { | |
... | |
protected int runETLProcess(CommandLine line, ObjectGraph daggerGraph) throws Exception { | |
List<String> errors = validateUsage(line); | |
if (!errors.isEmpty()) { | |
throw new InvalidUsageException(Joiner.on('\n').join(errors)); | |
} | |
try { | |
daggerGraph.inject(this); | |
return runInjected(line); | |
} finally { | |
IOUtils.closeQuietly(shutdown); | |
} | |
} | |
@Override | |
public Options getOptions() { | |
return super | |
.getOptions() | |
.addOption( | |
"V", | |
OPTION_DATA_VERSION, | |
true, | |
"Specifies the version identifier to use for input and output") | |
.addOption("p" , OPTION_POPULATION, true, "Population ID") | |
.addOption("d", OPTION_DRY_RUN, false, "Don't load data into RDBMS.") | |
.addOption("c", OPTION_CLIENT, true, "Client ID"); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment