Reference Guide

Table Of Contents
PersonProto.Person message = null;
try {
message = PersonProto.Person.parseFrom(serialization);
} catch (InvalidProtocolBufferException e) {
// Handle the error
}
Person newPerson = new Person();
if (message != null) {
newPerson.setName(message.getName());
newPerson.setId(message.getId());
return newPerson;
}
return null;
}
}
In the serialize() method the builder pattern of the generated GPB message class is used to
create a GPB version of the Person Model Object. After the proper fields are set the
message is built and converted to a byte array for transport. In the deserialize() method on
the receiver the byte array is converted back to the expected GPB message object. An
instance of the Model object is then created and returned to be placed into the
Coordination Service for which the serializer is registered.
The application must register this custom serializer with the Coordination Service it wishes to
use this Model Object and GPB message combination. Below is an example of that
registration process in an OSGI Component of an example application.
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY,
policy = ReferencePolicy.DYNAMIC)
protected volatile CoordinationService coordinationSvc;
@Activate
public void activate() {
// Register Message Serializers
if (coordinationSvc != null) {
coordinationSvc.registerSerializer(new PersonSerializer(),Person.class);
}
}
System Status
The system status (Which can be retrieved using SystemInformationService) depends on two
properties of the controller: Reachability and Health. The following table depicts the status:
83