dimalabs/ozone — pull request #73 by aljoscha (2013-09-03 11:54:22+00:00)
Title: Switch to using objects instead of classes for usercode

Hi Everyone,
I'm opening this pull request to start a discussion on this new feature. I changed the whole stratosphere stack to use objects instead of classes to pass usercode (i.e. Stubs) around. This means that one now uses
MapContract mapper = MapContract.builder(new TokenizeLine())
.input(source)
.name("Tokenize Lines")
.build();
instead of
MapContract mapper = MapContract.builder(TokenizeLine.class)
.input(source)
.name("Tokenize Lines")
.build();

The initial motivation for this is that I require it for the scala-frontend. I cannot generate classes that would be instantiable by the stratosphere runtime so I need to pass objects to the PACTs. I noticed though that this could also make regular java usercode more concise. The Configuration would not be necessary any more because one can just store the configuration in the stub object and for example have a stub with a constructor where you pass in stuff, i.e.:
MapContract mapper = MapContract.builder(new TokenizeLine(""))
.input(source)
.name("Tokenize Lines")
.build();
The line ending would then be stored in the stub, the runtime serializes everything and then when the job is run the runtime deserializes the job and the information is available in every instance of the stub.

On thing that is affected by the change is that all usercode stubs now must be serializable. For this I made base class Stub "Serializable" and also other things such as Value and the derived classes.

Now, discuss away... :D

Aljoscha