addthis/hydra — pull request #27 by mspiegel (2014-02-12 15:57:04+00:00)
Title: Dynamic loader implementation

This is an alternate proposal for https://github.com/addthis/hydra/pull/24. Dynamic class loading is specified with the command-line option -Dhydra.loader=[URI to configuration]. The configuration file is a CSV formatted file. Each row must have either two columns or four columns.

A row with two columns has the format:
```
[fully qualified class name], [URI to jar with with class].
```
A row with four columns has the format:
```
[fully qualified class name], [URI to jar with with class], "executable", [name of executable]
```
I have tested the four column format by creating a jar that contained a class HelloWorld with a static main() method that prints out "Hello World". In my configuration file I specified:
```
"HelloWorld", "file:///path/to/archive.jar", "executable", "task"
```
By running on the command line the following command:
```
java -Dhydra.loader=file:///path/to/hydra.conf -jar hydra-uber/target/hydra-uber-4.1.3-SNAPSHOT-exec.jar task
```
I was able to print out "hello world" instead of running a hydra task. Hooray for class injection.

I have not tested the two column version of this implementation. The Codec library is not designed to load classes from alternate class loaders. The same deficiancy applies to the original proposal https://github.com/addthis/hydra/pull/24. It is outside of scope to fix that bug. This proposal is only for executable classes and we can address the Codec issue at a later time.