org.apache.s4.comm.topology
Class ZNRecordSerializer

java.lang.Object
  extended by org.apache.s4.comm.topology.ZNRecordSerializer
All Implemented Interfaces:
org.I0Itec.zkclient.serialize.ZkSerializer

public class ZNRecordSerializer
extends java.lang.Object
implements org.I0Itec.zkclient.serialize.ZkSerializer

Utility to serialize/deserialize data in ZK.
Using Json format and Gson library. TODO: Explore other libraries like jackson much richer features. Gson needs no-arg constructor to work with without additional work


Constructor Summary
ZNRecordSerializer()
           
 
Method Summary
 java.lang.Object deserialize(byte[] bytes)
           
 byte[] serialize(java.lang.Object data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZNRecordSerializer

public ZNRecordSerializer()
Method Detail

serialize

public byte[] serialize(java.lang.Object data)
                 throws org.I0Itec.zkclient.exception.ZkMarshallingError
Specified by:
serialize in interface org.I0Itec.zkclient.serialize.ZkSerializer
Throws:
org.I0Itec.zkclient.exception.ZkMarshallingError

deserialize

public java.lang.Object deserialize(byte[] bytes)
                             throws org.I0Itec.zkclient.exception.ZkMarshallingError
Specified by:
deserialize in interface org.I0Itec.zkclient.serialize.ZkSerializer
Throws:
org.I0Itec.zkclient.exception.ZkMarshallingError