Reference Guide

Table Of Contents
· Package up the class files into a jar in the target directory
· Install the compiled jar into your local Maven cache (~/.m2/repository)
Have the .proto file and generated .java file displayed properly in your IDE from your
project’s root directory, i.e. where the project’s pom.xml file is, execute the following:
· mvn eclipse:clean
· mvn eclipse:eclipse
· Refresh the project in your IDE (Optional: clean the project as well).
As the resulting Java file is protoc generated code it is not recommended that it be checked
in to your local source code management repo but instead regenerated when the
application is built. The GPB Java Tutorial link on the official GPB website gives a more in
depth walk through of the resulting Java class.
Application GPB Usage
Generated GPB message classes are meant to serve as the versioned definition of data
distributed by the Coordination Service. They are not meant to be used directly by the
application to read/write to the various Coordination Services. It is recommended that a
Model Object be defined for this role. This scheme provides two notable benefits:
1) It allows the application to continue to evolve without concern for the data
versioning at the Coordination Service level.
2) It allows the Model Object to define fields for data it may want to store and use
locally for a version of the data but not have that data shared during distribution.
The recommended procedure for versioning Coordination Service data is shown below and
the sections that follow explain each of these steps with examples and best practices.
1) Define a POJO Model Object for the data that the application will want to operate
on and distribute via a Coordination Service.
2) Define a matching GPB .proto Message to specify which field(s) of the Model
Object are required/optional for a given version of message distributed by the
Coordination Services.
3) Implement and register a Custom Serializer with the Coordination Service that will
convert the Model Object the application uses to the GPB message class that will
be distributed.
Model Object
The application developer will define POJOs for his/her application. They will contain data
and methods necessary to the applications processing and may contain data that the
application wishes to distribute to other members of the controller team. Not all fields may
need to be (or want to be) distributed. The only requirement for the Model Object’s
implementation is that the class being written to the different Coordination Services
80