You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jv...@apache.org on 2013/05/09 22:28:43 UTC

[1/7] flatenned the hierarchy of serialization packages

Updated Branches:
  refs/heads/trunk d36370c9d -> 1e6bb8b02


http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java
----------------------------------------------------------------------
diff --git a/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java b/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java
new file mode 100644
index 0000000..dc702a1
--- /dev/null
+++ b/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java
@@ -0,0 +1,602 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.mina.generated.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserProfile implements org.apache.thrift.TBase<UserProfile, UserProfile._Fields>, java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserProfile");
+
+  private static final org.apache.thrift.protocol.TField UID_FIELD_DESC = new org.apache.thrift.protocol.TField("uid", org.apache.thrift.protocol.TType.I32, (short)1);
+  private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField BLURB_FIELD_DESC = new org.apache.thrift.protocol.TField("blurb", org.apache.thrift.protocol.TType.STRING, (short)3);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new UserProfileStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new UserProfileTupleSchemeFactory());
+  }
+
+  public int uid; // required
+  public String name; // required
+  public String blurb; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    UID((short)1, "uid"),
+    NAME((short)2, "name"),
+    BLURB((short)3, "blurb");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // UID
+          return UID;
+        case 2: // NAME
+          return NAME;
+        case 3: // BLURB
+          return BLURB;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private static final int __UID_ISSET_ID = 0;
+  private byte __isset_bitfield = 0;
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.UID, new org.apache.thrift.meta_data.FieldMetaData("uid", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.BLURB, new org.apache.thrift.meta_data.FieldMetaData("blurb", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserProfile.class, metaDataMap);
+  }
+
+  public UserProfile() {
+  }
+
+  public UserProfile(
+    int uid,
+    String name,
+    String blurb)
+  {
+    this();
+    this.uid = uid;
+    setUidIsSet(true);
+    this.name = name;
+    this.blurb = blurb;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public UserProfile(UserProfile other) {
+    __isset_bitfield = other.__isset_bitfield;
+    this.uid = other.uid;
+    if (other.isSetName()) {
+      this.name = other.name;
+    }
+    if (other.isSetBlurb()) {
+      this.blurb = other.blurb;
+    }
+  }
+
+  public UserProfile deepCopy() {
+    return new UserProfile(this);
+  }
+
+  @Override
+  public void clear() {
+    setUidIsSet(false);
+    this.uid = 0;
+    this.name = null;
+    this.blurb = null;
+  }
+
+  public int getUid() {
+    return this.uid;
+  }
+
+  public UserProfile setUid(int uid) {
+    this.uid = uid;
+    setUidIsSet(true);
+    return this;
+  }
+
+  public void unsetUid() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __UID_ISSET_ID);
+  }
+
+  /** Returns true if field uid is set (has been assigned a value) and false otherwise */
+  public boolean isSetUid() {
+    return EncodingUtils.testBit(__isset_bitfield, __UID_ISSET_ID);
+  }
+
+  public void setUidIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UID_ISSET_ID, value);
+  }
+
+  public String getName() {
+    return this.name;
+  }
+
+  public UserProfile setName(String name) {
+    this.name = name;
+    return this;
+  }
+
+  public void unsetName() {
+    this.name = null;
+  }
+
+  /** Returns true if field name is set (has been assigned a value) and false otherwise */
+  public boolean isSetName() {
+    return this.name != null;
+  }
+
+  public void setNameIsSet(boolean value) {
+    if (!value) {
+      this.name = null;
+    }
+  }
+
+  public String getBlurb() {
+    return this.blurb;
+  }
+
+  public UserProfile setBlurb(String blurb) {
+    this.blurb = blurb;
+    return this;
+  }
+
+  public void unsetBlurb() {
+    this.blurb = null;
+  }
+
+  /** Returns true if field blurb is set (has been assigned a value) and false otherwise */
+  public boolean isSetBlurb() {
+    return this.blurb != null;
+  }
+
+  public void setBlurbIsSet(boolean value) {
+    if (!value) {
+      this.blurb = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case UID:
+      if (value == null) {
+        unsetUid();
+      } else {
+        setUid((Integer)value);
+      }
+      break;
+
+    case NAME:
+      if (value == null) {
+        unsetName();
+      } else {
+        setName((String)value);
+      }
+      break;
+
+    case BLURB:
+      if (value == null) {
+        unsetBlurb();
+      } else {
+        setBlurb((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case UID:
+      return Integer.valueOf(getUid());
+
+    case NAME:
+      return getName();
+
+    case BLURB:
+      return getBlurb();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case UID:
+      return isSetUid();
+    case NAME:
+      return isSetName();
+    case BLURB:
+      return isSetBlurb();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof UserProfile)
+      return this.equals((UserProfile)that);
+    return false;
+  }
+
+  public boolean equals(UserProfile that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_uid = true;
+    boolean that_present_uid = true;
+    if (this_present_uid || that_present_uid) {
+      if (!(this_present_uid && that_present_uid))
+        return false;
+      if (this.uid != that.uid)
+        return false;
+    }
+
+    boolean this_present_name = true && this.isSetName();
+    boolean that_present_name = true && that.isSetName();
+    if (this_present_name || that_present_name) {
+      if (!(this_present_name && that_present_name))
+        return false;
+      if (!this.name.equals(that.name))
+        return false;
+    }
+
+    boolean this_present_blurb = true && this.isSetBlurb();
+    boolean that_present_blurb = true && that.isSetBlurb();
+    if (this_present_blurb || that_present_blurb) {
+      if (!(this_present_blurb && that_present_blurb))
+        return false;
+      if (!this.blurb.equals(that.blurb))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_uid = true;
+    builder.append(present_uid);
+    if (present_uid)
+      builder.append(uid);
+
+    boolean present_name = true && (isSetName());
+    builder.append(present_name);
+    if (present_name)
+      builder.append(name);
+
+    boolean present_blurb = true && (isSetBlurb());
+    builder.append(present_blurb);
+    if (present_blurb)
+      builder.append(blurb);
+
+    return builder.toHashCode();
+  }
+
+  public int compareTo(UserProfile other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    UserProfile typedOther = (UserProfile)other;
+
+    lastComparison = Boolean.valueOf(isSetUid()).compareTo(typedOther.isSetUid());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUid()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uid, typedOther.uid);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetName()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetBlurb()).compareTo(typedOther.isSetBlurb());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetBlurb()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.blurb, typedOther.blurb);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("UserProfile(");
+    boolean first = true;
+
+    sb.append("uid:");
+    sb.append(this.uid);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("name:");
+    if (this.name == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.name);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("blurb:");
+    if (this.blurb == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.blurb);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bitfield = 0;
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class UserProfileStandardSchemeFactory implements SchemeFactory {
+    public UserProfileStandardScheme getScheme() {
+      return new UserProfileStandardScheme();
+    }
+  }
+
+  private static class UserProfileStandardScheme extends StandardScheme<UserProfile> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, UserProfile struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // UID
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.uid = iprot.readI32();
+              struct.setUidIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // NAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.name = iprot.readString();
+              struct.setNameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // BLURB
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.blurb = iprot.readString();
+              struct.setBlurbIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, UserProfile struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      oprot.writeFieldBegin(UID_FIELD_DESC);
+      oprot.writeI32(struct.uid);
+      oprot.writeFieldEnd();
+      if (struct.name != null) {
+        oprot.writeFieldBegin(NAME_FIELD_DESC);
+        oprot.writeString(struct.name);
+        oprot.writeFieldEnd();
+      }
+      if (struct.blurb != null) {
+        oprot.writeFieldBegin(BLURB_FIELD_DESC);
+        oprot.writeString(struct.blurb);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class UserProfileTupleSchemeFactory implements SchemeFactory {
+    public UserProfileTupleScheme getScheme() {
+      return new UserProfileTupleScheme();
+    }
+  }
+
+  private static class UserProfileTupleScheme extends TupleScheme<UserProfile> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, UserProfile struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetUid()) {
+        optionals.set(0);
+      }
+      if (struct.isSetName()) {
+        optionals.set(1);
+      }
+      if (struct.isSetBlurb()) {
+        optionals.set(2);
+      }
+      oprot.writeBitSet(optionals, 3);
+      if (struct.isSetUid()) {
+        oprot.writeI32(struct.uid);
+      }
+      if (struct.isSetName()) {
+        oprot.writeString(struct.name);
+      }
+      if (struct.isSetBlurb()) {
+        oprot.writeString(struct.blurb);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, UserProfile struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(3);
+      if (incoming.get(0)) {
+        struct.uid = iprot.readI32();
+        struct.setUidIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.name = iprot.readString();
+        struct.setNameIsSet(true);
+      }
+      if (incoming.get(2)) {
+        struct.blurb = iprot.readString();
+        struct.setBlurbIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java
----------------------------------------------------------------------
diff --git a/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java b/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java
new file mode 100644
index 0000000..d51c1b9
--- /dev/null
+++ b/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java
@@ -0,0 +1,1596 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.mina.generated.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserStorage {
+
+  public interface Iface {
+
+    public void store(UserProfile user) throws org.apache.thrift.TException;
+
+    public UserProfile retrieve(int uid) throws org.apache.thrift.TException;
+
+  }
+
+  public interface AsyncIface {
+
+    public void store(UserProfile user, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.store_call> resultHandler) throws org.apache.thrift.TException;
+
+    public void retrieve(int uid, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.retrieve_call> resultHandler) throws org.apache.thrift.TException;
+
+  }
+
+  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+      public Factory() {}
+      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+        return new Client(prot);
+      }
+      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+        return new Client(iprot, oprot);
+      }
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol prot)
+    {
+      super(prot, prot);
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+      super(iprot, oprot);
+    }
+
+    public void store(UserProfile user) throws org.apache.thrift.TException
+    {
+      send_store(user);
+      recv_store();
+    }
+
+    public void send_store(UserProfile user) throws org.apache.thrift.TException
+    {
+      store_args args = new store_args();
+      args.setUser(user);
+      sendBase("store", args);
+    }
+
+    public void recv_store() throws org.apache.thrift.TException
+    {
+      store_result result = new store_result();
+      receiveBase(result, "store");
+      return;
+    }
+
+    public UserProfile retrieve(int uid) throws org.apache.thrift.TException
+    {
+      send_retrieve(uid);
+      return recv_retrieve();
+    }
+
+    public void send_retrieve(int uid) throws org.apache.thrift.TException
+    {
+      retrieve_args args = new retrieve_args();
+      args.setUid(uid);
+      sendBase("retrieve", args);
+    }
+
+    public UserProfile recv_retrieve() throws org.apache.thrift.TException
+    {
+      retrieve_result result = new retrieve_result();
+      receiveBase(result, "retrieve");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "retrieve failed: unknown result");
+    }
+
+  }
+  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
+    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
+      private org.apache.thrift.async.TAsyncClientManager clientManager;
+      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+        this.clientManager = clientManager;
+        this.protocolFactory = protocolFactory;
+      }
+      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+        return new AsyncClient(protocolFactory, clientManager, transport);
+      }
+    }
+
+    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+      super(protocolFactory, clientManager, transport);
+    }
+
+    public void store(UserProfile user, org.apache.thrift.async.AsyncMethodCallback<store_call> resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      store_call method_call = new store_call(user, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class store_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private UserProfile user;
+      public store_call(UserProfile user, org.apache.thrift.async.AsyncMethodCallback<store_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.user = user;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("store", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        store_args args = new store_args();
+        args.setUser(user);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public void getResult() throws org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        (new Client(prot)).recv_store();
+      }
+    }
+
+    public void retrieve(int uid, org.apache.thrift.async.AsyncMethodCallback<retrieve_call> resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      retrieve_call method_call = new retrieve_call(uid, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class retrieve_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private int uid;
+      public retrieve_call(int uid, org.apache.thrift.async.AsyncMethodCallback<retrieve_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.uid = uid;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("retrieve", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        retrieve_args args = new retrieve_args();
+        args.setUid(uid);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public UserProfile getResult() throws org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_retrieve();
+      }
+    }
+
+  }
+
+  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
+    public Processor(I iface) {
+      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+    }
+
+    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      processMap.put("store", new store());
+      processMap.put("retrieve", new retrieve());
+      return processMap;
+    }
+
+    public static class store<I extends Iface> extends org.apache.thrift.ProcessFunction<I, store_args> {
+      public store() {
+        super("store");
+      }
+
+      public store_args getEmptyArgsInstance() {
+        return new store_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public store_result getResult(I iface, store_args args) throws org.apache.thrift.TException {
+        store_result result = new store_result();
+        iface.store(args.user);
+        return result;
+      }
+    }
+
+    public static class retrieve<I extends Iface> extends org.apache.thrift.ProcessFunction<I, retrieve_args> {
+      public retrieve() {
+        super("retrieve");
+      }
+
+      public retrieve_args getEmptyArgsInstance() {
+        return new retrieve_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public retrieve_result getResult(I iface, retrieve_args args) throws org.apache.thrift.TException {
+        retrieve_result result = new retrieve_result();
+        result.success = iface.retrieve(args.uid);
+        return result;
+      }
+    }
+
+  }
+
+  public static class store_args implements org.apache.thrift.TBase<store_args, store_args._Fields>, java.io.Serializable, Cloneable   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("store_args");
+
+    private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new store_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new store_argsTupleSchemeFactory());
+    }
+
+    public UserProfile user; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      USER((short)1, "user");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // USER
+            return USER;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserProfile.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(store_args.class, metaDataMap);
+    }
+
+    public store_args() {
+    }
+
+    public store_args(
+      UserProfile user)
+    {
+      this();
+      this.user = user;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public store_args(store_args other) {
+      if (other.isSetUser()) {
+        this.user = new UserProfile(other.user);
+      }
+    }
+
+    public store_args deepCopy() {
+      return new store_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.user = null;
+    }
+
+    public UserProfile getUser() {
+      return this.user;
+    }
+
+    public store_args setUser(UserProfile user) {
+      this.user = user;
+      return this;
+    }
+
+    public void unsetUser() {
+      this.user = null;
+    }
+
+    /** Returns true if field user is set (has been assigned a value) and false otherwise */
+    public boolean isSetUser() {
+      return this.user != null;
+    }
+
+    public void setUserIsSet(boolean value) {
+      if (!value) {
+        this.user = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case USER:
+        if (value == null) {
+          unsetUser();
+        } else {
+          setUser((UserProfile)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case USER:
+        return getUser();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case USER:
+        return isSetUser();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof store_args)
+        return this.equals((store_args)that);
+      return false;
+    }
+
+    public boolean equals(store_args that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_user = true && this.isSetUser();
+      boolean that_present_user = true && that.isSetUser();
+      if (this_present_user || that_present_user) {
+        if (!(this_present_user && that_present_user))
+          return false;
+        if (!this.user.equals(that.user))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      HashCodeBuilder builder = new HashCodeBuilder();
+
+      boolean present_user = true && (isSetUser());
+      builder.append(present_user);
+      if (present_user)
+        builder.append(user);
+
+      return builder.toHashCode();
+    }
+
+    public int compareTo(store_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+      store_args typedOther = (store_args)other;
+
+      lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetUser()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("store_args(");
+      boolean first = true;
+
+      sb.append("user:");
+      if (this.user == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.user);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+      if (user != null) {
+        user.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class store_argsStandardSchemeFactory implements SchemeFactory {
+      public store_argsStandardScheme getScheme() {
+        return new store_argsStandardScheme();
+      }
+    }
+
+    private static class store_argsStandardScheme extends StandardScheme<store_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, store_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // USER
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.user = new UserProfile();
+                struct.user.read(iprot);
+                struct.setUserIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, store_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.user != null) {
+          oprot.writeFieldBegin(USER_FIELD_DESC);
+          struct.user.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class store_argsTupleSchemeFactory implements SchemeFactory {
+      public store_argsTupleScheme getScheme() {
+        return new store_argsTupleScheme();
+      }
+    }
+
+    private static class store_argsTupleScheme extends TupleScheme<store_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, store_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetUser()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetUser()) {
+          struct.user.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, store_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.user = new UserProfile();
+          struct.user.read(iprot);
+          struct.setUserIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class store_result implements org.apache.thrift.TBase<store_result, store_result._Fields>, java.io.Serializable, Cloneable   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("store_result");
+
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new store_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new store_resultTupleSchemeFactory());
+    }
+
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+;
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(store_result.class, metaDataMap);
+    }
+
+    public store_result() {
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public store_result(store_result other) {
+    }
+
+    public store_result deepCopy() {
+      return new store_result(this);
+    }
+
+    @Override
+    public void clear() {
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof store_result)
+        return this.equals((store_result)that);
+      return false;
+    }
+
+    public boolean equals(store_result that) {
+      if (that == null)
+        return false;
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      HashCodeBuilder builder = new HashCodeBuilder();
+
+      return builder.toHashCode();
+    }
+
+    public int compareTo(store_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+      store_result typedOther = (store_result)other;
+
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("store_result(");
+      boolean first = true;
+
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class store_resultStandardSchemeFactory implements SchemeFactory {
+      public store_resultStandardScheme getScheme() {
+        return new store_resultStandardScheme();
+      }
+    }
+
+    private static class store_resultStandardScheme extends StandardScheme<store_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, store_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, store_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class store_resultTupleSchemeFactory implements SchemeFactory {
+      public store_resultTupleScheme getScheme() {
+        return new store_resultTupleScheme();
+      }
+    }
+
+    private static class store_resultTupleScheme extends TupleScheme<store_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, store_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, store_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+      }
+    }
+
+  }
+
+  public static class retrieve_args implements org.apache.thrift.TBase<retrieve_args, retrieve_args._Fields>, java.io.Serializable, Cloneable   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("retrieve_args");
+
+    private static final org.apache.thrift.protocol.TField UID_FIELD_DESC = new org.apache.thrift.protocol.TField("uid", org.apache.thrift.protocol.TType.I32, (short)1);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new retrieve_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new retrieve_argsTupleSchemeFactory());
+    }
+
+    public int uid; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      UID((short)1, "uid");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // UID
+            return UID;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    private static final int __UID_ISSET_ID = 0;
+    private byte __isset_bitfield = 0;
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.UID, new org.apache.thrift.meta_data.FieldMetaData("uid", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(retrieve_args.class, metaDataMap);
+    }
+
+    public retrieve_args() {
+    }
+
+    public retrieve_args(
+      int uid)
+    {
+      this();
+      this.uid = uid;
+      setUidIsSet(true);
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public retrieve_args(retrieve_args other) {
+      __isset_bitfield = other.__isset_bitfield;
+      this.uid = other.uid;
+    }
+
+    public retrieve_args deepCopy() {
+      return new retrieve_args(this);
+    }
+
+    @Override
+    public void clear() {
+      setUidIsSet(false);
+      this.uid = 0;
+    }
+
+    public int getUid() {
+      return this.uid;
+    }
+
+    public retrieve_args setUid(int uid) {
+      this.uid = uid;
+      setUidIsSet(true);
+      return this;
+    }
+
+    public void unsetUid() {
+      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __UID_ISSET_ID);
+    }
+
+    /** Returns true if field uid is set (has been assigned a value) and false otherwise */
+    public boolean isSetUid() {
+      return EncodingUtils.testBit(__isset_bitfield, __UID_ISSET_ID);
+    }
+
+    public void setUidIsSet(boolean value) {
+      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UID_ISSET_ID, value);
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case UID:
+        if (value == null) {
+          unsetUid();
+        } else {
+          setUid((Integer)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case UID:
+        return Integer.valueOf(getUid());
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case UID:
+        return isSetUid();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof retrieve_args)
+        return this.equals((retrieve_args)that);
+      return false;
+    }
+
+    public boolean equals(retrieve_args that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_uid = true;
+      boolean that_present_uid = true;
+      if (this_present_uid || that_present_uid) {
+        if (!(this_present_uid && that_present_uid))
+          return false;
+        if (this.uid != that.uid)
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      HashCodeBuilder builder = new HashCodeBuilder();
+
+      boolean present_uid = true;
+      builder.append(present_uid);
+      if (present_uid)
+        builder.append(uid);
+
+      return builder.toHashCode();
+    }
+
+    public int compareTo(retrieve_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+      retrieve_args typedOther = (retrieve_args)other;
+
+      lastComparison = Boolean.valueOf(isSetUid()).compareTo(typedOther.isSetUid());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetUid()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uid, typedOther.uid);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("retrieve_args(");
+      boolean first = true;
+
+      sb.append("uid:");
+      sb.append(this.uid);
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+        __isset_bitfield = 0;
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class retrieve_argsStandardSchemeFactory implements SchemeFactory {
+      public retrieve_argsStandardScheme getScheme() {
+        return new retrieve_argsStandardScheme();
+      }
+    }
+
+    private static class retrieve_argsStandardScheme extends StandardScheme<retrieve_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, retrieve_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // UID
+              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+                struct.uid = iprot.readI32();
+                struct.setUidIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, retrieve_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        oprot.writeFieldBegin(UID_FIELD_DESC);
+        oprot.writeI32(struct.uid);
+        oprot.writeFieldEnd();
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class retrieve_argsTupleSchemeFactory implements SchemeFactory {
+      public retrieve_argsTupleScheme getScheme() {
+        return new retrieve_argsTupleScheme();
+      }
+    }
+
+    private static class retrieve_argsTupleScheme extends TupleScheme<retrieve_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, retrieve_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetUid()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetUid()) {
+          oprot.writeI32(struct.uid);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, retrieve_args struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.uid = iprot.readI32();
+          struct.setUidIsSet(true);
+        }
+      }
+    }
+
+  }
+
+  public static class retrieve_result implements org.apache.thrift.TBase<retrieve_result, retrieve_result._Fields>, java.io.Serializable, Cloneable   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("retrieve_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new retrieve_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new retrieve_resultTupleSchemeFactory());
+    }
+
+    public UserProfile success; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserProfile.class)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(retrieve_result.class, metaDataMap);
+    }
+
+    public retrieve_result() {
+    }
+
+    public retrieve_result(
+      UserProfile success)
+    {
+      this();
+      this.success = success;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public retrieve_result(retrieve_result other) {
+      if (other.isSetSuccess()) {
+        this.success = new UserProfile(other.success);
+      }
+    }
+
+    public retrieve_result deepCopy() {
+      return new retrieve_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+    }
+
+    public UserProfile getSuccess() {
+      return this.success;
+    }
+
+    public retrieve_result setSuccess(UserProfile success) {
+      this.success = success;
+      return this;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((UserProfile)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof retrieve_result)
+        return this.equals((retrieve_result)that);
+      return false;
+    }
+
+    public boolean equals(retrieve_result that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      HashCodeBuilder builder = new HashCodeBuilder();
+
+      boolean present_success = true && (isSetSuccess());
+      builder.append(present_success);
+      if (present_success)
+        builder.append(success);
+
+      return builder.toHashCode();
+    }
+
+    public int compareTo(retrieve_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+      retrieve_result typedOther = (retrieve_result)other;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("retrieve_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+      if (success != null) {
+        success.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class retrieve_resultStandardSchemeFactory implements SchemeFactory {
+      public retrieve_resultStandardScheme getScheme() {
+        return new retrieve_resultStandardScheme();
+      }
+    }
+
+    private static class retrieve_resultStandardScheme extends StandardScheme<retrieve_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, retrieve_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.success = new UserProfile();
+                struct.success.read(iprot);
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, retrieve_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.success != null) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          struct.success.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class retrieve_resultTupleSchemeFactory implements SchemeFactory {
+      public retrieve_resultTupleScheme getScheme() {
+        return new retrieve_resultTupleScheme();
+      }
+    }
+
+    private static class retrieve_resultTupleScheme extends TupleScheme<retrieve_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, retrieve_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetSuccess()) {
+          struct.success.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, retrieve_result struct) throws org.apache.thrift.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.success = new UserProfile();
+          struct.success.read(iprot);
+          struct.setSuccessIsSet(true);
+        }
+      }
+    }
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/test/thrift/user.thrift
----------------------------------------------------------------------
diff --git a/thrift/src/test/thrift/user.thrift b/thrift/src/test/thrift/user.thrift
new file mode 100644
index 0000000..d3b86de
--- /dev/null
+++ b/thrift/src/test/thrift/user.thrift
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+ 
+namespace java org.apache.mina.generated.thrift
+
+struct UserProfile {
+  1: i32 uid,
+  2: string name,
+  3: string blurb
+}
+
+service UserStorage {
+  void store(1: UserProfile user),
+  UserProfile retrieve(1: i32 uid)
+}


[6/7] flatenned the hierarchy of serialization packages

Posted by jv...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java
----------------------------------------------------------------------
diff --git a/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java b/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java
new file mode 100644
index 0000000..32171c7
--- /dev/null
+++ b/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java
@@ -0,0 +1,2563 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: src/test/protobuf/addressbook.proto
+
+package org.apache.mina.generated.protoc;
+
+public final class AddressBookProtos {
+  private AddressBookProtos() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface PersonOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string name = 1;
+    /**
+     * <code>required string name = 1;</code>
+     */
+    boolean hasName();
+    /**
+     * <code>required string name = 1;</code>
+     */
+    java.lang.String getName();
+    /**
+     * <code>required string name = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getNameBytes();
+
+    // required int32 id = 2;
+    /**
+     * <code>required int32 id = 2;</code>
+     *
+     * <pre>
+     * Unique ID number for this person.
+     * </pre>
+     */
+    boolean hasId();
+    /**
+     * <code>required int32 id = 2;</code>
+     *
+     * <pre>
+     * Unique ID number for this person.
+     * </pre>
+     */
+    int getId();
+
+    // optional string email = 3;
+    /**
+     * <code>optional string email = 3;</code>
+     */
+    boolean hasEmail();
+    /**
+     * <code>optional string email = 3;</code>
+     */
+    java.lang.String getEmail();
+    /**
+     * <code>optional string email = 3;</code>
+     */
+    com.google.protobuf.ByteString
+        getEmailBytes();
+
+    // repeated .tutorial.Person.PhoneNumber phone = 4;
+    /**
+     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+     */
+    java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> 
+        getPhoneList();
+    /**
+     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+     */
+    org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber getPhone(int index);
+    /**
+     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+     */
+    int getPhoneCount();
+    /**
+     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+     */
+    java.util.List<? extends org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder> 
+        getPhoneOrBuilderList();
+    /**
+     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+     */
+    org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder getPhoneOrBuilder(
+        int index);
+  }
+  /**
+   * Protobuf type {@code tutorial.Person}
+   */
+  public static final class Person extends
+      com.google.protobuf.GeneratedMessage
+      implements PersonOrBuilder {
+    // Use Person.newBuilder() to construct.
+    private Person(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private Person(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final Person defaultInstance;
+    public static Person getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public Person getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private Person(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              name_ = input.readBytes();
+              break;
+            }
+            case 16: {
+              bitField0_ |= 0x00000002;
+              id_ = input.readInt32();
+              break;
+            }
+            case 26: {
+              bitField0_ |= 0x00000004;
+              email_ = input.readBytes();
+              break;
+            }
+            case 34: {
+              if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+                phone_ = new java.util.ArrayList<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber>();
+                mutable_bitField0_ |= 0x00000008;
+              }
+              phone_.add(input.readMessage(org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.PARSER, extensionRegistry));
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+          phone_ = java.util.Collections.unmodifiableList(phone_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.apache.mina.generated.protoc.AddressBookProtos.Person.class, org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<Person> PARSER =
+        new com.google.protobuf.AbstractParser<Person>() {
+      public Person parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new Person(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<Person> getParserForType() {
+      return PARSER;
+    }
+
+    /**
+     * Protobuf enum {@code tutorial.Person.PhoneType}
+     */
+    public enum PhoneType
+        implements com.google.protobuf.ProtocolMessageEnum {
+      /**
+       * <code>MOBILE = 0;</code>
+       */
+      MOBILE(0, 0),
+      /**
+       * <code>HOME = 1;</code>
+       */
+      HOME(1, 1),
+      /**
+       * <code>WORK = 2;</code>
+       */
+      WORK(2, 2),
+      ;
+
+      /**
+       * <code>MOBILE = 0;</code>
+       */
+      public static final int MOBILE_VALUE = 0;
+      /**
+       * <code>HOME = 1;</code>
+       */
+      public static final int HOME_VALUE = 1;
+      /**
+       * <code>WORK = 2;</code>
+       */
+      public static final int WORK_VALUE = 2;
+
+
+      public final int getNumber() { return value; }
+
+      public static PhoneType valueOf(int value) {
+        switch (value) {
+          case 0: return MOBILE;
+          case 1: return HOME;
+          case 2: return WORK;
+          default: return null;
+        }
+      }
+
+      public static com.google.protobuf.Internal.EnumLiteMap<PhoneType>
+          internalGetValueMap() {
+        return internalValueMap;
+      }
+      private static com.google.protobuf.Internal.EnumLiteMap<PhoneType>
+          internalValueMap =
+            new com.google.protobuf.Internal.EnumLiteMap<PhoneType>() {
+              public PhoneType findValueByNumber(int number) {
+                return PhoneType.valueOf(number);
+              }
+            };
+
+      public final com.google.protobuf.Descriptors.EnumValueDescriptor
+          getValueDescriptor() {
+        return getDescriptor().getValues().get(index);
+      }
+      public final com.google.protobuf.Descriptors.EnumDescriptor
+          getDescriptorForType() {
+        return getDescriptor();
+      }
+      public static final com.google.protobuf.Descriptors.EnumDescriptor
+          getDescriptor() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.Person.getDescriptor().getEnumTypes().get(0);
+      }
+
+      private static final PhoneType[] VALUES = values();
+
+      public static PhoneType valueOf(
+          com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
+        if (desc.getType() != getDescriptor()) {
+          throw new java.lang.IllegalArgumentException(
+            "EnumValueDescriptor is not for this type.");
+        }
+        return VALUES[desc.getIndex()];
+      }
+
+      private final int index;
+      private final int value;
+
+      private PhoneType(int index, int value) {
+        this.index = index;
+        this.value = value;
+      }
+
+      // @@protoc_insertion_point(enum_scope:tutorial.Person.PhoneType)
+    }
+
+    public interface PhoneNumberOrBuilder
+        extends com.google.protobuf.MessageOrBuilder {
+
+      // required string number = 1;
+      /**
+       * <code>required string number = 1;</code>
+       */
+      boolean hasNumber();
+      /**
+       * <code>required string number = 1;</code>
+       */
+      java.lang.String getNumber();
+      /**
+       * <code>required string number = 1;</code>
+       */
+      com.google.protobuf.ByteString
+          getNumberBytes();
+
+      // optional .tutorial.Person.PhoneType type = 2 [default = HOME];
+      /**
+       * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
+       */
+      boolean hasType();
+      /**
+       * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
+       */
+      org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType getType();
+    }
+    /**
+     * Protobuf type {@code tutorial.Person.PhoneNumber}
+     */
+    public static final class PhoneNumber extends
+        com.google.protobuf.GeneratedMessage
+        implements PhoneNumberOrBuilder {
+      // Use PhoneNumber.newBuilder() to construct.
+      private PhoneNumber(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+        super(builder);
+        this.unknownFields = builder.getUnknownFields();
+      }
+      private PhoneNumber(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+      private static final PhoneNumber defaultInstance;
+      public static PhoneNumber getDefaultInstance() {
+        return defaultInstance;
+      }
+
+      public PhoneNumber getDefaultInstanceForType() {
+        return defaultInstance;
+      }
+
+      private final com.google.protobuf.UnknownFieldSet unknownFields;
+      @java.lang.Override
+      public final com.google.protobuf.UnknownFieldSet
+          getUnknownFields() {
+        return this.unknownFields;
+      }
+      private PhoneNumber(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        initFields();
+        int mutable_bitField0_ = 0;
+        com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+            com.google.protobuf.UnknownFieldSet.newBuilder();
+        try {
+          boolean done = false;
+          while (!done) {
+            int tag = input.readTag();
+            switch (tag) {
+              case 0:
+                done = true;
+                break;
+              default: {
+                if (!parseUnknownField(input, unknownFields,
+                                       extensionRegistry, tag)) {
+                  done = true;
+                }
+                break;
+              }
+              case 10: {
+                bitField0_ |= 0x00000001;
+                number_ = input.readBytes();
+                break;
+              }
+              case 16: {
+                int rawValue = input.readEnum();
+                org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType value = org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType.valueOf(rawValue);
+                if (value == null) {
+                  unknownFields.mergeVarintField(2, rawValue);
+                } else {
+                  bitField0_ |= 0x00000002;
+                  type_ = value;
+                }
+                break;
+              }
+            }
+          }
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          throw e.setUnfinishedMessage(this);
+        } catch (java.io.IOException e) {
+          throw new com.google.protobuf.InvalidProtocolBufferException(
+              e.getMessage()).setUnfinishedMessage(this);
+        } finally {
+          this.unknownFields = unknownFields.build();
+          makeExtensionsImmutable();
+        }
+      }
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.class, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder.class);
+      }
+
+      public static com.google.protobuf.Parser<PhoneNumber> PARSER =
+          new com.google.protobuf.AbstractParser<PhoneNumber>() {
+        public PhoneNumber parsePartialFrom(
+            com.google.protobuf.CodedInputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return new PhoneNumber(input, extensionRegistry);
+        }
+      };
+
+      @java.lang.Override
+      public com.google.protobuf.Parser<PhoneNumber> getParserForType() {
+        return PARSER;
+      }
+
+      private int bitField0_;
+      // required string number = 1;
+      public static final int NUMBER_FIELD_NUMBER = 1;
+      private java.lang.Object number_;
+      /**
+       * <code>required string number = 1;</code>
+       */
+      public boolean hasNumber() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string number = 1;</code>
+       */
+      public java.lang.String getNumber() {
+        java.lang.Object ref = number_;
+        if (ref instanceof java.lang.String) {
+          return (java.lang.String) ref;
+        } else {
+          com.google.protobuf.ByteString bs = 
+              (com.google.protobuf.ByteString) ref;
+          java.lang.String s = bs.toStringUtf8();
+          if (bs.isValidUtf8()) {
+            number_ = s;
+          }
+          return s;
+        }
+      }
+      /**
+       * <code>required string number = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getNumberBytes() {
+        java.lang.Object ref = number_;
+        if (ref instanceof java.lang.String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          number_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+
+      // optional .tutorial.Person.PhoneType type = 2 [default = HOME];
+      public static final int TYPE_FIELD_NUMBER = 2;
+      private org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType type_;
+      /**
+       * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
+       */
+      public boolean hasType() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
+       */
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType getType() {
+        return type_;
+      }
+
+      private void initFields() {
+        number_ = "";
+        type_ = org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType.HOME;
+      }
+      private byte memoizedIsInitialized = -1;
+      public final boolean isInitialized() {
+        byte isInitialized = memoizedIsInitialized;
+        if (isInitialized != -1) return isInitialized == 1;
+
+        if (!hasNumber()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+        memoizedIsInitialized = 1;
+        return true;
+      }
+
+      public void writeTo(com.google.protobuf.CodedOutputStream output)
+                          throws java.io.IOException {
+        getSerializedSize();
+        if (((bitField0_ & 0x00000001) == 0x00000001)) {
+          output.writeBytes(1, getNumberBytes());
+        }
+        if (((bitField0_ & 0x00000002) == 0x00000002)) {
+          output.writeEnum(2, type_.getNumber());
+        }
+        getUnknownFields().writeTo(output);
+      }
+
+      private int memoizedSerializedSize = -1;
+      public int getSerializedSize() {
+        int size = memoizedSerializedSize;
+        if (size != -1) return size;
+
+        size = 0;
+        if (((bitField0_ & 0x00000001) == 0x00000001)) {
+          size += com.google.protobuf.CodedOutputStream
+            .computeBytesSize(1, getNumberBytes());
+        }
+        if (((bitField0_ & 0x00000002) == 0x00000002)) {
+          size += com.google.protobuf.CodedOutputStream
+            .computeEnumSize(2, type_.getNumber());
+        }
+        size += getUnknownFields().getSerializedSize();
+        memoizedSerializedSize = size;
+        return size;
+      }
+
+      private static final long serialVersionUID = 0L;
+      @java.lang.Override
+      protected java.lang.Object writeReplace()
+          throws java.io.ObjectStreamException {
+        return super.writeReplace();
+      }
+
+      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
+          com.google.protobuf.ByteString data)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data);
+      }
+      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
+          com.google.protobuf.ByteString data,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data, extensionRegistry);
+      }
+      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(byte[] data)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data);
+      }
+      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
+          byte[] data,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data, extensionRegistry);
+      }
+      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(java.io.InputStream input)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input);
+      }
+      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
+          java.io.InputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input, extensionRegistry);
+      }
+      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseDelimitedFrom(java.io.InputStream input)
+          throws java.io.IOException {
+        return PARSER.parseDelimitedFrom(input);
+      }
+      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseDelimitedFrom(
+          java.io.InputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        return PARSER.parseDelimitedFrom(input, extensionRegistry);
+      }
+      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
+          com.google.protobuf.CodedInputStream input)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input);
+      }
+      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input, extensionRegistry);
+      }
+
+      public static Builder newBuilder() { return Builder.create(); }
+      public Builder newBuilderForType() { return newBuilder(); }
+      public static Builder newBuilder(org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber prototype) {
+        return newBuilder().mergeFrom(prototype);
+      }
+      public Builder toBuilder() { return newBuilder(this); }
+
+      @java.lang.Override
+      protected Builder newBuilderForType(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        Builder builder = new Builder(parent);
+        return builder;
+      }
+      /**
+       * Protobuf type {@code tutorial.Person.PhoneNumber}
+       */
+      public static final class Builder extends
+          com.google.protobuf.GeneratedMessage.Builder<Builder>
+         implements org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder {
+        public static final com.google.protobuf.Descriptors.Descriptor
+            getDescriptor() {
+          return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_descriptor;
+        }
+
+        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+            internalGetFieldAccessorTable() {
+          return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable
+              .ensureFieldAccessorsInitialized(
+                  org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.class, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder.class);
+        }
+
+        // Construct using org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.newBuilder()
+        private Builder() {
+          maybeForceBuilderInitialization();
+        }
+
+        private Builder(
+            com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+          super(parent);
+          maybeForceBuilderInitialization();
+        }
+        private void maybeForceBuilderInitialization() {
+          if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          }
+        }
+        private static Builder create() {
+          return new Builder();
+        }
+
+        public Builder clear() {
+          super.clear();
+          number_ = "";
+          bitField0_ = (bitField0_ & ~0x00000001);
+          type_ = org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType.HOME;
+          bitField0_ = (bitField0_ & ~0x00000002);
+          return this;
+        }
+
+        public Builder clone() {
+          return create().mergeFrom(buildPartial());
+        }
+
+        public com.google.protobuf.Descriptors.Descriptor
+            getDescriptorForType() {
+          return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_descriptor;
+        }
+
+        public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber getDefaultInstanceForType() {
+          return org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.getDefaultInstance();
+        }
+
+        public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber build() {
+          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber result = buildPartial();
+          if (!result.isInitialized()) {
+            throw newUninitializedMessageException(result);
+          }
+          return result;
+        }
+
+        public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber buildPartial() {
+          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber result = new org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber(this);
+          int from_bitField0_ = bitField0_;
+          int to_bitField0_ = 0;
+          if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+            to_bitField0_ |= 0x00000001;
+          }
+          result.number_ = number_;
+          if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+            to_bitField0_ |= 0x00000002;
+          }
+          result.type_ = type_;
+          result.bitField0_ = to_bitField0_;
+          onBuilt();
+          return result;
+        }
+
+        public Builder mergeFrom(com.google.protobuf.Message other) {
+          if (other instanceof org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber) {
+            return mergeFrom((org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber)other);
+          } else {
+            super.mergeFrom(other);
+            return this;
+          }
+        }
+
+        public Builder mergeFrom(org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber other) {
+          if (other == org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.getDefaultInstance()) return this;
+          if (other.hasNumber()) {
+            bitField0_ |= 0x00000001;
+            number_ = other.number_;
+            onChanged();
+          }
+          if (other.hasType()) {
+            setType(other.getType());
+          }
+          this.mergeUnknownFields(other.getUnknownFields());
+          return this;
+        }
+
+        public final boolean isInitialized() {
+          if (!hasNumber()) {
+            
+            return false;
+          }
+          return true;
+        }
+
+        public Builder mergeFrom(
+            com.google.protobuf.CodedInputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws java.io.IOException {
+          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parsedMessage = null;
+          try {
+            parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+            parsedMessage = (org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber) e.getUnfinishedMessage();
+            throw e;
+          } finally {
+            if (parsedMessage != null) {
+              mergeFrom(parsedMessage);
+            }
+          }
+          return this;
+        }
+        private int bitField0_;
+
+        // required string number = 1;
+        private java.lang.Object number_ = "";
+        /**
+         * <code>required string number = 1;</code>
+         */
+        public boolean hasNumber() {
+          return ((bitField0_ & 0x00000001) == 0x00000001);
+        }
+        /**
+         * <code>required string number = 1;</code>
+         */
+        public java.lang.String getNumber() {
+          java.lang.Object ref = number_;
+          if (!(ref instanceof java.lang.String)) {
+            java.lang.String s = ((com.google.protobuf.ByteString) ref)
+                .toStringUtf8();
+            number_ = s;
+            return s;
+          } else {
+            return (java.lang.String) ref;
+          }
+        }
+        /**
+         * <code>required string number = 1;</code>
+         */
+        public com.google.protobuf.ByteString
+            getNumberBytes() {
+          java.lang.Object ref = number_;
+          if (ref instanceof String) {
+            com.google.protobuf.ByteString b = 
+                com.google.protobuf.ByteString.copyFromUtf8(
+                    (java.lang.String) ref);
+            number_ = b;
+            return b;
+          } else {
+            return (com.google.protobuf.ByteString) ref;
+          }
+        }
+        /**
+         * <code>required string number = 1;</code>
+         */
+        public Builder setNumber(
+            java.lang.String value) {
+          if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+          number_ = value;
+          onChanged();
+          return this;
+        }
+        /**
+         * <code>required string number = 1;</code>
+         */
+        public Builder clearNumber() {
+          bitField0_ = (bitField0_ & ~0x00000001);
+          number_ = getDefaultInstance().getNumber();
+          onChanged();
+          return this;
+        }
+        /**
+         * <code>required string number = 1;</code>
+         */
+        public Builder setNumberBytes(
+            com.google.protobuf.ByteString value) {
+          if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+          number_ = value;
+          onChanged();
+          return this;
+        }
+
+        // optional .tutorial.Person.PhoneType type = 2 [default = HOME];
+        private org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType type_ = org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType.HOME;
+        /**
+         * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
+         */
+        public boolean hasType() {
+          return ((bitField0_ & 0x00000002) == 0x00000002);
+        }
+        /**
+         * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
+         */
+        public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType getType() {
+          return type_;
+        }
+        /**
+         * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
+         */
+        public Builder setType(org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType value) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          bitField0_ |= 0x00000002;
+          type_ = value;
+          onChanged();
+          return this;
+        }
+        /**
+         * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
+         */
+        public Builder clearType() {
+          bitField0_ = (bitField0_ & ~0x00000002);
+          type_ = org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType.HOME;
+          onChanged();
+          return this;
+        }
+
+        // @@protoc_insertion_point(builder_scope:tutorial.Person.PhoneNumber)
+      }
+
+      static {
+        defaultInstance = new PhoneNumber(true);
+        defaultInstance.initFields();
+      }
+
+      // @@protoc_insertion_point(class_scope:tutorial.Person.PhoneNumber)
+    }
+
+    private int bitField0_;
+    // required string name = 1;
+    public static final int NAME_FIELD_NUMBER = 1;
+    private java.lang.Object name_;
+    /**
+     * <code>required string name = 1;</code>
+     */
+    public boolean hasName() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string name = 1;</code>
+     */
+    public java.lang.String getName() {
+      java.lang.Object ref = name_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          name_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string name = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getNameBytes() {
+      java.lang.Object ref = name_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        name_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // required int32 id = 2;
+    public static final int ID_FIELD_NUMBER = 2;
+    private int id_;
+    /**
+     * <code>required int32 id = 2;</code>
+     *
+     * <pre>
+     * Unique ID number for this person.
+     * </pre>
+     */
+    public boolean hasId() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>required int32 id = 2;</code>
+     *
+     * <pre>
+     * Unique ID number for this person.
+     * </pre>
+     */
+    public int getId() {
+      return id_;
+    }
+
+    // optional string email = 3;
+    public static final int EMAIL_FIELD_NUMBER = 3;
+    private java.lang.Object email_;
+    /**
+     * <code>optional string email = 3;</code>
+     */
+    public boolean hasEmail() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional string email = 3;</code>
+     */
+    public java.lang.String getEmail() {
+      java.lang.Object ref = email_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          email_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string email = 3;</code>
+     */
+    public com.google.protobuf.ByteString
+        getEmailBytes() {
+      java.lang.Object ref = email_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        email_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // repeated .tutorial.Person.PhoneNumber phone = 4;
+    public static final int PHONE_FIELD_NUMBER = 4;
+    private java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> phone_;
+    /**
+     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+     */
+    public java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> getPhoneList() {
+      return phone_;
+    }
+    /**
+     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+     */
+    public java.util.List<? extends org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder> 
+        getPhoneOrBuilderList() {
+      return phone_;
+    }
+    /**
+     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+     */
+    public int getPhoneCount() {
+      return phone_.size();
+    }
+    /**
+     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+     */
+    public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber getPhone(int index) {
+      return phone_.get(index);
+    }
+    /**
+     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+     */
+    public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder getPhoneOrBuilder(
+        int index) {
+      return phone_.get(index);
+    }
+
+    private void initFields() {
+      name_ = "";
+      id_ = 0;
+      email_ = "";
+      phone_ = java.util.Collections.emptyList();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasName()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasId()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      for (int i = 0; i < getPhoneCount(); i++) {
+        if (!getPhone(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getNameBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeInt32(2, id_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeBytes(3, getEmailBytes());
+      }
+      for (int i = 0; i < phone_.size(); i++) {
+        output.writeMessage(4, phone_.get(i));
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getNameBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(2, id_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(3, getEmailBytes());
+      }
+      for (int i = 0; i < phone_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(4, phone_.get(i));
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.apache.mina.generated.protoc.AddressBookProtos.Person prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code tutorial.Person}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.mina.generated.protoc.AddressBookProtos.Person.class, org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder.class);
+      }
+
+      // Construct using org.apache.mina.generated.protoc.AddressBookProtos.Person.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getPhoneFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        name_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        id_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000002);
+        email_ = "";
+        bitField0_ = (bitField0_ & ~0x00000004);
+        if (phoneBuilder_ == null) {
+          phone_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000008);
+        } else {
+          phoneBuilder_.clear();
+        }
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_descriptor;
+      }
+
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person getDefaultInstanceForType() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.Person.getDefaultInstance();
+      }
+
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person build() {
+        org.apache.mina.generated.protoc.AddressBookProtos.Person result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person buildPartial() {
+        org.apache.mina.generated.protoc.AddressBookProtos.Person result = new org.apache.mina.generated.protoc.AddressBookProtos.Person(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.name_ = name_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.id_ = id_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.email_ = email_;
+        if (phoneBuilder_ == null) {
+          if (((bitField0_ & 0x00000008) == 0x00000008)) {
+            phone_ = java.util.Collections.unmodifiableList(phone_);
+            bitField0_ = (bitField0_ & ~0x00000008);
+          }
+          result.phone_ = phone_;
+        } else {
+          result.phone_ = phoneBuilder_.build();
+        }
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.apache.mina.generated.protoc.AddressBookProtos.Person) {
+          return mergeFrom((org.apache.mina.generated.protoc.AddressBookProtos.Person)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.apache.mina.generated.protoc.AddressBookProtos.Person other) {
+        if (other == org.apache.mina.generated.protoc.AddressBookProtos.Person.getDefaultInstance()) return this;
+        if (other.hasName()) {
+          bitField0_ |= 0x00000001;
+          name_ = other.name_;
+          onChanged();
+        }
+        if (other.hasId()) {
+          setId(other.getId());
+        }
+        if (other.hasEmail()) {
+          bitField0_ |= 0x00000004;
+          email_ = other.email_;
+          onChanged();
+        }
+        if (phoneBuilder_ == null) {
+          if (!other.phone_.isEmpty()) {
+            if (phone_.isEmpty()) {
+              phone_ = other.phone_;
+              bitField0_ = (bitField0_ & ~0x00000008);
+            } else {
+              ensurePhoneIsMutable();
+              phone_.addAll(other.phone_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.phone_.isEmpty()) {
+            if (phoneBuilder_.isEmpty()) {
+              phoneBuilder_.dispose();
+              phoneBuilder_ = null;
+              phone_ = other.phone_;
+              bitField0_ = (bitField0_ & ~0x00000008);
+              phoneBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getPhoneFieldBuilder() : null;
+            } else {
+              phoneBuilder_.addAllMessages(other.phone_);
+            }
+          }
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasName()) {
+          
+          return false;
+        }
+        if (!hasId()) {
+          
+          return false;
+        }
+        for (int i = 0; i < getPhoneCount(); i++) {
+          if (!getPhone(i).isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.apache.mina.generated.protoc.AddressBookProtos.Person parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.apache.mina.generated.protoc.AddressBookProtos.Person) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string name = 1;
+      private java.lang.Object name_ = "";
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public boolean hasName() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public java.lang.String getName() {
+        java.lang.Object ref = name_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          name_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getNameBytes() {
+        java.lang.Object ref = name_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          name_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public Builder setName(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        name_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public Builder clearName() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        name_ = getDefaultInstance().getName();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public Builder setNameBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        name_ = value;
+        onChanged();
+        return this;
+      }
+
+      // required int32 id = 2;
+      private int id_ ;
+      /**
+       * <code>required int32 id = 2;</code>
+       *
+       * <pre>
+       * Unique ID number for this person.
+       * </pre>
+       */
+      public boolean hasId() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required int32 id = 2;</code>
+       *
+       * <pre>
+       * Unique ID number for this person.
+       * </pre>
+       */
+      public int getId() {
+        return id_;
+      }
+      /**
+       * <code>required int32 id = 2;</code>
+       *
+       * <pre>
+       * Unique ID number for this person.
+       * </pre>
+       */
+      public Builder setId(int value) {
+        bitField0_ |= 0x00000002;
+        id_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required int32 id = 2;</code>
+       *
+       * <pre>
+       * Unique ID number for this person.
+       * </pre>
+       */
+      public Builder clearId() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        id_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional string email = 3;
+      private java.lang.Object email_ = "";
+      /**
+       * <code>optional string email = 3;</code>
+       */
+      public boolean hasEmail() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional string email = 3;</code>
+       */
+      public java.lang.String getEmail() {
+        java.lang.Object ref = email_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          email_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string email = 3;</code>
+       */
+      public com.google.protobuf.ByteString
+          getEmailBytes() {
+        java.lang.Object ref = email_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          email_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string email = 3;</code>
+       */
+      public Builder setEmail(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000004;
+        email_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string email = 3;</code>
+       */
+      public Builder clearEmail() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        email_ = getDefaultInstance().getEmail();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string email = 3;</code>
+       */
+      public Builder setEmailBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000004;
+        email_ = value;
+        onChanged();
+        return this;
+      }
+
+      // repeated .tutorial.Person.PhoneNumber phone = 4;
+      private java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> phone_ =
+        java.util.Collections.emptyList();
+      private void ensurePhoneIsMutable() {
+        if (!((bitField0_ & 0x00000008) == 0x00000008)) {
+          phone_ = new java.util.ArrayList<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber>(phone_);
+          bitField0_ |= 0x00000008;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder> phoneBuilder_;
+
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> getPhoneList() {
+        if (phoneBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(phone_);
+        } else {
+          return phoneBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public int getPhoneCount() {
+        if (phoneBuilder_ == null) {
+          return phone_.size();
+        } else {
+          return phoneBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber getPhone(int index) {
+        if (phoneBuilder_ == null) {
+          return phone_.get(index);
+        } else {
+          return phoneBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public Builder setPhone(
+          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber value) {
+        if (phoneBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensurePhoneIsMutable();
+          phone_.set(index, value);
+          onChanged();
+        } else {
+          phoneBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public Builder setPhone(
+          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) {
+        if (phoneBuilder_ == null) {
+          ensurePhoneIsMutable();
+          phone_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          phoneBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public Builder addPhone(org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber value) {
+        if (phoneBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensurePhoneIsMutable();
+          phone_.add(value);
+          onChanged();
+        } else {
+          phoneBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public Builder addPhone(
+          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber value) {
+        if (phoneBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensurePhoneIsMutable();
+          phone_.add(index, value);
+          onChanged();
+        } else {
+          phoneBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public Builder addPhone(
+          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) {
+        if (phoneBuilder_ == null) {
+          ensurePhoneIsMutable();
+          phone_.add(builderForValue.build());
+          onChanged();
+        } else {
+          phoneBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public Builder addPhone(
+          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) {
+        if (phoneBuilder_ == null) {
+          ensurePhoneIsMutable();
+          phone_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          phoneBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public Builder addAllPhone(
+          java.lang.Iterable<? extends org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> values) {
+        if (phoneBuilder_ == null) {
+          ensurePhoneIsMutable();
+          super.addAll(values, phone_);
+          onChanged();
+        } else {
+          phoneBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public Builder clearPhone() {
+        if (phoneBuilder_ == null) {
+          phone_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000008);
+          onChanged();
+        } else {
+          phoneBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public Builder removePhone(int index) {
+        if (phoneBuilder_ == null) {
+          ensurePhoneIsMutable();
+          phone_.remove(index);
+          onChanged();
+        } else {
+          phoneBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder getPhoneBuilder(
+          int index) {
+        return getPhoneFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder getPhoneOrBuilder(
+          int index) {
+        if (phoneBuilder_ == null) {
+          return phone_.get(index);  } else {
+          return phoneBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public java.util.List<? extends org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder> 
+           getPhoneOrBuilderList() {
+        if (phoneBuilder_ != null) {
+          return phoneBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(phone_);
+        }
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder addPhoneBuilder() {
+        return getPhoneFieldBuilder().addBuilder(
+            org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder addPhoneBuilder(
+          int index) {
+        return getPhoneFieldBuilder().addBuilder(
+            index, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
+       */
+      public java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder> 
+           getPhoneBuilderList() {
+        return getPhoneFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder> 
+          getPhoneFieldBuilder() {
+        if (phoneBuilder_ == null) {
+          phoneBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder>(
+                  phone_,
+                  ((bitField0_ & 0x00000008) == 0x00000008),
+                  getParentForChildren(),
+                  isClean());
+          phone_ = null;
+        }
+        return phoneBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:tutorial.Person)
+    }
+
+    static {
+      defaultInstance = new Person(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:tutorial.Person)
+  }
+
+  public interface AddressBookOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // repeated .tutorial.Person person = 1;
+    /**
+     * <code>repeated .tutorial.Person person = 1;</code>
+     */
+    java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person> 
+        getPersonList();
+    /**
+     * <code>repeated .tutorial.Person person = 1;</code>
+     */
+    org.apache.mina.generated.protoc.AddressBookProtos.Person getPerson(int index);
+    /**
+     * <code>repeated .tutorial.Person person = 1;</code>
+     */
+    int getPersonCount();
+    /**
+     * <code>repeated .tutorial.Person person = 1;</code>
+     */
+    java.util.List<? extends org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder> 
+        getPersonOrBuilderList();
+    /**
+     * <code>repeated .tutorial.Person person = 1;</code>
+     */
+    org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder getPersonOrBuilder(
+        int index);
+  }
+  /**
+   * Protobuf type {@code tutorial.AddressBook}
+   *
+   * <pre>
+   * Our address book file is just one of these.
+   * </pre>
+   */
+  public static final class AddressBook extends
+      com.google.protobuf.GeneratedMessage
+      implements AddressBookOrBuilder {
+    // Use AddressBook.newBuilder() to construct.
+    private AddressBook(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private AddressBook(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final AddressBook defaultInstance;
+    public static AddressBook getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public AddressBook getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private AddressBook(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+                person_ = new java.util.ArrayList<org.apache.mina.generated.protoc.AddressBookProtos.Person>();
+                mutable_bitField0_ |= 0x00000001;
+              }
+              person_.add(input.readMessage(org.apache.mina.generated.protoc.AddressBookProtos.Person.PARSER, extensionRegistry));
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+          person_ = java.util.Collections.unmodifiableList(person_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_AddressBook_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_AddressBook_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.class, org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<AddressBook> PARSER =
+        new com.google.protobuf.AbstractParser<AddressBook>() {
+      public AddressBook parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new AddressBook(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<AddressBook> getParserForType() {
+      return PARSER;
+    }
+
+    // repeated .tutorial.Person person = 1;
+    public static final int PERSON_FIELD_NUMBER = 1;
+    private java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person> person_;
+    /**
+     * <code>repeated .tutorial.Person person = 1;</code>
+     */
+    public java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person> getPersonList() {
+      return person_;
+    }
+    /**
+     * <code>repeated .tutorial.Person person = 1;</code>
+     */
+    public java.util.List<? extends org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder> 
+        getPersonOrBuilderList() {
+      return person_;
+    }
+    /**
+     * <code>repeated .tutorial.Person person = 1;</code>
+     */
+    public int getPersonCount() {
+      return person_.size();
+    }
+    /**
+     * <code>repeated .tutorial.Person person = 1;</code>
+     */
+    public org.apache.mina.generated.protoc.AddressBookProtos.Person getPerson(int index) {
+      return person_.get(index);
+    }
+    /**
+     * <code>repeated .tutorial.Person person = 1;</code>
+     */
+    public org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder getPersonOrBuilder(
+        int index) {
+      return person_.get(index);
+    }
+
+    private void initFields() {
+      person_ = java.util.Collections.emptyList();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      for (int i = 0; i < getPersonCount(); i++) {
+        if (!getPerson(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      for (int i = 0; i < person_.size(); i++) {
+        output.writeMessage(1, person_.get(i));
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      for (int i = 0; i < person_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(1, person_.get(i));
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.apache.mina.generated.protoc.AddressBookProtos.AddressBook prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code tutorial.AddressBook}
+     *
+     * <pre>
+     * Our address book file is just one of these.
+     * </pre>
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.apache.mina.generated.protoc.AddressBookProtos.AddressBookOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_AddressBook_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_AddressBook_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.class, org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.Builder.class);
+      }
+
+      // Construct using org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getPersonFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        if (personBuilder_ == null) {
+          person_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000001);
+        } else {
+          personBuilder_.clear();
+        }
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_AddressBook_descriptor;
+      }
+
+      public org.apache.mina.generated.protoc.AddressBookProtos.AddressBook getDefaultInstanceForType() {
+        return org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.getDefaultInstance();
+      }
+
+      public org.apache.mina.generated.protoc.AddressBookProtos.AddressBook build() {
+        org.apache.mina.generated.protoc.AddressBookProtos.AddressBook result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.apache.mina.generated.protoc.AddressBookProtos.AddressBook buildPartial() {
+        org.apache.mina.generated.protoc.AddressBookProtos.AddressBook result = new org.apache.mina.generated.protoc.AddressBookProtos.AddressBook(this);
+        int from_bitField0_ = bitField0_;
+        if (personBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001)) {
+            person_ = java.util.Collections.unmodifiableList(person_);
+            bitField0_ = (bitField0_ & ~0x00000001);
+          }
+          result.person_ = person_;
+        } else {
+          result.person_ = personBuilder_.build();
+        }
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.apache.mina.generated.protoc.AddressBookProtos.AddressBook) {
+          return mergeFrom((org.apache.mina.generated.protoc.AddressBookProtos.AddressBook)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.apache.mina.generated.protoc.AddressBookProtos.AddressBook other) {
+        if (other == org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.getDefaultInstance()) return this;
+        if (personBuilder_ == null) {
+          if (!other.person_.isEmpty()) {
+            if (person_.isEmpty()) {
+              person_ = other.person_;
+              bitField0_ = (bitField0_ & ~0x00000001);
+            } else {
+              ensurePersonIsMutable();
+              person_.addAll(other.person_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.person_.isEmpty()) {
+            if (personBuilder_.isEmpty()) {
+              personBuilder_.dispose();
+              personBuilder_ = null;
+              person_ = other.person_;
+              bitField0_ = (bitField0_ & ~0x00000001);
+              personBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getPersonFieldBuilder() : null;
+            } else {
+              personBuilder_.addAllMessages(other.person_);
+            }
+          }
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        for (int i = 0; i < getPersonCount(); i++) {
+          if (!getPerson(i).isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.apache.mina.generated.protoc.AddressBookProtos.AddressBook) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // repeated .tutorial.Person person = 1;
+      private java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person> person_ =
+        java.util.Collections.emptyList();
+      private void ensurePersonIsMutable() {
+        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
+          person_ = new java.util.ArrayList<org.apache.mina.generated.protoc.AddressBookProtos.Person>(person_);
+          bitField0_ |= 0x00000001;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.apache.mina.generated.protoc.AddressBookProtos.Person, org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder, org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder> personBuilder_;
+
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person> getPersonList() {
+        if (personBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(person_);
+        } else {
+          return personBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public int getPersonCount() {
+        if (personBuilder_ == null) {
+          return person_.size();
+        } else {
+          return personBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person getPerson(int index) {
+        if (personBuilder_ == null) {
+          return person_.get(index);
+        } else {
+          return personBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public Builder setPerson(
+          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person value) {
+        if (personBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensurePersonIsMutable();
+          person_.set(index, value);
+          onChanged();
+        } else {
+          personBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public Builder setPerson(
+          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder builderForValue) {
+        if (personBuilder_ == null) {
+          ensurePersonIsMutable();
+          person_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          personBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public Builder addPerson(org.apache.mina.generated.protoc.AddressBookProtos.Person value) {
+        if (personBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensurePersonIsMutable();
+          person_.add(value);
+          onChanged();
+        } else {
+          personBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public Builder addPerson(
+          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person value) {
+        if (personBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensurePersonIsMutable();
+          person_.add(index, value);
+          onChanged();
+        } else {
+          personBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public Builder addPerson(
+          org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder builderForValue) {
+        if (personBuilder_ == null) {
+          ensurePersonIsMutable();
+          person_.add(builderForValue.build());
+          onChanged();
+        } else {
+          personBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public Builder addPerson(
+          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder builderForValue) {
+        if (personBuilder_ == null) {
+          ensurePersonIsMutable();
+          person_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          personBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public Builder addAllPerson(
+          java.lang.Iterable<? extends org.apache.mina.generated.protoc.AddressBookProtos.Person> values) {
+        if (personBuilder_ == null) {
+          ensurePersonIsMutable();
+          super.addAll(values, person_);
+          onChanged();
+        } else {
+          personBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public Builder clearPerson() {
+        if (personBuilder_ == null) {
+          person_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000001);
+          onChanged();
+        } else {
+          personBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public Builder removePerson(int index) {
+        if (personBuilder_ == null) {
+          ensurePersonIsMutable();
+          person_.remove(index);
+          onChanged();
+        } else {
+          personBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder getPersonBuilder(
+          int index) {
+        return getPersonFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .tutorial.Person person = 1;</code>
+       */
+      public org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder getPersonOrBuilder(
+          int inde

<TRUNCATED>

[4/7] flatenned the hierarchy of serialization packages

Posted by jv...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java b/serialization/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java
deleted file mode 100644
index 32171c7..0000000
--- a/serialization/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java
+++ /dev/null
@@ -1,2563 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: src/test/protobuf/addressbook.proto
-
-package org.apache.mina.generated.protoc;
-
-public final class AddressBookProtos {
-  private AddressBookProtos() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-  }
-  public interface PersonOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // required string name = 1;
-    /**
-     * <code>required string name = 1;</code>
-     */
-    boolean hasName();
-    /**
-     * <code>required string name = 1;</code>
-     */
-    java.lang.String getName();
-    /**
-     * <code>required string name = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getNameBytes();
-
-    // required int32 id = 2;
-    /**
-     * <code>required int32 id = 2;</code>
-     *
-     * <pre>
-     * Unique ID number for this person.
-     * </pre>
-     */
-    boolean hasId();
-    /**
-     * <code>required int32 id = 2;</code>
-     *
-     * <pre>
-     * Unique ID number for this person.
-     * </pre>
-     */
-    int getId();
-
-    // optional string email = 3;
-    /**
-     * <code>optional string email = 3;</code>
-     */
-    boolean hasEmail();
-    /**
-     * <code>optional string email = 3;</code>
-     */
-    java.lang.String getEmail();
-    /**
-     * <code>optional string email = 3;</code>
-     */
-    com.google.protobuf.ByteString
-        getEmailBytes();
-
-    // repeated .tutorial.Person.PhoneNumber phone = 4;
-    /**
-     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-     */
-    java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> 
-        getPhoneList();
-    /**
-     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-     */
-    org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber getPhone(int index);
-    /**
-     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-     */
-    int getPhoneCount();
-    /**
-     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-     */
-    java.util.List<? extends org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder> 
-        getPhoneOrBuilderList();
-    /**
-     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-     */
-    org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder getPhoneOrBuilder(
-        int index);
-  }
-  /**
-   * Protobuf type {@code tutorial.Person}
-   */
-  public static final class Person extends
-      com.google.protobuf.GeneratedMessage
-      implements PersonOrBuilder {
-    // Use Person.newBuilder() to construct.
-    private Person(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private Person(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final Person defaultInstance;
-    public static Person getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public Person getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private Person(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      initFields();
-      int mutable_bitField0_ = 0;
-      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-          com.google.protobuf.UnknownFieldSet.newBuilder();
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              bitField0_ |= 0x00000001;
-              name_ = input.readBytes();
-              break;
-            }
-            case 16: {
-              bitField0_ |= 0x00000002;
-              id_ = input.readInt32();
-              break;
-            }
-            case 26: {
-              bitField0_ |= 0x00000004;
-              email_ = input.readBytes();
-              break;
-            }
-            case 34: {
-              if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
-                phone_ = new java.util.ArrayList<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber>();
-                mutable_bitField0_ |= 0x00000008;
-              }
-              phone_.add(input.readMessage(org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.PARSER, extensionRegistry));
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e.getMessage()).setUnfinishedMessage(this);
-      } finally {
-        if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
-          phone_ = java.util.Collections.unmodifiableList(phone_);
-        }
-        this.unknownFields = unknownFields.build();
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.mina.generated.protoc.AddressBookProtos.Person.class, org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<Person> PARSER =
-        new com.google.protobuf.AbstractParser<Person>() {
-      public Person parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new Person(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<Person> getParserForType() {
-      return PARSER;
-    }
-
-    /**
-     * Protobuf enum {@code tutorial.Person.PhoneType}
-     */
-    public enum PhoneType
-        implements com.google.protobuf.ProtocolMessageEnum {
-      /**
-       * <code>MOBILE = 0;</code>
-       */
-      MOBILE(0, 0),
-      /**
-       * <code>HOME = 1;</code>
-       */
-      HOME(1, 1),
-      /**
-       * <code>WORK = 2;</code>
-       */
-      WORK(2, 2),
-      ;
-
-      /**
-       * <code>MOBILE = 0;</code>
-       */
-      public static final int MOBILE_VALUE = 0;
-      /**
-       * <code>HOME = 1;</code>
-       */
-      public static final int HOME_VALUE = 1;
-      /**
-       * <code>WORK = 2;</code>
-       */
-      public static final int WORK_VALUE = 2;
-
-
-      public final int getNumber() { return value; }
-
-      public static PhoneType valueOf(int value) {
-        switch (value) {
-          case 0: return MOBILE;
-          case 1: return HOME;
-          case 2: return WORK;
-          default: return null;
-        }
-      }
-
-      public static com.google.protobuf.Internal.EnumLiteMap<PhoneType>
-          internalGetValueMap() {
-        return internalValueMap;
-      }
-      private static com.google.protobuf.Internal.EnumLiteMap<PhoneType>
-          internalValueMap =
-            new com.google.protobuf.Internal.EnumLiteMap<PhoneType>() {
-              public PhoneType findValueByNumber(int number) {
-                return PhoneType.valueOf(number);
-              }
-            };
-
-      public final com.google.protobuf.Descriptors.EnumValueDescriptor
-          getValueDescriptor() {
-        return getDescriptor().getValues().get(index);
-      }
-      public final com.google.protobuf.Descriptors.EnumDescriptor
-          getDescriptorForType() {
-        return getDescriptor();
-      }
-      public static final com.google.protobuf.Descriptors.EnumDescriptor
-          getDescriptor() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.Person.getDescriptor().getEnumTypes().get(0);
-      }
-
-      private static final PhoneType[] VALUES = values();
-
-      public static PhoneType valueOf(
-          com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
-        if (desc.getType() != getDescriptor()) {
-          throw new java.lang.IllegalArgumentException(
-            "EnumValueDescriptor is not for this type.");
-        }
-        return VALUES[desc.getIndex()];
-      }
-
-      private final int index;
-      private final int value;
-
-      private PhoneType(int index, int value) {
-        this.index = index;
-        this.value = value;
-      }
-
-      // @@protoc_insertion_point(enum_scope:tutorial.Person.PhoneType)
-    }
-
-    public interface PhoneNumberOrBuilder
-        extends com.google.protobuf.MessageOrBuilder {
-
-      // required string number = 1;
-      /**
-       * <code>required string number = 1;</code>
-       */
-      boolean hasNumber();
-      /**
-       * <code>required string number = 1;</code>
-       */
-      java.lang.String getNumber();
-      /**
-       * <code>required string number = 1;</code>
-       */
-      com.google.protobuf.ByteString
-          getNumberBytes();
-
-      // optional .tutorial.Person.PhoneType type = 2 [default = HOME];
-      /**
-       * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
-       */
-      boolean hasType();
-      /**
-       * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
-       */
-      org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType getType();
-    }
-    /**
-     * Protobuf type {@code tutorial.Person.PhoneNumber}
-     */
-    public static final class PhoneNumber extends
-        com.google.protobuf.GeneratedMessage
-        implements PhoneNumberOrBuilder {
-      // Use PhoneNumber.newBuilder() to construct.
-      private PhoneNumber(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-        super(builder);
-        this.unknownFields = builder.getUnknownFields();
-      }
-      private PhoneNumber(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-      private static final PhoneNumber defaultInstance;
-      public static PhoneNumber getDefaultInstance() {
-        return defaultInstance;
-      }
-
-      public PhoneNumber getDefaultInstanceForType() {
-        return defaultInstance;
-      }
-
-      private final com.google.protobuf.UnknownFieldSet unknownFields;
-      @java.lang.Override
-      public final com.google.protobuf.UnknownFieldSet
-          getUnknownFields() {
-        return this.unknownFields;
-      }
-      private PhoneNumber(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        initFields();
-        int mutable_bitField0_ = 0;
-        com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-            com.google.protobuf.UnknownFieldSet.newBuilder();
-        try {
-          boolean done = false;
-          while (!done) {
-            int tag = input.readTag();
-            switch (tag) {
-              case 0:
-                done = true;
-                break;
-              default: {
-                if (!parseUnknownField(input, unknownFields,
-                                       extensionRegistry, tag)) {
-                  done = true;
-                }
-                break;
-              }
-              case 10: {
-                bitField0_ |= 0x00000001;
-                number_ = input.readBytes();
-                break;
-              }
-              case 16: {
-                int rawValue = input.readEnum();
-                org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType value = org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType.valueOf(rawValue);
-                if (value == null) {
-                  unknownFields.mergeVarintField(2, rawValue);
-                } else {
-                  bitField0_ |= 0x00000002;
-                  type_ = value;
-                }
-                break;
-              }
-            }
-          }
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          throw e.setUnfinishedMessage(this);
-        } catch (java.io.IOException e) {
-          throw new com.google.protobuf.InvalidProtocolBufferException(
-              e.getMessage()).setUnfinishedMessage(this);
-        } finally {
-          this.unknownFields = unknownFields.build();
-          makeExtensionsImmutable();
-        }
-      }
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.class, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder.class);
-      }
-
-      public static com.google.protobuf.Parser<PhoneNumber> PARSER =
-          new com.google.protobuf.AbstractParser<PhoneNumber>() {
-        public PhoneNumber parsePartialFrom(
-            com.google.protobuf.CodedInputStream input,
-            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-            throws com.google.protobuf.InvalidProtocolBufferException {
-          return new PhoneNumber(input, extensionRegistry);
-        }
-      };
-
-      @java.lang.Override
-      public com.google.protobuf.Parser<PhoneNumber> getParserForType() {
-        return PARSER;
-      }
-
-      private int bitField0_;
-      // required string number = 1;
-      public static final int NUMBER_FIELD_NUMBER = 1;
-      private java.lang.Object number_;
-      /**
-       * <code>required string number = 1;</code>
-       */
-      public boolean hasNumber() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>required string number = 1;</code>
-       */
-      public java.lang.String getNumber() {
-        java.lang.Object ref = number_;
-        if (ref instanceof java.lang.String) {
-          return (java.lang.String) ref;
-        } else {
-          com.google.protobuf.ByteString bs = 
-              (com.google.protobuf.ByteString) ref;
-          java.lang.String s = bs.toStringUtf8();
-          if (bs.isValidUtf8()) {
-            number_ = s;
-          }
-          return s;
-        }
-      }
-      /**
-       * <code>required string number = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getNumberBytes() {
-        java.lang.Object ref = number_;
-        if (ref instanceof java.lang.String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          number_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-
-      // optional .tutorial.Person.PhoneType type = 2 [default = HOME];
-      public static final int TYPE_FIELD_NUMBER = 2;
-      private org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType type_;
-      /**
-       * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
-       */
-      public boolean hasType() {
-        return ((bitField0_ & 0x00000002) == 0x00000002);
-      }
-      /**
-       * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
-       */
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType getType() {
-        return type_;
-      }
-
-      private void initFields() {
-        number_ = "";
-        type_ = org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType.HOME;
-      }
-      private byte memoizedIsInitialized = -1;
-      public final boolean isInitialized() {
-        byte isInitialized = memoizedIsInitialized;
-        if (isInitialized != -1) return isInitialized == 1;
-
-        if (!hasNumber()) {
-          memoizedIsInitialized = 0;
-          return false;
-        }
-        memoizedIsInitialized = 1;
-        return true;
-      }
-
-      public void writeTo(com.google.protobuf.CodedOutputStream output)
-                          throws java.io.IOException {
-        getSerializedSize();
-        if (((bitField0_ & 0x00000001) == 0x00000001)) {
-          output.writeBytes(1, getNumberBytes());
-        }
-        if (((bitField0_ & 0x00000002) == 0x00000002)) {
-          output.writeEnum(2, type_.getNumber());
-        }
-        getUnknownFields().writeTo(output);
-      }
-
-      private int memoizedSerializedSize = -1;
-      public int getSerializedSize() {
-        int size = memoizedSerializedSize;
-        if (size != -1) return size;
-
-        size = 0;
-        if (((bitField0_ & 0x00000001) == 0x00000001)) {
-          size += com.google.protobuf.CodedOutputStream
-            .computeBytesSize(1, getNumberBytes());
-        }
-        if (((bitField0_ & 0x00000002) == 0x00000002)) {
-          size += com.google.protobuf.CodedOutputStream
-            .computeEnumSize(2, type_.getNumber());
-        }
-        size += getUnknownFields().getSerializedSize();
-        memoizedSerializedSize = size;
-        return size;
-      }
-
-      private static final long serialVersionUID = 0L;
-      @java.lang.Override
-      protected java.lang.Object writeReplace()
-          throws java.io.ObjectStreamException {
-        return super.writeReplace();
-      }
-
-      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
-          com.google.protobuf.ByteString data)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return PARSER.parseFrom(data);
-      }
-      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
-          com.google.protobuf.ByteString data,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return PARSER.parseFrom(data, extensionRegistry);
-      }
-      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(byte[] data)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return PARSER.parseFrom(data);
-      }
-      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
-          byte[] data,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return PARSER.parseFrom(data, extensionRegistry);
-      }
-      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(java.io.InputStream input)
-          throws java.io.IOException {
-        return PARSER.parseFrom(input);
-      }
-      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
-          java.io.InputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        return PARSER.parseFrom(input, extensionRegistry);
-      }
-      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseDelimitedFrom(java.io.InputStream input)
-          throws java.io.IOException {
-        return PARSER.parseDelimitedFrom(input);
-      }
-      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseDelimitedFrom(
-          java.io.InputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        return PARSER.parseDelimitedFrom(input, extensionRegistry);
-      }
-      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
-          com.google.protobuf.CodedInputStream input)
-          throws java.io.IOException {
-        return PARSER.parseFrom(input);
-      }
-      public static org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parseFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        return PARSER.parseFrom(input, extensionRegistry);
-      }
-
-      public static Builder newBuilder() { return Builder.create(); }
-      public Builder newBuilderForType() { return newBuilder(); }
-      public static Builder newBuilder(org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber prototype) {
-        return newBuilder().mergeFrom(prototype);
-      }
-      public Builder toBuilder() { return newBuilder(this); }
-
-      @java.lang.Override
-      protected Builder newBuilderForType(
-          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-        Builder builder = new Builder(parent);
-        return builder;
-      }
-      /**
-       * Protobuf type {@code tutorial.Person.PhoneNumber}
-       */
-      public static final class Builder extends
-          com.google.protobuf.GeneratedMessage.Builder<Builder>
-         implements org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder {
-        public static final com.google.protobuf.Descriptors.Descriptor
-            getDescriptor() {
-          return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_descriptor;
-        }
-
-        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-            internalGetFieldAccessorTable() {
-          return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable
-              .ensureFieldAccessorsInitialized(
-                  org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.class, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder.class);
-        }
-
-        // Construct using org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.newBuilder()
-        private Builder() {
-          maybeForceBuilderInitialization();
-        }
-
-        private Builder(
-            com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-          super(parent);
-          maybeForceBuilderInitialization();
-        }
-        private void maybeForceBuilderInitialization() {
-          if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
-          }
-        }
-        private static Builder create() {
-          return new Builder();
-        }
-
-        public Builder clear() {
-          super.clear();
-          number_ = "";
-          bitField0_ = (bitField0_ & ~0x00000001);
-          type_ = org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType.HOME;
-          bitField0_ = (bitField0_ & ~0x00000002);
-          return this;
-        }
-
-        public Builder clone() {
-          return create().mergeFrom(buildPartial());
-        }
-
-        public com.google.protobuf.Descriptors.Descriptor
-            getDescriptorForType() {
-          return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_descriptor;
-        }
-
-        public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber getDefaultInstanceForType() {
-          return org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.getDefaultInstance();
-        }
-
-        public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber build() {
-          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber result = buildPartial();
-          if (!result.isInitialized()) {
-            throw newUninitializedMessageException(result);
-          }
-          return result;
-        }
-
-        public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber buildPartial() {
-          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber result = new org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber(this);
-          int from_bitField0_ = bitField0_;
-          int to_bitField0_ = 0;
-          if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-            to_bitField0_ |= 0x00000001;
-          }
-          result.number_ = number_;
-          if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
-            to_bitField0_ |= 0x00000002;
-          }
-          result.type_ = type_;
-          result.bitField0_ = to_bitField0_;
-          onBuilt();
-          return result;
-        }
-
-        public Builder mergeFrom(com.google.protobuf.Message other) {
-          if (other instanceof org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber) {
-            return mergeFrom((org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber)other);
-          } else {
-            super.mergeFrom(other);
-            return this;
-          }
-        }
-
-        public Builder mergeFrom(org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber other) {
-          if (other == org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.getDefaultInstance()) return this;
-          if (other.hasNumber()) {
-            bitField0_ |= 0x00000001;
-            number_ = other.number_;
-            onChanged();
-          }
-          if (other.hasType()) {
-            setType(other.getType());
-          }
-          this.mergeUnknownFields(other.getUnknownFields());
-          return this;
-        }
-
-        public final boolean isInitialized() {
-          if (!hasNumber()) {
-            
-            return false;
-          }
-          return true;
-        }
-
-        public Builder mergeFrom(
-            com.google.protobuf.CodedInputStream input,
-            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-            throws java.io.IOException {
-          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber parsedMessage = null;
-          try {
-            parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-            parsedMessage = (org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber) e.getUnfinishedMessage();
-            throw e;
-          } finally {
-            if (parsedMessage != null) {
-              mergeFrom(parsedMessage);
-            }
-          }
-          return this;
-        }
-        private int bitField0_;
-
-        // required string number = 1;
-        private java.lang.Object number_ = "";
-        /**
-         * <code>required string number = 1;</code>
-         */
-        public boolean hasNumber() {
-          return ((bitField0_ & 0x00000001) == 0x00000001);
-        }
-        /**
-         * <code>required string number = 1;</code>
-         */
-        public java.lang.String getNumber() {
-          java.lang.Object ref = number_;
-          if (!(ref instanceof java.lang.String)) {
-            java.lang.String s = ((com.google.protobuf.ByteString) ref)
-                .toStringUtf8();
-            number_ = s;
-            return s;
-          } else {
-            return (java.lang.String) ref;
-          }
-        }
-        /**
-         * <code>required string number = 1;</code>
-         */
-        public com.google.protobuf.ByteString
-            getNumberBytes() {
-          java.lang.Object ref = number_;
-          if (ref instanceof String) {
-            com.google.protobuf.ByteString b = 
-                com.google.protobuf.ByteString.copyFromUtf8(
-                    (java.lang.String) ref);
-            number_ = b;
-            return b;
-          } else {
-            return (com.google.protobuf.ByteString) ref;
-          }
-        }
-        /**
-         * <code>required string number = 1;</code>
-         */
-        public Builder setNumber(
-            java.lang.String value) {
-          if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-          number_ = value;
-          onChanged();
-          return this;
-        }
-        /**
-         * <code>required string number = 1;</code>
-         */
-        public Builder clearNumber() {
-          bitField0_ = (bitField0_ & ~0x00000001);
-          number_ = getDefaultInstance().getNumber();
-          onChanged();
-          return this;
-        }
-        /**
-         * <code>required string number = 1;</code>
-         */
-        public Builder setNumberBytes(
-            com.google.protobuf.ByteString value) {
-          if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-          number_ = value;
-          onChanged();
-          return this;
-        }
-
-        // optional .tutorial.Person.PhoneType type = 2 [default = HOME];
-        private org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType type_ = org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType.HOME;
-        /**
-         * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
-         */
-        public boolean hasType() {
-          return ((bitField0_ & 0x00000002) == 0x00000002);
-        }
-        /**
-         * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
-         */
-        public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType getType() {
-          return type_;
-        }
-        /**
-         * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
-         */
-        public Builder setType(org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType value) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          bitField0_ |= 0x00000002;
-          type_ = value;
-          onChanged();
-          return this;
-        }
-        /**
-         * <code>optional .tutorial.Person.PhoneType type = 2 [default = HOME];</code>
-         */
-        public Builder clearType() {
-          bitField0_ = (bitField0_ & ~0x00000002);
-          type_ = org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneType.HOME;
-          onChanged();
-          return this;
-        }
-
-        // @@protoc_insertion_point(builder_scope:tutorial.Person.PhoneNumber)
-      }
-
-      static {
-        defaultInstance = new PhoneNumber(true);
-        defaultInstance.initFields();
-      }
-
-      // @@protoc_insertion_point(class_scope:tutorial.Person.PhoneNumber)
-    }
-
-    private int bitField0_;
-    // required string name = 1;
-    public static final int NAME_FIELD_NUMBER = 1;
-    private java.lang.Object name_;
-    /**
-     * <code>required string name = 1;</code>
-     */
-    public boolean hasName() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>required string name = 1;</code>
-     */
-    public java.lang.String getName() {
-      java.lang.Object ref = name_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          name_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>required string name = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getNameBytes() {
-      java.lang.Object ref = name_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        name_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // required int32 id = 2;
-    public static final int ID_FIELD_NUMBER = 2;
-    private int id_;
-    /**
-     * <code>required int32 id = 2;</code>
-     *
-     * <pre>
-     * Unique ID number for this person.
-     * </pre>
-     */
-    public boolean hasId() {
-      return ((bitField0_ & 0x00000002) == 0x00000002);
-    }
-    /**
-     * <code>required int32 id = 2;</code>
-     *
-     * <pre>
-     * Unique ID number for this person.
-     * </pre>
-     */
-    public int getId() {
-      return id_;
-    }
-
-    // optional string email = 3;
-    public static final int EMAIL_FIELD_NUMBER = 3;
-    private java.lang.Object email_;
-    /**
-     * <code>optional string email = 3;</code>
-     */
-    public boolean hasEmail() {
-      return ((bitField0_ & 0x00000004) == 0x00000004);
-    }
-    /**
-     * <code>optional string email = 3;</code>
-     */
-    public java.lang.String getEmail() {
-      java.lang.Object ref = email_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          email_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>optional string email = 3;</code>
-     */
-    public com.google.protobuf.ByteString
-        getEmailBytes() {
-      java.lang.Object ref = email_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        email_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // repeated .tutorial.Person.PhoneNumber phone = 4;
-    public static final int PHONE_FIELD_NUMBER = 4;
-    private java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> phone_;
-    /**
-     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-     */
-    public java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> getPhoneList() {
-      return phone_;
-    }
-    /**
-     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-     */
-    public java.util.List<? extends org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder> 
-        getPhoneOrBuilderList() {
-      return phone_;
-    }
-    /**
-     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-     */
-    public int getPhoneCount() {
-      return phone_.size();
-    }
-    /**
-     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-     */
-    public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber getPhone(int index) {
-      return phone_.get(index);
-    }
-    /**
-     * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-     */
-    public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder getPhoneOrBuilder(
-        int index) {
-      return phone_.get(index);
-    }
-
-    private void initFields() {
-      name_ = "";
-      id_ = 0;
-      email_ = "";
-      phone_ = java.util.Collections.emptyList();
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      if (!hasName()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasId()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      for (int i = 0; i < getPhoneCount(); i++) {
-        if (!getPhone(i).isInitialized()) {
-          memoizedIsInitialized = 0;
-          return false;
-        }
-      }
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      getSerializedSize();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeBytes(1, getNameBytes());
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeInt32(2, id_);
-      }
-      if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        output.writeBytes(3, getEmailBytes());
-      }
-      for (int i = 0; i < phone_.size(); i++) {
-        output.writeMessage(4, phone_.get(i));
-      }
-      getUnknownFields().writeTo(output);
-    }
-
-    private int memoizedSerializedSize = -1;
-    public int getSerializedSize() {
-      int size = memoizedSerializedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(1, getNameBytes());
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(2, id_);
-      }
-      if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(3, getEmailBytes());
-      }
-      for (int i = 0; i < phone_.size(); i++) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(4, phone_.get(i));
-      }
-      size += getUnknownFields().getSerializedSize();
-      memoizedSerializedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    protected java.lang.Object writeReplace()
-        throws java.io.ObjectStreamException {
-      return super.writeReplace();
-    }
-
-    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.Person parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-
-    public static Builder newBuilder() { return Builder.create(); }
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.apache.mina.generated.protoc.AddressBookProtos.Person prototype) {
-      return newBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() { return newBuilder(this); }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * Protobuf type {@code tutorial.Person}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.mina.generated.protoc.AddressBookProtos.Person.class, org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder.class);
-      }
-
-      // Construct using org.apache.mina.generated.protoc.AddressBookProtos.Person.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
-          getPhoneFieldBuilder();
-        }
-      }
-      private static Builder create() {
-        return new Builder();
-      }
-
-      public Builder clear() {
-        super.clear();
-        name_ = "";
-        bitField0_ = (bitField0_ & ~0x00000001);
-        id_ = 0;
-        bitField0_ = (bitField0_ & ~0x00000002);
-        email_ = "";
-        bitField0_ = (bitField0_ & ~0x00000004);
-        if (phoneBuilder_ == null) {
-          phone_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000008);
-        } else {
-          phoneBuilder_.clear();
-        }
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_Person_descriptor;
-      }
-
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person getDefaultInstanceForType() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.Person.getDefaultInstance();
-      }
-
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person build() {
-        org.apache.mina.generated.protoc.AddressBookProtos.Person result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person buildPartial() {
-        org.apache.mina.generated.protoc.AddressBookProtos.Person result = new org.apache.mina.generated.protoc.AddressBookProtos.Person(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.name_ = name_;
-        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
-          to_bitField0_ |= 0x00000002;
-        }
-        result.id_ = id_;
-        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
-          to_bitField0_ |= 0x00000004;
-        }
-        result.email_ = email_;
-        if (phoneBuilder_ == null) {
-          if (((bitField0_ & 0x00000008) == 0x00000008)) {
-            phone_ = java.util.Collections.unmodifiableList(phone_);
-            bitField0_ = (bitField0_ & ~0x00000008);
-          }
-          result.phone_ = phone_;
-        } else {
-          result.phone_ = phoneBuilder_.build();
-        }
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.mina.generated.protoc.AddressBookProtos.Person) {
-          return mergeFrom((org.apache.mina.generated.protoc.AddressBookProtos.Person)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.mina.generated.protoc.AddressBookProtos.Person other) {
-        if (other == org.apache.mina.generated.protoc.AddressBookProtos.Person.getDefaultInstance()) return this;
-        if (other.hasName()) {
-          bitField0_ |= 0x00000001;
-          name_ = other.name_;
-          onChanged();
-        }
-        if (other.hasId()) {
-          setId(other.getId());
-        }
-        if (other.hasEmail()) {
-          bitField0_ |= 0x00000004;
-          email_ = other.email_;
-          onChanged();
-        }
-        if (phoneBuilder_ == null) {
-          if (!other.phone_.isEmpty()) {
-            if (phone_.isEmpty()) {
-              phone_ = other.phone_;
-              bitField0_ = (bitField0_ & ~0x00000008);
-            } else {
-              ensurePhoneIsMutable();
-              phone_.addAll(other.phone_);
-            }
-            onChanged();
-          }
-        } else {
-          if (!other.phone_.isEmpty()) {
-            if (phoneBuilder_.isEmpty()) {
-              phoneBuilder_.dispose();
-              phoneBuilder_ = null;
-              phone_ = other.phone_;
-              bitField0_ = (bitField0_ & ~0x00000008);
-              phoneBuilder_ = 
-                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
-                   getPhoneFieldBuilder() : null;
-            } else {
-              phoneBuilder_.addAllMessages(other.phone_);
-            }
-          }
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        if (!hasName()) {
-          
-          return false;
-        }
-        if (!hasId()) {
-          
-          return false;
-        }
-        for (int i = 0; i < getPhoneCount(); i++) {
-          if (!getPhone(i).isInitialized()) {
-            
-            return false;
-          }
-        }
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.mina.generated.protoc.AddressBookProtos.Person parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.mina.generated.protoc.AddressBookProtos.Person) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // required string name = 1;
-      private java.lang.Object name_ = "";
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public boolean hasName() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public java.lang.String getName() {
-        java.lang.Object ref = name_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          name_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getNameBytes() {
-        java.lang.Object ref = name_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          name_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public Builder setName(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        name_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public Builder clearName() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        name_ = getDefaultInstance().getName();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string name = 1;</code>
-       */
-      public Builder setNameBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        name_ = value;
-        onChanged();
-        return this;
-      }
-
-      // required int32 id = 2;
-      private int id_ ;
-      /**
-       * <code>required int32 id = 2;</code>
-       *
-       * <pre>
-       * Unique ID number for this person.
-       * </pre>
-       */
-      public boolean hasId() {
-        return ((bitField0_ & 0x00000002) == 0x00000002);
-      }
-      /**
-       * <code>required int32 id = 2;</code>
-       *
-       * <pre>
-       * Unique ID number for this person.
-       * </pre>
-       */
-      public int getId() {
-        return id_;
-      }
-      /**
-       * <code>required int32 id = 2;</code>
-       *
-       * <pre>
-       * Unique ID number for this person.
-       * </pre>
-       */
-      public Builder setId(int value) {
-        bitField0_ |= 0x00000002;
-        id_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required int32 id = 2;</code>
-       *
-       * <pre>
-       * Unique ID number for this person.
-       * </pre>
-       */
-      public Builder clearId() {
-        bitField0_ = (bitField0_ & ~0x00000002);
-        id_ = 0;
-        onChanged();
-        return this;
-      }
-
-      // optional string email = 3;
-      private java.lang.Object email_ = "";
-      /**
-       * <code>optional string email = 3;</code>
-       */
-      public boolean hasEmail() {
-        return ((bitField0_ & 0x00000004) == 0x00000004);
-      }
-      /**
-       * <code>optional string email = 3;</code>
-       */
-      public java.lang.String getEmail() {
-        java.lang.Object ref = email_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          email_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string email = 3;</code>
-       */
-      public com.google.protobuf.ByteString
-          getEmailBytes() {
-        java.lang.Object ref = email_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          email_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string email = 3;</code>
-       */
-      public Builder setEmail(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000004;
-        email_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string email = 3;</code>
-       */
-      public Builder clearEmail() {
-        bitField0_ = (bitField0_ & ~0x00000004);
-        email_ = getDefaultInstance().getEmail();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string email = 3;</code>
-       */
-      public Builder setEmailBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000004;
-        email_ = value;
-        onChanged();
-        return this;
-      }
-
-      // repeated .tutorial.Person.PhoneNumber phone = 4;
-      private java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> phone_ =
-        java.util.Collections.emptyList();
-      private void ensurePhoneIsMutable() {
-        if (!((bitField0_ & 0x00000008) == 0x00000008)) {
-          phone_ = new java.util.ArrayList<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber>(phone_);
-          bitField0_ |= 0x00000008;
-         }
-      }
-
-      private com.google.protobuf.RepeatedFieldBuilder<
-          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder> phoneBuilder_;
-
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> getPhoneList() {
-        if (phoneBuilder_ == null) {
-          return java.util.Collections.unmodifiableList(phone_);
-        } else {
-          return phoneBuilder_.getMessageList();
-        }
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public int getPhoneCount() {
-        if (phoneBuilder_ == null) {
-          return phone_.size();
-        } else {
-          return phoneBuilder_.getCount();
-        }
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber getPhone(int index) {
-        if (phoneBuilder_ == null) {
-          return phone_.get(index);
-        } else {
-          return phoneBuilder_.getMessage(index);
-        }
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public Builder setPhone(
-          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber value) {
-        if (phoneBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensurePhoneIsMutable();
-          phone_.set(index, value);
-          onChanged();
-        } else {
-          phoneBuilder_.setMessage(index, value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public Builder setPhone(
-          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) {
-        if (phoneBuilder_ == null) {
-          ensurePhoneIsMutable();
-          phone_.set(index, builderForValue.build());
-          onChanged();
-        } else {
-          phoneBuilder_.setMessage(index, builderForValue.build());
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public Builder addPhone(org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber value) {
-        if (phoneBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensurePhoneIsMutable();
-          phone_.add(value);
-          onChanged();
-        } else {
-          phoneBuilder_.addMessage(value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public Builder addPhone(
-          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber value) {
-        if (phoneBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensurePhoneIsMutable();
-          phone_.add(index, value);
-          onChanged();
-        } else {
-          phoneBuilder_.addMessage(index, value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public Builder addPhone(
-          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) {
-        if (phoneBuilder_ == null) {
-          ensurePhoneIsMutable();
-          phone_.add(builderForValue.build());
-          onChanged();
-        } else {
-          phoneBuilder_.addMessage(builderForValue.build());
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public Builder addPhone(
-          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) {
-        if (phoneBuilder_ == null) {
-          ensurePhoneIsMutable();
-          phone_.add(index, builderForValue.build());
-          onChanged();
-        } else {
-          phoneBuilder_.addMessage(index, builderForValue.build());
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public Builder addAllPhone(
-          java.lang.Iterable<? extends org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber> values) {
-        if (phoneBuilder_ == null) {
-          ensurePhoneIsMutable();
-          super.addAll(values, phone_);
-          onChanged();
-        } else {
-          phoneBuilder_.addAllMessages(values);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public Builder clearPhone() {
-        if (phoneBuilder_ == null) {
-          phone_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000008);
-          onChanged();
-        } else {
-          phoneBuilder_.clear();
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public Builder removePhone(int index) {
-        if (phoneBuilder_ == null) {
-          ensurePhoneIsMutable();
-          phone_.remove(index);
-          onChanged();
-        } else {
-          phoneBuilder_.remove(index);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder getPhoneBuilder(
-          int index) {
-        return getPhoneFieldBuilder().getBuilder(index);
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder getPhoneOrBuilder(
-          int index) {
-        if (phoneBuilder_ == null) {
-          return phone_.get(index);  } else {
-          return phoneBuilder_.getMessageOrBuilder(index);
-        }
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public java.util.List<? extends org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder> 
-           getPhoneOrBuilderList() {
-        if (phoneBuilder_ != null) {
-          return phoneBuilder_.getMessageOrBuilderList();
-        } else {
-          return java.util.Collections.unmodifiableList(phone_);
-        }
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder addPhoneBuilder() {
-        return getPhoneFieldBuilder().addBuilder(
-            org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.getDefaultInstance());
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder addPhoneBuilder(
-          int index) {
-        return getPhoneFieldBuilder().addBuilder(
-            index, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.getDefaultInstance());
-      }
-      /**
-       * <code>repeated .tutorial.Person.PhoneNumber phone = 4;</code>
-       */
-      public java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder> 
-           getPhoneBuilderList() {
-        return getPhoneFieldBuilder().getBuilderList();
-      }
-      private com.google.protobuf.RepeatedFieldBuilder<
-          org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder> 
-          getPhoneFieldBuilder() {
-        if (phoneBuilder_ == null) {
-          phoneBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
-              org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumber.Builder, org.apache.mina.generated.protoc.AddressBookProtos.Person.PhoneNumberOrBuilder>(
-                  phone_,
-                  ((bitField0_ & 0x00000008) == 0x00000008),
-                  getParentForChildren(),
-                  isClean());
-          phone_ = null;
-        }
-        return phoneBuilder_;
-      }
-
-      // @@protoc_insertion_point(builder_scope:tutorial.Person)
-    }
-
-    static {
-      defaultInstance = new Person(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:tutorial.Person)
-  }
-
-  public interface AddressBookOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // repeated .tutorial.Person person = 1;
-    /**
-     * <code>repeated .tutorial.Person person = 1;</code>
-     */
-    java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person> 
-        getPersonList();
-    /**
-     * <code>repeated .tutorial.Person person = 1;</code>
-     */
-    org.apache.mina.generated.protoc.AddressBookProtos.Person getPerson(int index);
-    /**
-     * <code>repeated .tutorial.Person person = 1;</code>
-     */
-    int getPersonCount();
-    /**
-     * <code>repeated .tutorial.Person person = 1;</code>
-     */
-    java.util.List<? extends org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder> 
-        getPersonOrBuilderList();
-    /**
-     * <code>repeated .tutorial.Person person = 1;</code>
-     */
-    org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder getPersonOrBuilder(
-        int index);
-  }
-  /**
-   * Protobuf type {@code tutorial.AddressBook}
-   *
-   * <pre>
-   * Our address book file is just one of these.
-   * </pre>
-   */
-  public static final class AddressBook extends
-      com.google.protobuf.GeneratedMessage
-      implements AddressBookOrBuilder {
-    // Use AddressBook.newBuilder() to construct.
-    private AddressBook(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private AddressBook(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final AddressBook defaultInstance;
-    public static AddressBook getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public AddressBook getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private AddressBook(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      initFields();
-      int mutable_bitField0_ = 0;
-      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-          com.google.protobuf.UnknownFieldSet.newBuilder();
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-                person_ = new java.util.ArrayList<org.apache.mina.generated.protoc.AddressBookProtos.Person>();
-                mutable_bitField0_ |= 0x00000001;
-              }
-              person_.add(input.readMessage(org.apache.mina.generated.protoc.AddressBookProtos.Person.PARSER, extensionRegistry));
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e.getMessage()).setUnfinishedMessage(this);
-      } finally {
-        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-          person_ = java.util.Collections.unmodifiableList(person_);
-        }
-        this.unknownFields = unknownFields.build();
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_AddressBook_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_AddressBook_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.class, org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<AddressBook> PARSER =
-        new com.google.protobuf.AbstractParser<AddressBook>() {
-      public AddressBook parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new AddressBook(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<AddressBook> getParserForType() {
-      return PARSER;
-    }
-
-    // repeated .tutorial.Person person = 1;
-    public static final int PERSON_FIELD_NUMBER = 1;
-    private java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person> person_;
-    /**
-     * <code>repeated .tutorial.Person person = 1;</code>
-     */
-    public java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person> getPersonList() {
-      return person_;
-    }
-    /**
-     * <code>repeated .tutorial.Person person = 1;</code>
-     */
-    public java.util.List<? extends org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder> 
-        getPersonOrBuilderList() {
-      return person_;
-    }
-    /**
-     * <code>repeated .tutorial.Person person = 1;</code>
-     */
-    public int getPersonCount() {
-      return person_.size();
-    }
-    /**
-     * <code>repeated .tutorial.Person person = 1;</code>
-     */
-    public org.apache.mina.generated.protoc.AddressBookProtos.Person getPerson(int index) {
-      return person_.get(index);
-    }
-    /**
-     * <code>repeated .tutorial.Person person = 1;</code>
-     */
-    public org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder getPersonOrBuilder(
-        int index) {
-      return person_.get(index);
-    }
-
-    private void initFields() {
-      person_ = java.util.Collections.emptyList();
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      for (int i = 0; i < getPersonCount(); i++) {
-        if (!getPerson(i).isInitialized()) {
-          memoizedIsInitialized = 0;
-          return false;
-        }
-      }
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      getSerializedSize();
-      for (int i = 0; i < person_.size(); i++) {
-        output.writeMessage(1, person_.get(i));
-      }
-      getUnknownFields().writeTo(output);
-    }
-
-    private int memoizedSerializedSize = -1;
-    public int getSerializedSize() {
-      int size = memoizedSerializedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      for (int i = 0; i < person_.size(); i++) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(1, person_.get(i));
-      }
-      size += getUnknownFields().getSerializedSize();
-      memoizedSerializedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    protected java.lang.Object writeReplace()
-        throws java.io.ObjectStreamException {
-      return super.writeReplace();
-    }
-
-    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-
-    public static Builder newBuilder() { return Builder.create(); }
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.apache.mina.generated.protoc.AddressBookProtos.AddressBook prototype) {
-      return newBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() { return newBuilder(this); }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * Protobuf type {@code tutorial.AddressBook}
-     *
-     * <pre>
-     * Our address book file is just one of these.
-     * </pre>
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.apache.mina.generated.protoc.AddressBookProtos.AddressBookOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_AddressBook_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_AddressBook_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.class, org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.Builder.class);
-      }
-
-      // Construct using org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
-          getPersonFieldBuilder();
-        }
-      }
-      private static Builder create() {
-        return new Builder();
-      }
-
-      public Builder clear() {
-        super.clear();
-        if (personBuilder_ == null) {
-          person_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000001);
-        } else {
-          personBuilder_.clear();
-        }
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.internal_static_tutorial_AddressBook_descriptor;
-      }
-
-      public org.apache.mina.generated.protoc.AddressBookProtos.AddressBook getDefaultInstanceForType() {
-        return org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.getDefaultInstance();
-      }
-
-      public org.apache.mina.generated.protoc.AddressBookProtos.AddressBook build() {
-        org.apache.mina.generated.protoc.AddressBookProtos.AddressBook result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.mina.generated.protoc.AddressBookProtos.AddressBook buildPartial() {
-        org.apache.mina.generated.protoc.AddressBookProtos.AddressBook result = new org.apache.mina.generated.protoc.AddressBookProtos.AddressBook(this);
-        int from_bitField0_ = bitField0_;
-        if (personBuilder_ == null) {
-          if (((bitField0_ & 0x00000001) == 0x00000001)) {
-            person_ = java.util.Collections.unmodifiableList(person_);
-            bitField0_ = (bitField0_ & ~0x00000001);
-          }
-          result.person_ = person_;
-        } else {
-          result.person_ = personBuilder_.build();
-        }
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.mina.generated.protoc.AddressBookProtos.AddressBook) {
-          return mergeFrom((org.apache.mina.generated.protoc.AddressBookProtos.AddressBook)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.mina.generated.protoc.AddressBookProtos.AddressBook other) {
-        if (other == org.apache.mina.generated.protoc.AddressBookProtos.AddressBook.getDefaultInstance()) return this;
-        if (personBuilder_ == null) {
-          if (!other.person_.isEmpty()) {
-            if (person_.isEmpty()) {
-              person_ = other.person_;
-              bitField0_ = (bitField0_ & ~0x00000001);
-            } else {
-              ensurePersonIsMutable();
-              person_.addAll(other.person_);
-            }
-            onChanged();
-          }
-        } else {
-          if (!other.person_.isEmpty()) {
-            if (personBuilder_.isEmpty()) {
-              personBuilder_.dispose();
-              personBuilder_ = null;
-              person_ = other.person_;
-              bitField0_ = (bitField0_ & ~0x00000001);
-              personBuilder_ = 
-                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
-                   getPersonFieldBuilder() : null;
-            } else {
-              personBuilder_.addAllMessages(other.person_);
-            }
-          }
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        for (int i = 0; i < getPersonCount(); i++) {
-          if (!getPerson(i).isInitialized()) {
-            
-            return false;
-          }
-        }
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.mina.generated.protoc.AddressBookProtos.AddressBook parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.mina.generated.protoc.AddressBookProtos.AddressBook) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // repeated .tutorial.Person person = 1;
-      private java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person> person_ =
-        java.util.Collections.emptyList();
-      private void ensurePersonIsMutable() {
-        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
-          person_ = new java.util.ArrayList<org.apache.mina.generated.protoc.AddressBookProtos.Person>(person_);
-          bitField0_ |= 0x00000001;
-         }
-      }
-
-      private com.google.protobuf.RepeatedFieldBuilder<
-          org.apache.mina.generated.protoc.AddressBookProtos.Person, org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder, org.apache.mina.generated.protoc.AddressBookProtos.PersonOrBuilder> personBuilder_;
-
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public java.util.List<org.apache.mina.generated.protoc.AddressBookProtos.Person> getPersonList() {
-        if (personBuilder_ == null) {
-          return java.util.Collections.unmodifiableList(person_);
-        } else {
-          return personBuilder_.getMessageList();
-        }
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public int getPersonCount() {
-        if (personBuilder_ == null) {
-          return person_.size();
-        } else {
-          return personBuilder_.getCount();
-        }
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person getPerson(int index) {
-        if (personBuilder_ == null) {
-          return person_.get(index);
-        } else {
-          return personBuilder_.getMessage(index);
-        }
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public Builder setPerson(
-          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person value) {
-        if (personBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensurePersonIsMutable();
-          person_.set(index, value);
-          onChanged();
-        } else {
-          personBuilder_.setMessage(index, value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public Builder setPerson(
-          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder builderForValue) {
-        if (personBuilder_ == null) {
-          ensurePersonIsMutable();
-          person_.set(index, builderForValue.build());
-          onChanged();
-        } else {
-          personBuilder_.setMessage(index, builderForValue.build());
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public Builder addPerson(org.apache.mina.generated.protoc.AddressBookProtos.Person value) {
-        if (personBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensurePersonIsMutable();
-          person_.add(value);
-          onChanged();
-        } else {
-          personBuilder_.addMessage(value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public Builder addPerson(
-          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person value) {
-        if (personBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensurePersonIsMutable();
-          person_.add(index, value);
-          onChanged();
-        } else {
-          personBuilder_.addMessage(index, value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public Builder addPerson(
-          org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder builderForValue) {
-        if (personBuilder_ == null) {
-          ensurePersonIsMutable();
-          person_.add(builderForValue.build());
-          onChanged();
-        } else {
-          personBuilder_.addMessage(builderForValue.build());
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public Builder addPerson(
-          int index, org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder builderForValue) {
-        if (personBuilder_ == null) {
-          ensurePersonIsMutable();
-          person_.add(index, builderForValue.build());
-          onChanged();
-        } else {
-          personBuilder_.addMessage(index, builderForValue.build());
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public Builder addAllPerson(
-          java.lang.Iterable<? extends org.apache.mina.generated.protoc.AddressBookProtos.Person> values) {
-        if (personBuilder_ == null) {
-          ensurePersonIsMutable();
-          super.addAll(values, person_);
-          onChanged();
-        } else {
-          personBuilder_.addAllMessages(values);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public Builder clearPerson() {
-        if (personBuilder_ == null) {
-          person_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000001);
-          onChanged();
-        } else {
-          personBuilder_.clear();
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public Builder removePerson(int index) {
-        if (personBuilder_ == null) {
-          ensurePersonIsMutable();
-          person_.remove(index);
-          onChanged();
-        } else {
-          personBuilder_.remove(index);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public org.apache.mina.generated.protoc.AddressBookProtos.Person.Builder getPersonBuilder(
-          int index) {
-        return getPersonFieldBuilder().getBuilder(index);
-      }
-      /**
-       * <code>repeated .tutorial.Person person = 1;</code>
-       */
-      public org.apache.mina.generated.protoc.AddressBookPr

<TRUNCATED>

[7/7] git commit: flatenned the hierarchy of serialization packages

Posted by jv...@apache.org.
flatenned the hierarchy of serialization packages


Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/1e6bb8b0
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/1e6bb8b0
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/1e6bb8b0

Branch: refs/heads/trunk
Commit: 1e6bb8b0272992a5f0abfc81cef61380ad2a2db4
Parents: d36370c
Author: jvermillard <jv...@apache.org>
Authored: Thu May 9 22:27:52 2013 +0200
Committer: jvermillard <jv...@apache.org>
Committed: Thu May 9 22:27:52 2013 +0200

----------------------------------------------------------------------
 NOTE-serialization.txt                             |   36 +
 pom.xml                                            |    3 +-
 protobuf/pom.xml                                   |   72 +
 protobuf/prepare.sh                                |   15 +
 .../mina/codec/delimited/ProtobufDecoder.java      |   46 +
 .../codec/delimited/ProtobufDynamicDecoder.java    |   40 +
 .../mina/codec/delimited/ProtobufEncoder.java      |   42 +
 .../ProtobufDynamicMessageDecoder.java             |   76 +
 .../serialization/ProtobufMessageDecoder.java      |   67 +
 .../serialization/ProtobufMessageEncoder.java      |   47 +
 .../apache/mina/codec/delimited/ProtobufTest.java  |   63 +
 .../delimited/serialization/ProtobufTest.java      |   70 +
 .../mina/generated/protoc/AddressBookProtos.java   | 2563 +++++++++++++++
 .../org/apache/mina/generated/protoc/Calc.java     | 1160 +++++++
 protobuf/src/test/protobuf/addressbook.proto       |   30 +
 protobuf/src/test/protobuf/calc.proto              |   25 +
 serialization/NOTES.txt                            |   36 -
 serialization/pom.xml                              |   46 -
 serialization/protobuf/pom.xml                     |   72 -
 serialization/protobuf/prepare.sh                  |   15 -
 .../mina/codec/delimited/ProtobufDecoder.java      |   46 -
 .../codec/delimited/ProtobufDynamicDecoder.java    |   40 -
 .../mina/codec/delimited/ProtobufEncoder.java      |   42 -
 .../ProtobufDynamicMessageDecoder.java             |   76 -
 .../serialization/ProtobufMessageDecoder.java      |   67 -
 .../serialization/ProtobufMessageEncoder.java      |   47 -
 .../apache/mina/codec/delimited/ProtobufTest.java  |   63 -
 .../delimited/serialization/ProtobufTest.java      |   70 -
 .../mina/generated/protoc/AddressBookProtos.java   | 2563 ---------------
 .../org/apache/mina/generated/protoc/Calc.java     | 1160 -------
 .../protobuf/src/test/protobuf/addressbook.proto   |   30 -
 .../protobuf/src/test/protobuf/calc.proto          |   25 -
 serialization/thrift/pom.xml                       |   70 -
 serialization/thrift/prepare.sh                    |   14 -
 .../apache/mina/codec/delimited/ThriftDecoder.java |   37 -
 .../mina/codec/delimited/ThriftDynamicDecoder.java |   40 -
 .../apache/mina/codec/delimited/ThriftEncoder.java |   40 -
 .../serialization/ThriftDynamicMessageDecoder.java |   69 -
 .../serialization/ThriftMessageDecoder.java        |   57 -
 .../serialization/ThriftMessageEncoder.java        |   67 -
 .../apache/mina/codec/delimited/ThriftTest.java    |   71 -
 .../codec/delimited/serialization/ThriftTest.java  |   69 -
 .../apache/mina/generated/thrift/UserProfile.java  |  602 ----
 .../apache/mina/generated/thrift/UserStorage.java  | 1596 ---------
 serialization/thrift/src/test/thrift/user.thrift   |   29 -
 thrift/pom.xml                                     |   70 +
 thrift/prepare.sh                                  |   14 +
 .../apache/mina/codec/delimited/ThriftDecoder.java |   37 +
 .../mina/codec/delimited/ThriftDynamicDecoder.java |   40 +
 .../apache/mina/codec/delimited/ThriftEncoder.java |   40 +
 .../serialization/ThriftDynamicMessageDecoder.java |   69 +
 .../serialization/ThriftMessageDecoder.java        |   57 +
 .../serialization/ThriftMessageEncoder.java        |   67 +
 .../apache/mina/codec/delimited/ThriftTest.java    |   71 +
 .../codec/delimited/serialization/ThriftTest.java  |   69 +
 .../apache/mina/generated/thrift/UserProfile.java  |  602 ++++
 .../apache/mina/generated/thrift/UserStorage.java  | 1596 +++++++++
 thrift/src/test/thrift/user.thrift                 |   29 +
 58 files changed, 7115 insertions(+), 7160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/NOTE-serialization.txt
----------------------------------------------------------------------
diff --git a/NOTE-serialization.txt b/NOTE-serialization.txt
new file mode 100644
index 0000000..22be0dd
--- /dev/null
+++ b/NOTE-serialization.txt
@@ -0,0 +1,36 @@
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ 
+ 
+ 
+ Notes on Apache Thrift and Google Protocol Buffer in MINA 3.0
+ =============================================================
+ 
+ Both Thrift and Protobuf need a specific executable files to generate the 
+ required Java code.
+ 
+ Both modules doesn't have any dependency against code generated by these
+ executable files, but the dedicated unit tests have dependencies against
+ them.
+ 
+ Not having the appropriate version of Apache Thrift or Google Protocol
+ Buffer should not prevent developers/users to build MINA 3.0. For this
+ particular reason, the generated files are also stored on the
+ repository.
+ 
+ The generation scripts are stored in both directories under the name 
+ "prepare.sh". 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4a08653..77461a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -109,7 +109,8 @@
       <module>http</module>
       <module>examples</module>
       <module>coap</module>
-      <module>serialization</module>
+      <module>thrift</module>
+      <module>protobuf</module>
   </modules>
 
   <dependencyManagement>

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/pom.xml
----------------------------------------------------------------------
diff --git a/protobuf/pom.xml b/protobuf/pom.xml
new file mode 100644
index 0000000..2f400ac
--- /dev/null
+++ b/protobuf/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.mina</groupId>
+        <artifactId>mina-parent</artifactId>
+        <version>3.0.0-M1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>mina-protobuf</artifactId>
+    <name>Apache MINA Serialization::Protobuf ${project.version}</name>
+    <packaging>bundle</packaging>
+
+    <properties>
+        <symbolicName>${project.groupId}.protobuf</symbolicName>
+        <exportedPackage>${project.groupId}</exportedPackage>
+        <protobuf.version>2.5.0</protobuf.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.google.protobuf</groupId>
+            <artifactId>protobuf-java</artifactId>
+            <version>${protobuf.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.apache.logging.log4j.adapters</groupId>
+            <artifactId>slf4j-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>mina-codec</artifactId>
+            <version>${project.version}</version>
+            <type>bundle</type>
+        </dependency>
+        
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>mina-codec</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+            <classifier>tests</classifier>
+        </dependency>
+        
+    </dependencies>
+</project>
+

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/prepare.sh
----------------------------------------------------------------------
diff --git a/protobuf/prepare.sh b/protobuf/prepare.sh
new file mode 100644
index 0000000..84fd1fc
--- /dev/null
+++ b/protobuf/prepare.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+if hash protoc 2>/dev/null; then
+	VERSION=`protoc --version`
+
+	if [[ $VERSION =~ libprotoc\ 2\.5\. ]];
+	then
+		protoc --java_out=src/test/java src/test/protobuf/addressbook.proto src/test/protobuf/calc.proto
+	else
+		echo "Need Google Protocol Buffer 2.5.x (found $VERSION)"
+	fi
+else
+	echo "No installation of Google Protocol Buffer found"
+fi
+

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java
----------------------------------------------------------------------
diff --git a/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java b/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java
new file mode 100644
index 0000000..7072d6e
--- /dev/null
+++ b/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited;
+
+import org.apache.mina.codec.delimited.ints.VarInt;
+import org.apache.mina.codec.delimited.serialization.ProtobufMessageDecoder;
+
+import com.google.protobuf.ExtensionRegistryLite;
+import com.google.protobuf.GeneratedMessage;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ProtobufDecoder<M extends GeneratedMessage> extends SizePrefixedDecoder<M> {
+    static public <L extends GeneratedMessage> ProtobufDecoder<L> newInstance(Class<L> clazz,
+            ExtensionRegistryLite registry) throws SecurityException, NoSuchMethodException {
+        return new ProtobufDecoder<L>(clazz, registry);
+    }
+
+    static public <L extends GeneratedMessage> ProtobufDecoder<L> newInstance(Class<L> clazz) throws SecurityException,
+            NoSuchMethodException {
+        return newInstance(clazz, ExtensionRegistryLite.getEmptyRegistry());
+    }
+
+    public ProtobufDecoder(Class<M> clazz, ExtensionRegistryLite registry) throws SecurityException,
+            NoSuchMethodException {
+        super(new VarInt.Decoder(), ProtobufMessageDecoder.newInstance(clazz, registry));
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java
----------------------------------------------------------------------
diff --git a/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java b/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java
new file mode 100644
index 0000000..e3b2506
--- /dev/null
+++ b/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited;
+
+import org.apache.mina.codec.delimited.ints.VarInt;
+import org.apache.mina.codec.delimited.serialization.ProtobufDynamicMessageDecoder;
+
+import com.google.protobuf.GeneratedMessage;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ProtobufDynamicDecoder extends
+        SizePrefixedDecoder<ProtobufDynamicMessageDecoder.ProtobufSerializedMessage> {
+    static public <L extends GeneratedMessage> ProtobufDynamicDecoder newInstance() throws SecurityException,
+            NoSuchMethodException {
+        return new ProtobufDynamicDecoder();
+    }
+
+    public ProtobufDynamicDecoder() throws SecurityException, NoSuchMethodException {
+        super(new VarInt.Decoder(), ProtobufDynamicMessageDecoder.newInstance());
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufEncoder.java
----------------------------------------------------------------------
diff --git a/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufEncoder.java b/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufEncoder.java
new file mode 100644
index 0000000..8386e89
--- /dev/null
+++ b/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufEncoder.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited;
+
+import org.apache.mina.codec.delimited.ints.VarInt;
+import org.apache.mina.codec.delimited.serialization.ProtobufMessageEncoder;
+
+import com.google.protobuf.GeneratedMessage;
+
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ProtobufEncoder<OUT extends GeneratedMessage> extends
+		SizePrefixedEncoder<OUT> {
+
+	static public <L extends GeneratedMessage> ProtobufEncoder<L> newInstance(
+			Class<L> clazz) {
+		return new ProtobufEncoder<L>(clazz);
+	}
+
+	public ProtobufEncoder(Class<OUT> clazz) {
+		super(new VarInt.Encoder(), ProtobufMessageEncoder.newInstance(clazz));
+	}
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java
----------------------------------------------------------------------
diff --git a/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java b/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java
new file mode 100644
index 0000000..b574c08
--- /dev/null
+++ b/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java
@@ -0,0 +1,76 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited.serialization;
+
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
+
+import org.apache.mina.codec.ProtocolDecoderException;
+import org.apache.mina.codec.delimited.ByteBufferDecoder;
+import org.apache.mina.util.ByteBufferInputStream;
+
+import com.google.protobuf.ExtensionRegistryLite;
+import com.google.protobuf.GeneratedMessage;
+
+/**
+ * An alternative decoder for protobuf which allows the use various target
+ * classes with the same decoder.
+ * 
+ * This decoder converts incoming {@link ByteBuffer} into
+ * {@link ProtobufSerializedMessage}.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ProtobufDynamicMessageDecoder extends
+        ByteBufferDecoder<ProtobufDynamicMessageDecoder.ProtobufSerializedMessage> {
+
+    static public ProtobufDynamicMessageDecoder newInstance() {
+        return new ProtobufDynamicMessageDecoder();
+    }
+
+    @Override
+    public ProtobufSerializedMessage decode(ByteBuffer input) throws ProtocolDecoderException {
+        return new ProtobufSerializedMessage(input);
+    }
+
+    final static public class ProtobufSerializedMessage {
+        final private ByteBuffer input;
+
+        public ProtobufSerializedMessage(ByteBuffer input) {
+            this.input = input;
+        }
+
+        @SuppressWarnings("unchecked")
+        public <L extends GeneratedMessage> L get(Class<L> clazz, ExtensionRegistryLite registry)
+                throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException,
+                InvocationTargetException {
+            Method parseMethod = clazz.getDeclaredMethod("parseFrom", InputStream.class, ExtensionRegistryLite.class);
+            return (L) parseMethod.invoke(null, new ByteBufferInputStream(input.duplicate()), registry);
+        }
+
+        public <L extends GeneratedMessage> L get(Class<L> clazz) throws SecurityException, NoSuchMethodException,
+                IllegalArgumentException, IllegalAccessException, InvocationTargetException {
+            return get(clazz, ExtensionRegistryLite.getEmptyRegistry());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java
----------------------------------------------------------------------
diff --git a/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java b/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java
new file mode 100644
index 0000000..94b5218
--- /dev/null
+++ b/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited.serialization;
+
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
+
+import org.apache.mina.codec.ProtocolDecoderException;
+import org.apache.mina.codec.delimited.ByteBufferDecoder;
+import org.apache.mina.util.ByteBufferInputStream;
+
+import com.google.protobuf.ExtensionRegistryLite;
+import com.google.protobuf.GeneratedMessage;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ProtobufMessageDecoder<IN extends GeneratedMessage> extends ByteBufferDecoder<IN> {
+    final private Method parseMethod;
+
+    final private ExtensionRegistryLite registry;
+
+    public static <TYPE extends GeneratedMessage> ProtobufMessageDecoder<TYPE> newInstance(Class<TYPE> c)
+            throws SecurityException, NoSuchMethodException {
+        return newInstance(c, ExtensionRegistryLite.getEmptyRegistry());
+    }
+
+    public static <TYPE extends GeneratedMessage> ProtobufMessageDecoder<TYPE> newInstance(Class<TYPE> c,
+            ExtensionRegistryLite registry) throws SecurityException, NoSuchMethodException {
+        return new ProtobufMessageDecoder<TYPE>(c, registry);
+    }
+
+    private ProtobufMessageDecoder(Class<IN> clazz, ExtensionRegistryLite registry) throws SecurityException,
+            NoSuchMethodException {
+        super();
+        parseMethod = clazz.getDeclaredMethod("parseFrom", InputStream.class, ExtensionRegistryLite.class);
+        this.registry = registry;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public IN decode(ByteBuffer input) throws ProtocolDecoderException {
+        try {
+            return (IN) parseMethod.invoke(null, new ByteBufferInputStream(input), registry);
+        } catch (Exception e) {
+            throw new ProtocolDecoderException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageEncoder.java
----------------------------------------------------------------------
diff --git a/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageEncoder.java b/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageEncoder.java
new file mode 100644
index 0000000..178d9b5
--- /dev/null
+++ b/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageEncoder.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited.serialization;
+
+import java.nio.ByteBuffer;
+
+import org.apache.mina.codec.delimited.ByteBufferEncoder;
+
+import com.google.protobuf.GeneratedMessage;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ProtobufMessageEncoder<OUT extends GeneratedMessage> extends ByteBufferEncoder<OUT> {
+
+    static public <T extends GeneratedMessage> ProtobufMessageEncoder<T> newInstance(Class<T> clazz) {
+        return new ProtobufMessageEncoder<T>();
+    }
+
+    @Override
+    public int getEncodedSize(OUT message) {
+        return message.getSerializedSize();
+    }
+
+    @Override
+    public void writeTo(OUT message, ByteBuffer buffer) {
+        buffer.put(message.toByteArray());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/test/java/org/apache/mina/codec/delimited/ProtobufTest.java
----------------------------------------------------------------------
diff --git a/protobuf/src/test/java/org/apache/mina/codec/delimited/ProtobufTest.java b/protobuf/src/test/java/org/apache/mina/codec/delimited/ProtobufTest.java
new file mode 100644
index 0000000..3f90370
--- /dev/null
+++ b/protobuf/src/test/java/org/apache/mina/codec/delimited/ProtobufTest.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.mina.generated.protoc.AddressBookProtos.Person;
+import org.apache.mina.util.ByteBufferOutputStream;
+
+/**
+ * A {@link ProtobufEncoder} and {@link ProtobufDecoder} test.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ProtobufTest extends DelimitTest<Person> {
+  
+
+    @Override
+    public List<Person> getObjects() {
+
+        List<Person> list = new LinkedList<Person>();
+
+        list.add(Person.newBuilder().setId(1).setName("Jean Dupond").setEmail("john.white@bigcorp.com").build());
+        list.add(Person.newBuilder().setId(2).setName("Marie Blanc").setEmail("marie.blanc@bigcorp.com").build());
+
+        return list;
+    }
+
+    @Override
+    protected ByteBuffer delimitWithOriginal() throws IOException {
+        ByteBufferOutputStream bbos = new ByteBufferOutputStream();
+        bbos.setElastic(true);
+        for (Person p : getObjects()) {
+            p.writeDelimitedTo(bbos);
+        }
+        return bbos.getByteBuffer();
+    }
+
+    @Override
+    public SizePrefixedEncoder<Person> getSerializer() {
+        return ProtobufEncoder.newInstance(Person.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/test/java/org/apache/mina/codec/delimited/serialization/ProtobufTest.java
----------------------------------------------------------------------
diff --git a/protobuf/src/test/java/org/apache/mina/codec/delimited/serialization/ProtobufTest.java b/protobuf/src/test/java/org/apache/mina/codec/delimited/serialization/ProtobufTest.java
new file mode 100644
index 0000000..abc96ea
--- /dev/null
+++ b/protobuf/src/test/java/org/apache/mina/codec/delimited/serialization/ProtobufTest.java
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited.serialization;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.mina.codec.delimited.ByteBufferDecoder;
+import org.apache.mina.codec.delimited.ByteBufferEncoder;
+import org.apache.mina.codec.delimited.serialization.ProtobufDynamicMessageDecoder.ProtobufSerializedMessage;
+import org.apache.mina.generated.protoc.AddressBookProtos.Person;
+import org.junit.Test;
+
+/**
+ * A {@link ProtobufMessageEncoder} and {@link ProtobufMessageDecoder} test.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ProtobufTest extends GenericSerializerTest<Person> {
+
+    @Override
+    public List<Person> getObjects() {
+        List<Person> list = new LinkedList<Person>();
+
+        list.add(Person.newBuilder().setId(1).setName("Jean Dupond").setEmail("john.white@bigcorp.com").build());
+        list.add(Person.newBuilder().setId(2).setName("Marie Blanc").setEmail("marie.blanc@bigcorp.com").build());
+
+        return list;
+    }
+ 
+    @Override
+    public ByteBufferDecoder<Person> getDecoder() throws Exception {
+        return ProtobufMessageDecoder.newInstance(Person.class);
+    }
+
+    @Override
+    public ByteBufferEncoder<Person> getEncoder() throws Exception {
+        return new ProtobufMessageEncoder<Person>();
+    }
+
+    @Test
+    public void testDynamic() throws Exception {
+        ByteBufferEncoder<Person> encoder = getEncoder();
+        ProtobufDynamicMessageDecoder decoder = new ProtobufDynamicMessageDecoder();
+
+        for (Person object : getObjects()) {
+            ProtobufSerializedMessage message = decoder.decode(encoder.encode(object));
+            assertEquals(object, message.get(Person.class));
+        }
+    }
+}


[3/7] flatenned the hierarchy of serialization packages

Posted by jv...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java b/serialization/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java
deleted file mode 100644
index f1b61dc..0000000
--- a/serialization/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java
+++ /dev/null
@@ -1,1160 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: src/test/protobuf/calc.proto
-
-package org.apache.mina.generated.protoc;
-
-public final class Calc {
-  private Calc() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-  }
-  public interface ComputationOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // required double x = 1;
-    /**
-     * <code>required double x = 1;</code>
-     */
-    boolean hasX();
-    /**
-     * <code>required double x = 1;</code>
-     */
-    double getX();
-
-    // required double y = 2;
-    /**
-     * <code>required double y = 2;</code>
-     */
-    boolean hasY();
-    /**
-     * <code>required double y = 2;</code>
-     */
-    double getY();
-
-    // required .tutorial.Computation.Operator operator = 3;
-    /**
-     * <code>required .tutorial.Computation.Operator operator = 3;</code>
-     */
-    boolean hasOperator();
-    /**
-     * <code>required .tutorial.Computation.Operator operator = 3;</code>
-     */
-    org.apache.mina.generated.protoc.Calc.Computation.Operator getOperator();
-  }
-  /**
-   * Protobuf type {@code tutorial.Computation}
-   */
-  public static final class Computation extends
-      com.google.protobuf.GeneratedMessage
-      implements ComputationOrBuilder {
-    // Use Computation.newBuilder() to construct.
-    private Computation(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private Computation(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final Computation defaultInstance;
-    public static Computation getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public Computation getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private Computation(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      initFields();
-      int mutable_bitField0_ = 0;
-      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-          com.google.protobuf.UnknownFieldSet.newBuilder();
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 9: {
-              bitField0_ |= 0x00000001;
-              x_ = input.readDouble();
-              break;
-            }
-            case 17: {
-              bitField0_ |= 0x00000002;
-              y_ = input.readDouble();
-              break;
-            }
-            case 24: {
-              int rawValue = input.readEnum();
-              org.apache.mina.generated.protoc.Calc.Computation.Operator value = org.apache.mina.generated.protoc.Calc.Computation.Operator.valueOf(rawValue);
-              if (value == null) {
-                unknownFields.mergeVarintField(3, rawValue);
-              } else {
-                bitField0_ |= 0x00000004;
-                operator_ = value;
-              }
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e.getMessage()).setUnfinishedMessage(this);
-      } finally {
-        this.unknownFields = unknownFields.build();
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Computation_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Computation_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.mina.generated.protoc.Calc.Computation.class, org.apache.mina.generated.protoc.Calc.Computation.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<Computation> PARSER =
-        new com.google.protobuf.AbstractParser<Computation>() {
-      public Computation parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new Computation(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<Computation> getParserForType() {
-      return PARSER;
-    }
-
-    /**
-     * Protobuf enum {@code tutorial.Computation.Operator}
-     */
-    public enum Operator
-        implements com.google.protobuf.ProtocolMessageEnum {
-      /**
-       * <code>PLUS = 0;</code>
-       */
-      PLUS(0, 0),
-      /**
-       * <code>MINUS = 1;</code>
-       */
-      MINUS(1, 1),
-      /**
-       * <code>TIMES = 2;</code>
-       */
-      TIMES(2, 2),
-      /**
-       * <code>DIVIDE = 3;</code>
-       */
-      DIVIDE(3, 3),
-      ;
-
-      /**
-       * <code>PLUS = 0;</code>
-       */
-      public static final int PLUS_VALUE = 0;
-      /**
-       * <code>MINUS = 1;</code>
-       */
-      public static final int MINUS_VALUE = 1;
-      /**
-       * <code>TIMES = 2;</code>
-       */
-      public static final int TIMES_VALUE = 2;
-      /**
-       * <code>DIVIDE = 3;</code>
-       */
-      public static final int DIVIDE_VALUE = 3;
-
-
-      public final int getNumber() { return value; }
-
-      public static Operator valueOf(int value) {
-        switch (value) {
-          case 0: return PLUS;
-          case 1: return MINUS;
-          case 2: return TIMES;
-          case 3: return DIVIDE;
-          default: return null;
-        }
-      }
-
-      public static com.google.protobuf.Internal.EnumLiteMap<Operator>
-          internalGetValueMap() {
-        return internalValueMap;
-      }
-      private static com.google.protobuf.Internal.EnumLiteMap<Operator>
-          internalValueMap =
-            new com.google.protobuf.Internal.EnumLiteMap<Operator>() {
-              public Operator findValueByNumber(int number) {
-                return Operator.valueOf(number);
-              }
-            };
-
-      public final com.google.protobuf.Descriptors.EnumValueDescriptor
-          getValueDescriptor() {
-        return getDescriptor().getValues().get(index);
-      }
-      public final com.google.protobuf.Descriptors.EnumDescriptor
-          getDescriptorForType() {
-        return getDescriptor();
-      }
-      public static final com.google.protobuf.Descriptors.EnumDescriptor
-          getDescriptor() {
-        return org.apache.mina.generated.protoc.Calc.Computation.getDescriptor().getEnumTypes().get(0);
-      }
-
-      private static final Operator[] VALUES = values();
-
-      public static Operator valueOf(
-          com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
-        if (desc.getType() != getDescriptor()) {
-          throw new java.lang.IllegalArgumentException(
-            "EnumValueDescriptor is not for this type.");
-        }
-        return VALUES[desc.getIndex()];
-      }
-
-      private final int index;
-      private final int value;
-
-      private Operator(int index, int value) {
-        this.index = index;
-        this.value = value;
-      }
-
-      // @@protoc_insertion_point(enum_scope:tutorial.Computation.Operator)
-    }
-
-    private int bitField0_;
-    // required double x = 1;
-    public static final int X_FIELD_NUMBER = 1;
-    private double x_;
-    /**
-     * <code>required double x = 1;</code>
-     */
-    public boolean hasX() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>required double x = 1;</code>
-     */
-    public double getX() {
-      return x_;
-    }
-
-    // required double y = 2;
-    public static final int Y_FIELD_NUMBER = 2;
-    private double y_;
-    /**
-     * <code>required double y = 2;</code>
-     */
-    public boolean hasY() {
-      return ((bitField0_ & 0x00000002) == 0x00000002);
-    }
-    /**
-     * <code>required double y = 2;</code>
-     */
-    public double getY() {
-      return y_;
-    }
-
-    // required .tutorial.Computation.Operator operator = 3;
-    public static final int OPERATOR_FIELD_NUMBER = 3;
-    private org.apache.mina.generated.protoc.Calc.Computation.Operator operator_;
-    /**
-     * <code>required .tutorial.Computation.Operator operator = 3;</code>
-     */
-    public boolean hasOperator() {
-      return ((bitField0_ & 0x00000004) == 0x00000004);
-    }
-    /**
-     * <code>required .tutorial.Computation.Operator operator = 3;</code>
-     */
-    public org.apache.mina.generated.protoc.Calc.Computation.Operator getOperator() {
-      return operator_;
-    }
-
-    private void initFields() {
-      x_ = 0D;
-      y_ = 0D;
-      operator_ = org.apache.mina.generated.protoc.Calc.Computation.Operator.PLUS;
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      if (!hasX()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasY()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!hasOperator()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      getSerializedSize();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeDouble(1, x_);
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeDouble(2, y_);
-      }
-      if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        output.writeEnum(3, operator_.getNumber());
-      }
-      getUnknownFields().writeTo(output);
-    }
-
-    private int memoizedSerializedSize = -1;
-    public int getSerializedSize() {
-      int size = memoizedSerializedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeDoubleSize(1, x_);
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeDoubleSize(2, y_);
-      }
-      if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeEnumSize(3, operator_.getNumber());
-      }
-      size += getUnknownFields().getSerializedSize();
-      memoizedSerializedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    protected java.lang.Object writeReplace()
-        throws java.io.ObjectStreamException {
-      return super.writeReplace();
-    }
-
-    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Computation parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Computation parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-
-    public static Builder newBuilder() { return Builder.create(); }
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.apache.mina.generated.protoc.Calc.Computation prototype) {
-      return newBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() { return newBuilder(this); }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * Protobuf type {@code tutorial.Computation}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.apache.mina.generated.protoc.Calc.ComputationOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Computation_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Computation_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.mina.generated.protoc.Calc.Computation.class, org.apache.mina.generated.protoc.Calc.Computation.Builder.class);
-      }
-
-      // Construct using org.apache.mina.generated.protoc.Calc.Computation.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
-        }
-      }
-      private static Builder create() {
-        return new Builder();
-      }
-
-      public Builder clear() {
-        super.clear();
-        x_ = 0D;
-        bitField0_ = (bitField0_ & ~0x00000001);
-        y_ = 0D;
-        bitField0_ = (bitField0_ & ~0x00000002);
-        operator_ = org.apache.mina.generated.protoc.Calc.Computation.Operator.PLUS;
-        bitField0_ = (bitField0_ & ~0x00000004);
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Computation_descriptor;
-      }
-
-      public org.apache.mina.generated.protoc.Calc.Computation getDefaultInstanceForType() {
-        return org.apache.mina.generated.protoc.Calc.Computation.getDefaultInstance();
-      }
-
-      public org.apache.mina.generated.protoc.Calc.Computation build() {
-        org.apache.mina.generated.protoc.Calc.Computation result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.mina.generated.protoc.Calc.Computation buildPartial() {
-        org.apache.mina.generated.protoc.Calc.Computation result = new org.apache.mina.generated.protoc.Calc.Computation(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.x_ = x_;
-        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
-          to_bitField0_ |= 0x00000002;
-        }
-        result.y_ = y_;
-        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
-          to_bitField0_ |= 0x00000004;
-        }
-        result.operator_ = operator_;
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.mina.generated.protoc.Calc.Computation) {
-          return mergeFrom((org.apache.mina.generated.protoc.Calc.Computation)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.mina.generated.protoc.Calc.Computation other) {
-        if (other == org.apache.mina.generated.protoc.Calc.Computation.getDefaultInstance()) return this;
-        if (other.hasX()) {
-          setX(other.getX());
-        }
-        if (other.hasY()) {
-          setY(other.getY());
-        }
-        if (other.hasOperator()) {
-          setOperator(other.getOperator());
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        if (!hasX()) {
-          
-          return false;
-        }
-        if (!hasY()) {
-          
-          return false;
-        }
-        if (!hasOperator()) {
-          
-          return false;
-        }
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.mina.generated.protoc.Calc.Computation parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.mina.generated.protoc.Calc.Computation) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // required double x = 1;
-      private double x_ ;
-      /**
-       * <code>required double x = 1;</code>
-       */
-      public boolean hasX() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>required double x = 1;</code>
-       */
-      public double getX() {
-        return x_;
-      }
-      /**
-       * <code>required double x = 1;</code>
-       */
-      public Builder setX(double value) {
-        bitField0_ |= 0x00000001;
-        x_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required double x = 1;</code>
-       */
-      public Builder clearX() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        x_ = 0D;
-        onChanged();
-        return this;
-      }
-
-      // required double y = 2;
-      private double y_ ;
-      /**
-       * <code>required double y = 2;</code>
-       */
-      public boolean hasY() {
-        return ((bitField0_ & 0x00000002) == 0x00000002);
-      }
-      /**
-       * <code>required double y = 2;</code>
-       */
-      public double getY() {
-        return y_;
-      }
-      /**
-       * <code>required double y = 2;</code>
-       */
-      public Builder setY(double value) {
-        bitField0_ |= 0x00000002;
-        y_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required double y = 2;</code>
-       */
-      public Builder clearY() {
-        bitField0_ = (bitField0_ & ~0x00000002);
-        y_ = 0D;
-        onChanged();
-        return this;
-      }
-
-      // required .tutorial.Computation.Operator operator = 3;
-      private org.apache.mina.generated.protoc.Calc.Computation.Operator operator_ = org.apache.mina.generated.protoc.Calc.Computation.Operator.PLUS;
-      /**
-       * <code>required .tutorial.Computation.Operator operator = 3;</code>
-       */
-      public boolean hasOperator() {
-        return ((bitField0_ & 0x00000004) == 0x00000004);
-      }
-      /**
-       * <code>required .tutorial.Computation.Operator operator = 3;</code>
-       */
-      public org.apache.mina.generated.protoc.Calc.Computation.Operator getOperator() {
-        return operator_;
-      }
-      /**
-       * <code>required .tutorial.Computation.Operator operator = 3;</code>
-       */
-      public Builder setOperator(org.apache.mina.generated.protoc.Calc.Computation.Operator value) {
-        if (value == null) {
-          throw new NullPointerException();
-        }
-        bitField0_ |= 0x00000004;
-        operator_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required .tutorial.Computation.Operator operator = 3;</code>
-       */
-      public Builder clearOperator() {
-        bitField0_ = (bitField0_ & ~0x00000004);
-        operator_ = org.apache.mina.generated.protoc.Calc.Computation.Operator.PLUS;
-        onChanged();
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:tutorial.Computation)
-    }
-
-    static {
-      defaultInstance = new Computation(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:tutorial.Computation)
-  }
-
-  public interface ResultOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // required double z = 1;
-    /**
-     * <code>required double z = 1;</code>
-     */
-    boolean hasZ();
-    /**
-     * <code>required double z = 1;</code>
-     */
-    double getZ();
-  }
-  /**
-   * Protobuf type {@code tutorial.Result}
-   */
-  public static final class Result extends
-      com.google.protobuf.GeneratedMessage
-      implements ResultOrBuilder {
-    // Use Result.newBuilder() to construct.
-    private Result(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private Result(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final Result defaultInstance;
-    public static Result getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public Result getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private Result(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      initFields();
-      int mutable_bitField0_ = 0;
-      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-          com.google.protobuf.UnknownFieldSet.newBuilder();
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 9: {
-              bitField0_ |= 0x00000001;
-              z_ = input.readDouble();
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e.getMessage()).setUnfinishedMessage(this);
-      } finally {
-        this.unknownFields = unknownFields.build();
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Result_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Result_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.mina.generated.protoc.Calc.Result.class, org.apache.mina.generated.protoc.Calc.Result.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<Result> PARSER =
-        new com.google.protobuf.AbstractParser<Result>() {
-      public Result parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new Result(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<Result> getParserForType() {
-      return PARSER;
-    }
-
-    private int bitField0_;
-    // required double z = 1;
-    public static final int Z_FIELD_NUMBER = 1;
-    private double z_;
-    /**
-     * <code>required double z = 1;</code>
-     */
-    public boolean hasZ() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>required double z = 1;</code>
-     */
-    public double getZ() {
-      return z_;
-    }
-
-    private void initFields() {
-      z_ = 0D;
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      if (!hasZ()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      getSerializedSize();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeDouble(1, z_);
-      }
-      getUnknownFields().writeTo(output);
-    }
-
-    private int memoizedSerializedSize = -1;
-    public int getSerializedSize() {
-      int size = memoizedSerializedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeDoubleSize(1, z_);
-      }
-      size += getUnknownFields().getSerializedSize();
-      memoizedSerializedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    protected java.lang.Object writeReplace()
-        throws java.io.ObjectStreamException {
-      return super.writeReplace();
-    }
-
-    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Result parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Result parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input, extensionRegistry);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-
-    public static Builder newBuilder() { return Builder.create(); }
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.apache.mina.generated.protoc.Calc.Result prototype) {
-      return newBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() { return newBuilder(this); }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * Protobuf type {@code tutorial.Result}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.apache.mina.generated.protoc.Calc.ResultOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Result_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Result_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.mina.generated.protoc.Calc.Result.class, org.apache.mina.generated.protoc.Calc.Result.Builder.class);
-      }
-
-      // Construct using org.apache.mina.generated.protoc.Calc.Result.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
-        }
-      }
-      private static Builder create() {
-        return new Builder();
-      }
-
-      public Builder clear() {
-        super.clear();
-        z_ = 0D;
-        bitField0_ = (bitField0_ & ~0x00000001);
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Result_descriptor;
-      }
-
-      public org.apache.mina.generated.protoc.Calc.Result getDefaultInstanceForType() {
-        return org.apache.mina.generated.protoc.Calc.Result.getDefaultInstance();
-      }
-
-      public org.apache.mina.generated.protoc.Calc.Result build() {
-        org.apache.mina.generated.protoc.Calc.Result result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.mina.generated.protoc.Calc.Result buildPartial() {
-        org.apache.mina.generated.protoc.Calc.Result result = new org.apache.mina.generated.protoc.Calc.Result(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.z_ = z_;
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.mina.generated.protoc.Calc.Result) {
-          return mergeFrom((org.apache.mina.generated.protoc.Calc.Result)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.mina.generated.protoc.Calc.Result other) {
-        if (other == org.apache.mina.generated.protoc.Calc.Result.getDefaultInstance()) return this;
-        if (other.hasZ()) {
-          setZ(other.getZ());
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        if (!hasZ()) {
-          
-          return false;
-        }
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.mina.generated.protoc.Calc.Result parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.mina.generated.protoc.Calc.Result) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // required double z = 1;
-      private double z_ ;
-      /**
-       * <code>required double z = 1;</code>
-       */
-      public boolean hasZ() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>required double z = 1;</code>
-       */
-      public double getZ() {
-        return z_;
-      }
-      /**
-       * <code>required double z = 1;</code>
-       */
-      public Builder setZ(double value) {
-        bitField0_ |= 0x00000001;
-        z_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required double z = 1;</code>
-       */
-      public Builder clearZ() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        z_ = 0D;
-        onChanged();
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:tutorial.Result)
-    }
-
-    static {
-      defaultInstance = new Result(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:tutorial.Result)
-  }
-
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_tutorial_Computation_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_tutorial_Computation_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_tutorial_Result_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_tutorial_Result_fieldAccessorTable;
-
-  public static com.google.protobuf.Descriptors.FileDescriptor
-      getDescriptor() {
-    return descriptor;
-  }
-  private static com.google.protobuf.Descriptors.FileDescriptor
-      descriptor;
-  static {
-    java.lang.String[] descriptorData = {
-      "\n\034src/test/protobuf/calc.proto\022\010tutorial" +
-      "\"\215\001\n\013Computation\022\t\n\001x\030\001 \002(\001\022\t\n\001y\030\002 \002(\001\0220" +
-      "\n\010operator\030\003 \002(\0162\036.tutorial.Computation." +
-      "Operator\"6\n\010Operator\022\010\n\004PLUS\020\000\022\t\n\005MINUS\020" +
-      "\001\022\t\n\005TIMES\020\002\022\n\n\006DIVIDE\020\003\"\023\n\006Result\022\t\n\001z\030" +
-      "\001 \002(\001B(\n org.apache.mina.generated.proto" +
-      "cB\004Calc"
-    };
-    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
-      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
-        public com.google.protobuf.ExtensionRegistry assignDescriptors(
-            com.google.protobuf.Descriptors.FileDescriptor root) {
-          descriptor = root;
-          internal_static_tutorial_Computation_descriptor =
-            getDescriptor().getMessageTypes().get(0);
-          internal_static_tutorial_Computation_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_tutorial_Computation_descriptor,
-              new java.lang.String[] { "X", "Y", "Operator", });
-          internal_static_tutorial_Result_descriptor =
-            getDescriptor().getMessageTypes().get(1);
-          internal_static_tutorial_Result_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_tutorial_Result_descriptor,
-              new java.lang.String[] { "Z", });
-          return null;
-        }
-      };
-    com.google.protobuf.Descriptors.FileDescriptor
-      .internalBuildGeneratedFileFrom(descriptorData,
-        new com.google.protobuf.Descriptors.FileDescriptor[] {
-        }, assigner);
-  }
-
-  // @@protoc_insertion_point(outer_class_scope)
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/test/protobuf/addressbook.proto
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/test/protobuf/addressbook.proto b/serialization/protobuf/src/test/protobuf/addressbook.proto
deleted file mode 100644
index 6bf919d..0000000
--- a/serialization/protobuf/src/test/protobuf/addressbook.proto
+++ /dev/null
@@ -1,30 +0,0 @@
-// See README.txt for information and build instructions.
-
-package tutorial;
-
-option java_package = "org.apache.mina.generated.protoc";
-option java_outer_classname = "AddressBookProtos";
-
-message Person {
-  required string name = 1;
-  required int32 id = 2;        // Unique ID number for this person.
-  optional string email = 3;
-
-  enum PhoneType {
-    MOBILE = 0;
-    HOME = 1;
-    WORK = 2;
-  }
-
-  message PhoneNumber {
-    required string number = 1;
-    optional PhoneType type = 2 [default = HOME];
-  }
-
-  repeated PhoneNumber phone = 4;
-}
-
-// Our address book file is just one of these.
-message AddressBook {
-  repeated Person person = 1;
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/test/protobuf/calc.proto
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/test/protobuf/calc.proto b/serialization/protobuf/src/test/protobuf/calc.proto
deleted file mode 100644
index 44faf25..0000000
--- a/serialization/protobuf/src/test/protobuf/calc.proto
+++ /dev/null
@@ -1,25 +0,0 @@
-// See README.txt for information and build instructions.
-
-package tutorial;
-
-option java_package = "org.apache.mina.generated.protoc";
-option java_outer_classname = "Calc";
-
-message Computation {
-  required double x = 1;
-  required double y = 2;
-
-  required Operator operator = 3;
-
-  enum Operator {
-    PLUS = 0;
-    MINUS = 1;
-    TIMES = 2;
-    DIVIDE = 3;
-  }
-
-}
-
-message Result {
-  required double z = 1;
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/pom.xml
----------------------------------------------------------------------
diff --git a/serialization/thrift/pom.xml b/serialization/thrift/pom.xml
deleted file mode 100644
index 4a89677..0000000
--- a/serialization/thrift/pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.mina</groupId>
-        <artifactId>mina-serialization</artifactId>
-        <version>3.0.0-M1-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>mina-thrift</artifactId>
-    <name>Apache MINA Serialization::Thrift ${project.version}</name>
-    <packaging>bundle</packaging>
-    
-    <properties>
-        <symbolicName>${project.groupId}.thrift</symbolicName>
-        <exportedPackage>${project.groupId}</exportedPackage>
-        <thrift.version>0.9.0</thrift.version>
-    </properties>
-
-    <dependencies>
-        
-        <dependency>
-            <groupId>org.apache.thrift</groupId>
-            <artifactId>libthrift</artifactId>
-            <version>${thrift.version}</version>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.logging.log4j.adapters</groupId>
-            <artifactId>slf4j-impl</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>mina-codec</artifactId>
-            <type>bundle</type>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>mina-codec</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-            <classifier>tests</classifier>
-        </dependency>
-    </dependencies>
-</project>
-

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/prepare.sh
----------------------------------------------------------------------
diff --git a/serialization/thrift/prepare.sh b/serialization/thrift/prepare.sh
deleted file mode 100644
index 8820aef..0000000
--- a/serialization/thrift/prepare.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-if hash thrift 2>/dev/null; then
-	VERSION=`thrift --version`
-
-	if [[ $VERSION =~  version\ 0\.9\. ]];
-	then
-		thrift -I src/test/thrift -out src/test/java --gen java:hashcode src/test/thrift/user.thrift
-	else
-		echo "Need Thrift 0.9.x (found $VERSION)"
-	fi
-else
-	echo "No installation of Thrift found"
-fi

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java b/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java
deleted file mode 100644
index 664753c..0000000
--- a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited;
-
-import org.apache.mina.codec.delimited.ints.RawInt32;
-import org.apache.thrift.TBase;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ThriftDecoder<M extends TBase<?, ?>> extends SizePrefixedDecoder<M> {
-    static public <L extends TBase<?, ?>> ThriftDecoder<L> newInstance(Class<L> clazz) throws SecurityException,
-            NoSuchMethodException {
-        return new ThriftDecoder<L>(clazz);
-    }
-
-    public ThriftDecoder(Class<M> clazz) throws SecurityException, NoSuchMethodException {
-        super(new RawInt32.Decoder(RawInt32.Endianness.BIG), null);
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java b/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java
deleted file mode 100644
index a6d0a04..0000000
--- a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited;
-
-import org.apache.mina.codec.delimited.ints.VarInt;
-import org.apache.mina.codec.delimited.serialization.ThriftDynamicMessageDecoder;
-import org.apache.thrift.TBase;
-
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ThriftDynamicDecoder extends
-        SizePrefixedDecoder<ThriftDynamicMessageDecoder.ThriftSerializedMessage> {
-    static public <L extends TBase<?,?>> ThriftDynamicDecoder newInstance() throws SecurityException,
-            NoSuchMethodException {
-        return new ThriftDynamicDecoder();
-    }
-
-    public ThriftDynamicDecoder() throws SecurityException, NoSuchMethodException {
-        super(new VarInt.Decoder(), ThriftDynamicMessageDecoder.newInstance());
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java b/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java
deleted file mode 100644
index b3fafc6..0000000
--- a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited;
-
-import org.apache.mina.codec.delimited.ints.RawInt32;
-import org.apache.mina.codec.delimited.ints.RawInt32.Endianness;
-import org.apache.mina.codec.delimited.serialization.ThriftMessageEncoder;
-import org.apache.thrift.TBase;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ThriftEncoder<OUT extends TBase<?, ?>> extends SizePrefixedEncoder<OUT> {
-
-    static public <L extends TBase<?, ?>> ThriftEncoder<L> newInstance(Class<L> clazz) throws SecurityException,
-            NoSuchMethodException {
-        return new ThriftEncoder<L>(clazz);
-    }
-
-    public ThriftEncoder(Class<OUT> clazz) throws SecurityException, NoSuchMethodException {
-        super(new RawInt32.Encoder(Endianness.BIG), ThriftMessageEncoder.newInstance(clazz));
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java b/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java
deleted file mode 100644
index d22f9c1..0000000
--- a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited.serialization;
-
-import java.nio.ByteBuffer;
-
-import org.apache.mina.codec.ProtocolDecoderException;
-import org.apache.mina.codec.delimited.ByteBufferDecoder;
-import org.apache.thrift.TBase;
-import org.apache.thrift.TDeserializer;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TBinaryProtocol;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ThriftDynamicMessageDecoder extends
-		ByteBufferDecoder<ThriftDynamicMessageDecoder.ThriftSerializedMessage> {
-	private TDeserializer deserializer = new TDeserializer(
-			new TBinaryProtocol.Factory());
-
-	@Override
-	public ThriftSerializedMessage decode(ByteBuffer input)
-			throws ProtocolDecoderException {
-		byte array[] = new byte[input.remaining()];
-		input.get(array);
-		return new ThriftSerializedMessage(deserializer, array);
-	}
-
-	final static public class ThriftSerializedMessage {
-		final private byte array[];
-
-		final private TDeserializer deserializer;
-
-		public ThriftSerializedMessage(TDeserializer deserializer, byte array[]) {
-			this.array = array;
-			this.deserializer = deserializer;
-		}
-
-		public <L extends TBase<?, ?>> L get(Class<L> clazz)
-				throws InstantiationException, IllegalAccessException,
-				TException {
-			L object = clazz.newInstance();
-			deserializer.deserialize(object, array);
-			return object;
-		}
-	}
-
-	static public ThriftDynamicMessageDecoder newInstance() {
-		return new ThriftDynamicMessageDecoder();
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java b/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java
deleted file mode 100644
index e9739c6..0000000
--- a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited.serialization;
-
-import java.nio.ByteBuffer;
-
-import org.apache.mina.codec.ProtocolDecoderException;
-import org.apache.mina.codec.delimited.ByteBufferDecoder;
-import org.apache.thrift.TBase;
-import org.apache.thrift.TDeserializer;
-import org.apache.thrift.protocol.TBinaryProtocol;
-
-public class ThriftMessageDecoder<IN extends TBase<?, ?>> extends ByteBufferDecoder<IN> {
-    private TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
-
-    final private Class<IN> clazz;
-
-    static public <L extends TBase<?, ?>> ThriftMessageDecoder<L> newInstance(Class<L> clazz) {
-        return new ThriftMessageDecoder<L>(clazz);
-    }
-
-    @Override
-    public IN decode(ByteBuffer input) throws ProtocolDecoderException {
-        IN object;
-        try {
-            byte array[] = new byte[input.remaining()];
-            input.get(array);
-            object = clazz.newInstance();
-            deserializer.deserialize(object, array);
-            return object;
-        } catch (Exception e) {
-            return null;
-        }
-    }
-
-    public ThriftMessageDecoder(Class<IN> clazz) {
-        super();
-        this.clazz = clazz;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageEncoder.java
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageEncoder.java b/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageEncoder.java
deleted file mode 100644
index 04b9186..0000000
--- a/serialization/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageEncoder.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited.serialization;
-
-import java.nio.ByteBuffer;
-
-import org.apache.mina.codec.delimited.ByteBufferEncoder;
-import org.apache.thrift.TBase;
-import org.apache.thrift.TException;
-import org.apache.thrift.TSerializer;
-import org.apache.thrift.protocol.TBinaryProtocol;
-
-public class ThriftMessageEncoder<OUT extends TBase<?, ?>> extends ByteBufferEncoder<OUT> {
-    final private TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
-
-    private OUT lastMessage;
-
-    private byte[] lastBuffer;
-
-    static public <L extends TBase<?, ?>> ThriftMessageEncoder<L> newInstance(Class<L> clazz) {
-        return new ThriftMessageEncoder<L>();
-    }
-
-    private byte[] prepareBuffer(OUT message) throws TException {
-        if (message != lastMessage) {
-            lastBuffer = serializer.serialize(message);
-            this.lastMessage = message;
-        }
-        return lastBuffer;
-    }
-
-    @Override
-    public int getEncodedSize(OUT message) {
-        try {
-            return prepareBuffer(message).length;
-        } catch (TException e) {
-            return 0;
-        }
-    }
-
-    @Override
-    public void writeTo(OUT message, ByteBuffer buffer) {
-        try {
-            buffer.put(prepareBuffer(message));
-        } catch (TException e) {
-            //
-        }
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/test/java/org/apache/mina/codec/delimited/ThriftTest.java
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/test/java/org/apache/mina/codec/delimited/ThriftTest.java b/serialization/thrift/src/test/java/org/apache/mina/codec/delimited/ThriftTest.java
deleted file mode 100644
index f4ea116..0000000
--- a/serialization/thrift/src/test/java/org/apache/mina/codec/delimited/ThriftTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.apache.mina.codec.delimited;
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-
-
-import java.nio.ByteBuffer;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.mina.generated.thrift.UserProfile;
-import org.apache.thrift.TSerializer;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TMemoryBuffer;
-
-
-/**
- * A {@link ThriftEncoder} and {@link ThriftDecoder} test.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ThriftTest extends DelimitTest<UserProfile> {
-
-	@Override
-    public List<UserProfile> getObjects() {
-
-		List<UserProfile> list = new LinkedList<UserProfile>();
-
-		list.add(new UserProfile().setUid(1).setName("Jean Dupond"));
-		list.add(new UserProfile().setUid(2).setName("Marie Blanc"));
-
-		return list;
-	}
-
-	@Override
-    protected ByteBuffer delimitWithOriginal() throws Exception {
-
-		TMemoryBuffer m = new TMemoryBuffer(1000000);
-		TFramedTransport t = new TFramedTransport(m);
-		TSerializer tt = new TSerializer();
-		for (UserProfile up : getObjects()) {
-			t.write(tt.serialize(up));
-			t.flush();
-		}
-		return ByteBuffer.wrap(m.getArray(), 0, m.length());
-
-	}
-
-	@Override
-    public SizePrefixedEncoder<UserProfile> getSerializer()
-			throws SecurityException, NoSuchMethodException {
-		return ThriftEncoder.newInstance(UserProfile.class);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/test/java/org/apache/mina/codec/delimited/serialization/ThriftTest.java
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/test/java/org/apache/mina/codec/delimited/serialization/ThriftTest.java b/serialization/thrift/src/test/java/org/apache/mina/codec/delimited/serialization/ThriftTest.java
deleted file mode 100644
index 6e7cf0b..0000000
--- a/serialization/thrift/src/test/java/org/apache/mina/codec/delimited/serialization/ThriftTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited.serialization;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.mina.codec.delimited.ByteBufferDecoder;
-import org.apache.mina.codec.delimited.ByteBufferEncoder;
-import org.apache.mina.generated.thrift.UserProfile;
-import org.junit.Test;
-
-/**
- * A {@link ThriftMessageEncoder} and {@link ThriftMessageDecoder} test.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ThriftTest extends GenericSerializerTest<UserProfile> {
-
-    @Override
-    public List<UserProfile> getObjects() {
-        List<UserProfile> list = new LinkedList<UserProfile>();
-
-        list.add(new UserProfile().setUid(1).setName("Jean Dupond"));
-        list.add(new UserProfile().setUid(2).setName("Marie Blanc"));
-
-        return list;
-    }
-
-    @Override
-    public ByteBufferDecoder<UserProfile> getDecoder() throws Exception {
-        return ThriftMessageDecoder.newInstance(UserProfile.class);
-    }
-
-    @Override
-    public ByteBufferEncoder<UserProfile> getEncoder() throws Exception {
-        return ThriftMessageEncoder.newInstance(UserProfile.class);
-    }
-
-    @Test
-    public void testDynamic() throws Exception {
-        ByteBufferEncoder<UserProfile> encoder = getEncoder();
-        ThriftDynamicMessageDecoder decoder = new ThriftDynamicMessageDecoder();
-
-        for (UserProfile object : getObjects()) {
-            ThriftDynamicMessageDecoder.ThriftSerializedMessage message = decoder.decode(encoder.encode(object));
-            assertEquals(object, message.get(UserProfile.class));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java b/serialization/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java
deleted file mode 100644
index dc702a1..0000000
--- a/serialization/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java
+++ /dev/null
@@ -1,602 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.mina.generated.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserProfile implements org.apache.thrift.TBase<UserProfile, UserProfile._Fields>, java.io.Serializable, Cloneable {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserProfile");
-
-  private static final org.apache.thrift.protocol.TField UID_FIELD_DESC = new org.apache.thrift.protocol.TField("uid", org.apache.thrift.protocol.TType.I32, (short)1);
-  private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)2);
-  private static final org.apache.thrift.protocol.TField BLURB_FIELD_DESC = new org.apache.thrift.protocol.TField("blurb", org.apache.thrift.protocol.TType.STRING, (short)3);
-
-  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-  static {
-    schemes.put(StandardScheme.class, new UserProfileStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new UserProfileTupleSchemeFactory());
-  }
-
-  public int uid; // required
-  public String name; // required
-  public String blurb; // required
-
-  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-    UID((short)1, "uid"),
-    NAME((short)2, "name"),
-    BLURB((short)3, "blurb");
-
-    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-    static {
-      for (_Fields field : EnumSet.allOf(_Fields.class)) {
-        byName.put(field.getFieldName(), field);
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, or null if its not found.
-     */
-    public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // UID
-          return UID;
-        case 2: // NAME
-          return NAME;
-        case 3: // BLURB
-          return BLURB;
-        default:
-          return null;
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, throwing an exception
-     * if it is not found.
-     */
-    public static _Fields findByThriftIdOrThrow(int fieldId) {
-      _Fields fields = findByThriftId(fieldId);
-      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-      return fields;
-    }
-
-    /**
-     * Find the _Fields constant that matches name, or null if its not found.
-     */
-    public static _Fields findByName(String name) {
-      return byName.get(name);
-    }
-
-    private final short _thriftId;
-    private final String _fieldName;
-
-    _Fields(short thriftId, String fieldName) {
-      _thriftId = thriftId;
-      _fieldName = fieldName;
-    }
-
-    public short getThriftFieldId() {
-      return _thriftId;
-    }
-
-    public String getFieldName() {
-      return _fieldName;
-    }
-  }
-
-  // isset id assignments
-  private static final int __UID_ISSET_ID = 0;
-  private byte __isset_bitfield = 0;
-  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.UID, new org.apache.thrift.meta_data.FieldMetaData("uid", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
-    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.BLURB, new org.apache.thrift.meta_data.FieldMetaData("blurb", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
-    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserProfile.class, metaDataMap);
-  }
-
-  public UserProfile() {
-  }
-
-  public UserProfile(
-    int uid,
-    String name,
-    String blurb)
-  {
-    this();
-    this.uid = uid;
-    setUidIsSet(true);
-    this.name = name;
-    this.blurb = blurb;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public UserProfile(UserProfile other) {
-    __isset_bitfield = other.__isset_bitfield;
-    this.uid = other.uid;
-    if (other.isSetName()) {
-      this.name = other.name;
-    }
-    if (other.isSetBlurb()) {
-      this.blurb = other.blurb;
-    }
-  }
-
-  public UserProfile deepCopy() {
-    return new UserProfile(this);
-  }
-
-  @Override
-  public void clear() {
-    setUidIsSet(false);
-    this.uid = 0;
-    this.name = null;
-    this.blurb = null;
-  }
-
-  public int getUid() {
-    return this.uid;
-  }
-
-  public UserProfile setUid(int uid) {
-    this.uid = uid;
-    setUidIsSet(true);
-    return this;
-  }
-
-  public void unsetUid() {
-    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __UID_ISSET_ID);
-  }
-
-  /** Returns true if field uid is set (has been assigned a value) and false otherwise */
-  public boolean isSetUid() {
-    return EncodingUtils.testBit(__isset_bitfield, __UID_ISSET_ID);
-  }
-
-  public void setUidIsSet(boolean value) {
-    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UID_ISSET_ID, value);
-  }
-
-  public String getName() {
-    return this.name;
-  }
-
-  public UserProfile setName(String name) {
-    this.name = name;
-    return this;
-  }
-
-  public void unsetName() {
-    this.name = null;
-  }
-
-  /** Returns true if field name is set (has been assigned a value) and false otherwise */
-  public boolean isSetName() {
-    return this.name != null;
-  }
-
-  public void setNameIsSet(boolean value) {
-    if (!value) {
-      this.name = null;
-    }
-  }
-
-  public String getBlurb() {
-    return this.blurb;
-  }
-
-  public UserProfile setBlurb(String blurb) {
-    this.blurb = blurb;
-    return this;
-  }
-
-  public void unsetBlurb() {
-    this.blurb = null;
-  }
-
-  /** Returns true if field blurb is set (has been assigned a value) and false otherwise */
-  public boolean isSetBlurb() {
-    return this.blurb != null;
-  }
-
-  public void setBlurbIsSet(boolean value) {
-    if (!value) {
-      this.blurb = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case UID:
-      if (value == null) {
-        unsetUid();
-      } else {
-        setUid((Integer)value);
-      }
-      break;
-
-    case NAME:
-      if (value == null) {
-        unsetName();
-      } else {
-        setName((String)value);
-      }
-      break;
-
-    case BLURB:
-      if (value == null) {
-        unsetBlurb();
-      } else {
-        setBlurb((String)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case UID:
-      return Integer.valueOf(getUid());
-
-    case NAME:
-      return getName();
-
-    case BLURB:
-      return getBlurb();
-
-    }
-    throw new IllegalStateException();
-  }
-
-  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
-    switch (field) {
-    case UID:
-      return isSetUid();
-    case NAME:
-      return isSetName();
-    case BLURB:
-      return isSetBlurb();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof UserProfile)
-      return this.equals((UserProfile)that);
-    return false;
-  }
-
-  public boolean equals(UserProfile that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_uid = true;
-    boolean that_present_uid = true;
-    if (this_present_uid || that_present_uid) {
-      if (!(this_present_uid && that_present_uid))
-        return false;
-      if (this.uid != that.uid)
-        return false;
-    }
-
-    boolean this_present_name = true && this.isSetName();
-    boolean that_present_name = true && that.isSetName();
-    if (this_present_name || that_present_name) {
-      if (!(this_present_name && that_present_name))
-        return false;
-      if (!this.name.equals(that.name))
-        return false;
-    }
-
-    boolean this_present_blurb = true && this.isSetBlurb();
-    boolean that_present_blurb = true && that.isSetBlurb();
-    if (this_present_blurb || that_present_blurb) {
-      if (!(this_present_blurb && that_present_blurb))
-        return false;
-      if (!this.blurb.equals(that.blurb))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    HashCodeBuilder builder = new HashCodeBuilder();
-
-    boolean present_uid = true;
-    builder.append(present_uid);
-    if (present_uid)
-      builder.append(uid);
-
-    boolean present_name = true && (isSetName());
-    builder.append(present_name);
-    if (present_name)
-      builder.append(name);
-
-    boolean present_blurb = true && (isSetBlurb());
-    builder.append(present_blurb);
-    if (present_blurb)
-      builder.append(blurb);
-
-    return builder.toHashCode();
-  }
-
-  public int compareTo(UserProfile other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-    UserProfile typedOther = (UserProfile)other;
-
-    lastComparison = Boolean.valueOf(isSetUid()).compareTo(typedOther.isSetUid());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetUid()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uid, typedOther.uid);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetName()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetBlurb()).compareTo(typedOther.isSetBlurb());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetBlurb()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.blurb, typedOther.blurb);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    return 0;
-  }
-
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
-  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-  }
-
-  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("UserProfile(");
-    boolean first = true;
-
-    sb.append("uid:");
-    sb.append(this.uid);
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("name:");
-    if (this.name == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.name);
-    }
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("blurb:");
-    if (this.blurb == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.blurb);
-    }
-    first = false;
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    // check for sub-struct validity
-  }
-
-  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-    try {
-      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-    try {
-      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
-      __isset_bitfield = 0;
-      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private static class UserProfileStandardSchemeFactory implements SchemeFactory {
-    public UserProfileStandardScheme getScheme() {
-      return new UserProfileStandardScheme();
-    }
-  }
-
-  private static class UserProfileStandardScheme extends StandardScheme<UserProfile> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, UserProfile struct) throws org.apache.thrift.TException {
-      org.apache.thrift.protocol.TField schemeField;
-      iprot.readStructBegin();
-      while (true)
-      {
-        schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-          break;
-        }
-        switch (schemeField.id) {
-          case 1: // UID
-            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
-              struct.uid = iprot.readI32();
-              struct.setUidIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 2: // NAME
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.name = iprot.readString();
-              struct.setNameIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 3: // BLURB
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.blurb = iprot.readString();
-              struct.setBlurbIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          default:
-            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-        }
-        iprot.readFieldEnd();
-      }
-      iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
-      struct.validate();
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot, UserProfile struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      oprot.writeFieldBegin(UID_FIELD_DESC);
-      oprot.writeI32(struct.uid);
-      oprot.writeFieldEnd();
-      if (struct.name != null) {
-        oprot.writeFieldBegin(NAME_FIELD_DESC);
-        oprot.writeString(struct.name);
-        oprot.writeFieldEnd();
-      }
-      if (struct.blurb != null) {
-        oprot.writeFieldBegin(BLURB_FIELD_DESC);
-        oprot.writeString(struct.blurb);
-        oprot.writeFieldEnd();
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class UserProfileTupleSchemeFactory implements SchemeFactory {
-    public UserProfileTupleScheme getScheme() {
-      return new UserProfileTupleScheme();
-    }
-  }
-
-  private static class UserProfileTupleScheme extends TupleScheme<UserProfile> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, UserProfile struct) throws org.apache.thrift.TException {
-      TTupleProtocol oprot = (TTupleProtocol) prot;
-      BitSet optionals = new BitSet();
-      if (struct.isSetUid()) {
-        optionals.set(0);
-      }
-      if (struct.isSetName()) {
-        optionals.set(1);
-      }
-      if (struct.isSetBlurb()) {
-        optionals.set(2);
-      }
-      oprot.writeBitSet(optionals, 3);
-      if (struct.isSetUid()) {
-        oprot.writeI32(struct.uid);
-      }
-      if (struct.isSetName()) {
-        oprot.writeString(struct.name);
-      }
-      if (struct.isSetBlurb()) {
-        oprot.writeString(struct.blurb);
-      }
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, UserProfile struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      BitSet incoming = iprot.readBitSet(3);
-      if (incoming.get(0)) {
-        struct.uid = iprot.readI32();
-        struct.setUidIsSet(true);
-      }
-      if (incoming.get(1)) {
-        struct.name = iprot.readString();
-        struct.setNameIsSet(true);
-      }
-      if (incoming.get(2)) {
-        struct.blurb = iprot.readString();
-        struct.setBlurbIsSet(true);
-      }
-    }
-  }
-
-}
-


[2/7] flatenned the hierarchy of serialization packages

Posted by jv...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java b/serialization/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java
deleted file mode 100644
index d51c1b9..0000000
--- a/serialization/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java
+++ /dev/null
@@ -1,1596 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.mina.generated.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserStorage {
-
-  public interface Iface {
-
-    public void store(UserProfile user) throws org.apache.thrift.TException;
-
-    public UserProfile retrieve(int uid) throws org.apache.thrift.TException;
-
-  }
-
-  public interface AsyncIface {
-
-    public void store(UserProfile user, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.store_call> resultHandler) throws org.apache.thrift.TException;
-
-    public void retrieve(int uid, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.retrieve_call> resultHandler) throws org.apache.thrift.TException;
-
-  }
-
-  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
-    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
-      public Factory() {}
-      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
-        return new Client(prot);
-      }
-      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
-        return new Client(iprot, oprot);
-      }
-    }
-
-    public Client(org.apache.thrift.protocol.TProtocol prot)
-    {
-      super(prot, prot);
-    }
-
-    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
-      super(iprot, oprot);
-    }
-
-    public void store(UserProfile user) throws org.apache.thrift.TException
-    {
-      send_store(user);
-      recv_store();
-    }
-
-    public void send_store(UserProfile user) throws org.apache.thrift.TException
-    {
-      store_args args = new store_args();
-      args.setUser(user);
-      sendBase("store", args);
-    }
-
-    public void recv_store() throws org.apache.thrift.TException
-    {
-      store_result result = new store_result();
-      receiveBase(result, "store");
-      return;
-    }
-
-    public UserProfile retrieve(int uid) throws org.apache.thrift.TException
-    {
-      send_retrieve(uid);
-      return recv_retrieve();
-    }
-
-    public void send_retrieve(int uid) throws org.apache.thrift.TException
-    {
-      retrieve_args args = new retrieve_args();
-      args.setUid(uid);
-      sendBase("retrieve", args);
-    }
-
-    public UserProfile recv_retrieve() throws org.apache.thrift.TException
-    {
-      retrieve_result result = new retrieve_result();
-      receiveBase(result, "retrieve");
-      if (result.isSetSuccess()) {
-        return result.success;
-      }
-      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "retrieve failed: unknown result");
-    }
-
-  }
-  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
-    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
-      private org.apache.thrift.async.TAsyncClientManager clientManager;
-      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
-      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
-        this.clientManager = clientManager;
-        this.protocolFactory = protocolFactory;
-      }
-      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
-        return new AsyncClient(protocolFactory, clientManager, transport);
-      }
-    }
-
-    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
-      super(protocolFactory, clientManager, transport);
-    }
-
-    public void store(UserProfile user, org.apache.thrift.async.AsyncMethodCallback<store_call> resultHandler) throws org.apache.thrift.TException {
-      checkReady();
-      store_call method_call = new store_call(user, resultHandler, this, ___protocolFactory, ___transport);
-      this.___currentMethod = method_call;
-      ___manager.call(method_call);
-    }
-
-    public static class store_call extends org.apache.thrift.async.TAsyncMethodCall {
-      private UserProfile user;
-      public store_call(UserProfile user, org.apache.thrift.async.AsyncMethodCallback<store_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
-        super(client, protocolFactory, transport, resultHandler, false);
-        this.user = user;
-      }
-
-      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("store", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        store_args args = new store_args();
-        args.setUser(user);
-        args.write(prot);
-        prot.writeMessageEnd();
-      }
-
-      public void getResult() throws org.apache.thrift.TException {
-        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
-          throw new IllegalStateException("Method call not finished!");
-        }
-        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
-        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        (new Client(prot)).recv_store();
-      }
-    }
-
-    public void retrieve(int uid, org.apache.thrift.async.AsyncMethodCallback<retrieve_call> resultHandler) throws org.apache.thrift.TException {
-      checkReady();
-      retrieve_call method_call = new retrieve_call(uid, resultHandler, this, ___protocolFactory, ___transport);
-      this.___currentMethod = method_call;
-      ___manager.call(method_call);
-    }
-
-    public static class retrieve_call extends org.apache.thrift.async.TAsyncMethodCall {
-      private int uid;
-      public retrieve_call(int uid, org.apache.thrift.async.AsyncMethodCallback<retrieve_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
-        super(client, protocolFactory, transport, resultHandler, false);
-        this.uid = uid;
-      }
-
-      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("retrieve", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        retrieve_args args = new retrieve_args();
-        args.setUid(uid);
-        args.write(prot);
-        prot.writeMessageEnd();
-      }
-
-      public UserProfile getResult() throws org.apache.thrift.TException {
-        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
-          throw new IllegalStateException("Method call not finished!");
-        }
-        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
-        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        return (new Client(prot)).recv_retrieve();
-      }
-    }
-
-  }
-
-  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
-    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
-    public Processor(I iface) {
-      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
-    }
-
-    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
-      super(iface, getProcessMap(processMap));
-    }
-
-    private static <I extends Iface> Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> getProcessMap(Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
-      processMap.put("store", new store());
-      processMap.put("retrieve", new retrieve());
-      return processMap;
-    }
-
-    public static class store<I extends Iface> extends org.apache.thrift.ProcessFunction<I, store_args> {
-      public store() {
-        super("store");
-      }
-
-      public store_args getEmptyArgsInstance() {
-        return new store_args();
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public store_result getResult(I iface, store_args args) throws org.apache.thrift.TException {
-        store_result result = new store_result();
-        iface.store(args.user);
-        return result;
-      }
-    }
-
-    public static class retrieve<I extends Iface> extends org.apache.thrift.ProcessFunction<I, retrieve_args> {
-      public retrieve() {
-        super("retrieve");
-      }
-
-      public retrieve_args getEmptyArgsInstance() {
-        return new retrieve_args();
-      }
-
-      protected boolean isOneway() {
-        return false;
-      }
-
-      public retrieve_result getResult(I iface, retrieve_args args) throws org.apache.thrift.TException {
-        retrieve_result result = new retrieve_result();
-        result.success = iface.retrieve(args.uid);
-        return result;
-      }
-    }
-
-  }
-
-  public static class store_args implements org.apache.thrift.TBase<store_args, store_args._Fields>, java.io.Serializable, Cloneable   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("store_args");
-
-    private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
-    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-    static {
-      schemes.put(StandardScheme.class, new store_argsStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new store_argsTupleSchemeFactory());
-    }
-
-    public UserProfile user; // required
-
-    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-      USER((short)1, "user");
-
-      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-      static {
-        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-          byName.put(field.getFieldName(), field);
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, or null if its not found.
-       */
-      public static _Fields findByThriftId(int fieldId) {
-        switch(fieldId) {
-          case 1: // USER
-            return USER;
-          default:
-            return null;
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, throwing an exception
-       * if it is not found.
-       */
-      public static _Fields findByThriftIdOrThrow(int fieldId) {
-        _Fields fields = findByThriftId(fieldId);
-        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-        return fields;
-      }
-
-      /**
-       * Find the _Fields constant that matches name, or null if its not found.
-       */
-      public static _Fields findByName(String name) {
-        return byName.get(name);
-      }
-
-      private final short _thriftId;
-      private final String _fieldName;
-
-      _Fields(short thriftId, String fieldName) {
-        _thriftId = thriftId;
-        _fieldName = fieldName;
-      }
-
-      public short getThriftFieldId() {
-        return _thriftId;
-      }
-
-      public String getFieldName() {
-        return _fieldName;
-      }
-    }
-
-    // isset id assignments
-    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-    static {
-      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-      tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserProfile.class)));
-      metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(store_args.class, metaDataMap);
-    }
-
-    public store_args() {
-    }
-
-    public store_args(
-      UserProfile user)
-    {
-      this();
-      this.user = user;
-    }
-
-    /**
-     * Performs a deep copy on <i>other</i>.
-     */
-    public store_args(store_args other) {
-      if (other.isSetUser()) {
-        this.user = new UserProfile(other.user);
-      }
-    }
-
-    public store_args deepCopy() {
-      return new store_args(this);
-    }
-
-    @Override
-    public void clear() {
-      this.user = null;
-    }
-
-    public UserProfile getUser() {
-      return this.user;
-    }
-
-    public store_args setUser(UserProfile user) {
-      this.user = user;
-      return this;
-    }
-
-    public void unsetUser() {
-      this.user = null;
-    }
-
-    /** Returns true if field user is set (has been assigned a value) and false otherwise */
-    public boolean isSetUser() {
-      return this.user != null;
-    }
-
-    public void setUserIsSet(boolean value) {
-      if (!value) {
-        this.user = null;
-      }
-    }
-
-    public void setFieldValue(_Fields field, Object value) {
-      switch (field) {
-      case USER:
-        if (value == null) {
-          unsetUser();
-        } else {
-          setUser((UserProfile)value);
-        }
-        break;
-
-      }
-    }
-
-    public Object getFieldValue(_Fields field) {
-      switch (field) {
-      case USER:
-        return getUser();
-
-      }
-      throw new IllegalStateException();
-    }
-
-    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-    public boolean isSet(_Fields field) {
-      if (field == null) {
-        throw new IllegalArgumentException();
-      }
-
-      switch (field) {
-      case USER:
-        return isSetUser();
-      }
-      throw new IllegalStateException();
-    }
-
-    @Override
-    public boolean equals(Object that) {
-      if (that == null)
-        return false;
-      if (that instanceof store_args)
-        return this.equals((store_args)that);
-      return false;
-    }
-
-    public boolean equals(store_args that) {
-      if (that == null)
-        return false;
-
-      boolean this_present_user = true && this.isSetUser();
-      boolean that_present_user = true && that.isSetUser();
-      if (this_present_user || that_present_user) {
-        if (!(this_present_user && that_present_user))
-          return false;
-        if (!this.user.equals(that.user))
-          return false;
-      }
-
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      HashCodeBuilder builder = new HashCodeBuilder();
-
-      boolean present_user = true && (isSetUser());
-      builder.append(present_user);
-      if (present_user)
-        builder.append(user);
-
-      return builder.toHashCode();
-    }
-
-    public int compareTo(store_args other) {
-      if (!getClass().equals(other.getClass())) {
-        return getClass().getName().compareTo(other.getClass().getName());
-      }
-
-      int lastComparison = 0;
-      store_args typedOther = (store_args)other;
-
-      lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser());
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-      if (isSetUser()) {
-        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user);
-        if (lastComparison != 0) {
-          return lastComparison;
-        }
-      }
-      return 0;
-    }
-
-    public _Fields fieldForId(int fieldId) {
-      return _Fields.findByThriftId(fieldId);
-    }
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-    }
-
-    @Override
-    public String toString() {
-      StringBuilder sb = new StringBuilder("store_args(");
-      boolean first = true;
-
-      sb.append("user:");
-      if (this.user == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.user);
-      }
-      first = false;
-      sb.append(")");
-      return sb.toString();
-    }
-
-    public void validate() throws org.apache.thrift.TException {
-      // check for required fields
-      // check for sub-struct validity
-      if (user != null) {
-        user.validate();
-      }
-    }
-
-    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-      try {
-        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-      try {
-        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private static class store_argsStandardSchemeFactory implements SchemeFactory {
-      public store_argsStandardScheme getScheme() {
-        return new store_argsStandardScheme();
-      }
-    }
-
-    private static class store_argsStandardScheme extends StandardScheme<store_args> {
-
-      public void read(org.apache.thrift.protocol.TProtocol iprot, store_args struct) throws org.apache.thrift.TException {
-        org.apache.thrift.protocol.TField schemeField;
-        iprot.readStructBegin();
-        while (true)
-        {
-          schemeField = iprot.readFieldBegin();
-          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-            break;
-          }
-          switch (schemeField.id) {
-            case 1: // USER
-              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
-                struct.user = new UserProfile();
-                struct.user.read(iprot);
-                struct.setUserIsSet(true);
-              } else { 
-                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-              }
-              break;
-            default:
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-          }
-          iprot.readFieldEnd();
-        }
-        iprot.readStructEnd();
-
-        // check for required fields of primitive type, which can't be checked in the validate method
-        struct.validate();
-      }
-
-      public void write(org.apache.thrift.protocol.TProtocol oprot, store_args struct) throws org.apache.thrift.TException {
-        struct.validate();
-
-        oprot.writeStructBegin(STRUCT_DESC);
-        if (struct.user != null) {
-          oprot.writeFieldBegin(USER_FIELD_DESC);
-          struct.user.write(oprot);
-          oprot.writeFieldEnd();
-        }
-        oprot.writeFieldStop();
-        oprot.writeStructEnd();
-      }
-
-    }
-
-    private static class store_argsTupleSchemeFactory implements SchemeFactory {
-      public store_argsTupleScheme getScheme() {
-        return new store_argsTupleScheme();
-      }
-    }
-
-    private static class store_argsTupleScheme extends TupleScheme<store_args> {
-
-      @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, store_args struct) throws org.apache.thrift.TException {
-        TTupleProtocol oprot = (TTupleProtocol) prot;
-        BitSet optionals = new BitSet();
-        if (struct.isSetUser()) {
-          optionals.set(0);
-        }
-        oprot.writeBitSet(optionals, 1);
-        if (struct.isSetUser()) {
-          struct.user.write(oprot);
-        }
-      }
-
-      @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, store_args struct) throws org.apache.thrift.TException {
-        TTupleProtocol iprot = (TTupleProtocol) prot;
-        BitSet incoming = iprot.readBitSet(1);
-        if (incoming.get(0)) {
-          struct.user = new UserProfile();
-          struct.user.read(iprot);
-          struct.setUserIsSet(true);
-        }
-      }
-    }
-
-  }
-
-  public static class store_result implements org.apache.thrift.TBase<store_result, store_result._Fields>, java.io.Serializable, Cloneable   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("store_result");
-
-
-    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-    static {
-      schemes.put(StandardScheme.class, new store_resultStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new store_resultTupleSchemeFactory());
-    }
-
-
-    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-;
-
-      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-      static {
-        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-          byName.put(field.getFieldName(), field);
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, or null if its not found.
-       */
-      public static _Fields findByThriftId(int fieldId) {
-        switch(fieldId) {
-          default:
-            return null;
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, throwing an exception
-       * if it is not found.
-       */
-      public static _Fields findByThriftIdOrThrow(int fieldId) {
-        _Fields fields = findByThriftId(fieldId);
-        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-        return fields;
-      }
-
-      /**
-       * Find the _Fields constant that matches name, or null if its not found.
-       */
-      public static _Fields findByName(String name) {
-        return byName.get(name);
-      }
-
-      private final short _thriftId;
-      private final String _fieldName;
-
-      _Fields(short thriftId, String fieldName) {
-        _thriftId = thriftId;
-        _fieldName = fieldName;
-      }
-
-      public short getThriftFieldId() {
-        return _thriftId;
-      }
-
-      public String getFieldName() {
-        return _fieldName;
-      }
-    }
-    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-    static {
-      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-      metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(store_result.class, metaDataMap);
-    }
-
-    public store_result() {
-    }
-
-    /**
-     * Performs a deep copy on <i>other</i>.
-     */
-    public store_result(store_result other) {
-    }
-
-    public store_result deepCopy() {
-      return new store_result(this);
-    }
-
-    @Override
-    public void clear() {
-    }
-
-    public void setFieldValue(_Fields field, Object value) {
-      switch (field) {
-      }
-    }
-
-    public Object getFieldValue(_Fields field) {
-      switch (field) {
-      }
-      throw new IllegalStateException();
-    }
-
-    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-    public boolean isSet(_Fields field) {
-      if (field == null) {
-        throw new IllegalArgumentException();
-      }
-
-      switch (field) {
-      }
-      throw new IllegalStateException();
-    }
-
-    @Override
-    public boolean equals(Object that) {
-      if (that == null)
-        return false;
-      if (that instanceof store_result)
-        return this.equals((store_result)that);
-      return false;
-    }
-
-    public boolean equals(store_result that) {
-      if (that == null)
-        return false;
-
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      HashCodeBuilder builder = new HashCodeBuilder();
-
-      return builder.toHashCode();
-    }
-
-    public int compareTo(store_result other) {
-      if (!getClass().equals(other.getClass())) {
-        return getClass().getName().compareTo(other.getClass().getName());
-      }
-
-      int lastComparison = 0;
-      store_result typedOther = (store_result)other;
-
-      return 0;
-    }
-
-    public _Fields fieldForId(int fieldId) {
-      return _Fields.findByThriftId(fieldId);
-    }
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-      }
-
-    @Override
-    public String toString() {
-      StringBuilder sb = new StringBuilder("store_result(");
-      boolean first = true;
-
-      sb.append(")");
-      return sb.toString();
-    }
-
-    public void validate() throws org.apache.thrift.TException {
-      // check for required fields
-      // check for sub-struct validity
-    }
-
-    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-      try {
-        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-      try {
-        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private static class store_resultStandardSchemeFactory implements SchemeFactory {
-      public store_resultStandardScheme getScheme() {
-        return new store_resultStandardScheme();
-      }
-    }
-
-    private static class store_resultStandardScheme extends StandardScheme<store_result> {
-
-      public void read(org.apache.thrift.protocol.TProtocol iprot, store_result struct) throws org.apache.thrift.TException {
-        org.apache.thrift.protocol.TField schemeField;
-        iprot.readStructBegin();
-        while (true)
-        {
-          schemeField = iprot.readFieldBegin();
-          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-            break;
-          }
-          switch (schemeField.id) {
-            default:
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-          }
-          iprot.readFieldEnd();
-        }
-        iprot.readStructEnd();
-
-        // check for required fields of primitive type, which can't be checked in the validate method
-        struct.validate();
-      }
-
-      public void write(org.apache.thrift.protocol.TProtocol oprot, store_result struct) throws org.apache.thrift.TException {
-        struct.validate();
-
-        oprot.writeStructBegin(STRUCT_DESC);
-        oprot.writeFieldStop();
-        oprot.writeStructEnd();
-      }
-
-    }
-
-    private static class store_resultTupleSchemeFactory implements SchemeFactory {
-      public store_resultTupleScheme getScheme() {
-        return new store_resultTupleScheme();
-      }
-    }
-
-    private static class store_resultTupleScheme extends TupleScheme<store_result> {
-
-      @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, store_result struct) throws org.apache.thrift.TException {
-        TTupleProtocol oprot = (TTupleProtocol) prot;
-      }
-
-      @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, store_result struct) throws org.apache.thrift.TException {
-        TTupleProtocol iprot = (TTupleProtocol) prot;
-      }
-    }
-
-  }
-
-  public static class retrieve_args implements org.apache.thrift.TBase<retrieve_args, retrieve_args._Fields>, java.io.Serializable, Cloneable   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("retrieve_args");
-
-    private static final org.apache.thrift.protocol.TField UID_FIELD_DESC = new org.apache.thrift.protocol.TField("uid", org.apache.thrift.protocol.TType.I32, (short)1);
-
-    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-    static {
-      schemes.put(StandardScheme.class, new retrieve_argsStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new retrieve_argsTupleSchemeFactory());
-    }
-
-    public int uid; // required
-
-    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-      UID((short)1, "uid");
-
-      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-      static {
-        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-          byName.put(field.getFieldName(), field);
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, or null if its not found.
-       */
-      public static _Fields findByThriftId(int fieldId) {
-        switch(fieldId) {
-          case 1: // UID
-            return UID;
-          default:
-            return null;
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, throwing an exception
-       * if it is not found.
-       */
-      public static _Fields findByThriftIdOrThrow(int fieldId) {
-        _Fields fields = findByThriftId(fieldId);
-        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-        return fields;
-      }
-
-      /**
-       * Find the _Fields constant that matches name, or null if its not found.
-       */
-      public static _Fields findByName(String name) {
-        return byName.get(name);
-      }
-
-      private final short _thriftId;
-      private final String _fieldName;
-
-      _Fields(short thriftId, String fieldName) {
-        _thriftId = thriftId;
-        _fieldName = fieldName;
-      }
-
-      public short getThriftFieldId() {
-        return _thriftId;
-      }
-
-      public String getFieldName() {
-        return _fieldName;
-      }
-    }
-
-    // isset id assignments
-    private static final int __UID_ISSET_ID = 0;
-    private byte __isset_bitfield = 0;
-    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-    static {
-      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-      tmpMap.put(_Fields.UID, new org.apache.thrift.meta_data.FieldMetaData("uid", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
-      metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(retrieve_args.class, metaDataMap);
-    }
-
-    public retrieve_args() {
-    }
-
-    public retrieve_args(
-      int uid)
-    {
-      this();
-      this.uid = uid;
-      setUidIsSet(true);
-    }
-
-    /**
-     * Performs a deep copy on <i>other</i>.
-     */
-    public retrieve_args(retrieve_args other) {
-      __isset_bitfield = other.__isset_bitfield;
-      this.uid = other.uid;
-    }
-
-    public retrieve_args deepCopy() {
-      return new retrieve_args(this);
-    }
-
-    @Override
-    public void clear() {
-      setUidIsSet(false);
-      this.uid = 0;
-    }
-
-    public int getUid() {
-      return this.uid;
-    }
-
-    public retrieve_args setUid(int uid) {
-      this.uid = uid;
-      setUidIsSet(true);
-      return this;
-    }
-
-    public void unsetUid() {
-      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __UID_ISSET_ID);
-    }
-
-    /** Returns true if field uid is set (has been assigned a value) and false otherwise */
-    public boolean isSetUid() {
-      return EncodingUtils.testBit(__isset_bitfield, __UID_ISSET_ID);
-    }
-
-    public void setUidIsSet(boolean value) {
-      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UID_ISSET_ID, value);
-    }
-
-    public void setFieldValue(_Fields field, Object value) {
-      switch (field) {
-      case UID:
-        if (value == null) {
-          unsetUid();
-        } else {
-          setUid((Integer)value);
-        }
-        break;
-
-      }
-    }
-
-    public Object getFieldValue(_Fields field) {
-      switch (field) {
-      case UID:
-        return Integer.valueOf(getUid());
-
-      }
-      throw new IllegalStateException();
-    }
-
-    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-    public boolean isSet(_Fields field) {
-      if (field == null) {
-        throw new IllegalArgumentException();
-      }
-
-      switch (field) {
-      case UID:
-        return isSetUid();
-      }
-      throw new IllegalStateException();
-    }
-
-    @Override
-    public boolean equals(Object that) {
-      if (that == null)
-        return false;
-      if (that instanceof retrieve_args)
-        return this.equals((retrieve_args)that);
-      return false;
-    }
-
-    public boolean equals(retrieve_args that) {
-      if (that == null)
-        return false;
-
-      boolean this_present_uid = true;
-      boolean that_present_uid = true;
-      if (this_present_uid || that_present_uid) {
-        if (!(this_present_uid && that_present_uid))
-          return false;
-        if (this.uid != that.uid)
-          return false;
-      }
-
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      HashCodeBuilder builder = new HashCodeBuilder();
-
-      boolean present_uid = true;
-      builder.append(present_uid);
-      if (present_uid)
-        builder.append(uid);
-
-      return builder.toHashCode();
-    }
-
-    public int compareTo(retrieve_args other) {
-      if (!getClass().equals(other.getClass())) {
-        return getClass().getName().compareTo(other.getClass().getName());
-      }
-
-      int lastComparison = 0;
-      retrieve_args typedOther = (retrieve_args)other;
-
-      lastComparison = Boolean.valueOf(isSetUid()).compareTo(typedOther.isSetUid());
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-      if (isSetUid()) {
-        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uid, typedOther.uid);
-        if (lastComparison != 0) {
-          return lastComparison;
-        }
-      }
-      return 0;
-    }
-
-    public _Fields fieldForId(int fieldId) {
-      return _Fields.findByThriftId(fieldId);
-    }
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-    }
-
-    @Override
-    public String toString() {
-      StringBuilder sb = new StringBuilder("retrieve_args(");
-      boolean first = true;
-
-      sb.append("uid:");
-      sb.append(this.uid);
-      first = false;
-      sb.append(")");
-      return sb.toString();
-    }
-
-    public void validate() throws org.apache.thrift.TException {
-      // check for required fields
-      // check for sub-struct validity
-    }
-
-    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-      try {
-        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-      try {
-        // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
-        __isset_bitfield = 0;
-        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private static class retrieve_argsStandardSchemeFactory implements SchemeFactory {
-      public retrieve_argsStandardScheme getScheme() {
-        return new retrieve_argsStandardScheme();
-      }
-    }
-
-    private static class retrieve_argsStandardScheme extends StandardScheme<retrieve_args> {
-
-      public void read(org.apache.thrift.protocol.TProtocol iprot, retrieve_args struct) throws org.apache.thrift.TException {
-        org.apache.thrift.protocol.TField schemeField;
-        iprot.readStructBegin();
-        while (true)
-        {
-          schemeField = iprot.readFieldBegin();
-          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-            break;
-          }
-          switch (schemeField.id) {
-            case 1: // UID
-              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
-                struct.uid = iprot.readI32();
-                struct.setUidIsSet(true);
-              } else { 
-                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-              }
-              break;
-            default:
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-          }
-          iprot.readFieldEnd();
-        }
-        iprot.readStructEnd();
-
-        // check for required fields of primitive type, which can't be checked in the validate method
-        struct.validate();
-      }
-
-      public void write(org.apache.thrift.protocol.TProtocol oprot, retrieve_args struct) throws org.apache.thrift.TException {
-        struct.validate();
-
-        oprot.writeStructBegin(STRUCT_DESC);
-        oprot.writeFieldBegin(UID_FIELD_DESC);
-        oprot.writeI32(struct.uid);
-        oprot.writeFieldEnd();
-        oprot.writeFieldStop();
-        oprot.writeStructEnd();
-      }
-
-    }
-
-    private static class retrieve_argsTupleSchemeFactory implements SchemeFactory {
-      public retrieve_argsTupleScheme getScheme() {
-        return new retrieve_argsTupleScheme();
-      }
-    }
-
-    private static class retrieve_argsTupleScheme extends TupleScheme<retrieve_args> {
-
-      @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, retrieve_args struct) throws org.apache.thrift.TException {
-        TTupleProtocol oprot = (TTupleProtocol) prot;
-        BitSet optionals = new BitSet();
-        if (struct.isSetUid()) {
-          optionals.set(0);
-        }
-        oprot.writeBitSet(optionals, 1);
-        if (struct.isSetUid()) {
-          oprot.writeI32(struct.uid);
-        }
-      }
-
-      @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, retrieve_args struct) throws org.apache.thrift.TException {
-        TTupleProtocol iprot = (TTupleProtocol) prot;
-        BitSet incoming = iprot.readBitSet(1);
-        if (incoming.get(0)) {
-          struct.uid = iprot.readI32();
-          struct.setUidIsSet(true);
-        }
-      }
-    }
-
-  }
-
-  public static class retrieve_result implements org.apache.thrift.TBase<retrieve_result, retrieve_result._Fields>, java.io.Serializable, Cloneable   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("retrieve_result");
-
-    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
-
-    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-    static {
-      schemes.put(StandardScheme.class, new retrieve_resultStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new retrieve_resultTupleSchemeFactory());
-    }
-
-    public UserProfile success; // required
-
-    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-      SUCCESS((short)0, "success");
-
-      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-      static {
-        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-          byName.put(field.getFieldName(), field);
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, or null if its not found.
-       */
-      public static _Fields findByThriftId(int fieldId) {
-        switch(fieldId) {
-          case 0: // SUCCESS
-            return SUCCESS;
-          default:
-            return null;
-        }
-      }
-
-      /**
-       * Find the _Fields constant that matches fieldId, throwing an exception
-       * if it is not found.
-       */
-      public static _Fields findByThriftIdOrThrow(int fieldId) {
-        _Fields fields = findByThriftId(fieldId);
-        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-        return fields;
-      }
-
-      /**
-       * Find the _Fields constant that matches name, or null if its not found.
-       */
-      public static _Fields findByName(String name) {
-        return byName.get(name);
-      }
-
-      private final short _thriftId;
-      private final String _fieldName;
-
-      _Fields(short thriftId, String fieldName) {
-        _thriftId = thriftId;
-        _fieldName = fieldName;
-      }
-
-      public short getThriftFieldId() {
-        return _thriftId;
-      }
-
-      public String getFieldName() {
-        return _fieldName;
-      }
-    }
-
-    // isset id assignments
-    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-    static {
-      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserProfile.class)));
-      metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(retrieve_result.class, metaDataMap);
-    }
-
-    public retrieve_result() {
-    }
-
-    public retrieve_result(
-      UserProfile success)
-    {
-      this();
-      this.success = success;
-    }
-
-    /**
-     * Performs a deep copy on <i>other</i>.
-     */
-    public retrieve_result(retrieve_result other) {
-      if (other.isSetSuccess()) {
-        this.success = new UserProfile(other.success);
-      }
-    }
-
-    public retrieve_result deepCopy() {
-      return new retrieve_result(this);
-    }
-
-    @Override
-    public void clear() {
-      this.success = null;
-    }
-
-    public UserProfile getSuccess() {
-      return this.success;
-    }
-
-    public retrieve_result setSuccess(UserProfile success) {
-      this.success = success;
-      return this;
-    }
-
-    public void unsetSuccess() {
-      this.success = null;
-    }
-
-    /** Returns true if field success is set (has been assigned a value) and false otherwise */
-    public boolean isSetSuccess() {
-      return this.success != null;
-    }
-
-    public void setSuccessIsSet(boolean value) {
-      if (!value) {
-        this.success = null;
-      }
-    }
-
-    public void setFieldValue(_Fields field, Object value) {
-      switch (field) {
-      case SUCCESS:
-        if (value == null) {
-          unsetSuccess();
-        } else {
-          setSuccess((UserProfile)value);
-        }
-        break;
-
-      }
-    }
-
-    public Object getFieldValue(_Fields field) {
-      switch (field) {
-      case SUCCESS:
-        return getSuccess();
-
-      }
-      throw new IllegalStateException();
-    }
-
-    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-    public boolean isSet(_Fields field) {
-      if (field == null) {
-        throw new IllegalArgumentException();
-      }
-
-      switch (field) {
-      case SUCCESS:
-        return isSetSuccess();
-      }
-      throw new IllegalStateException();
-    }
-
-    @Override
-    public boolean equals(Object that) {
-      if (that == null)
-        return false;
-      if (that instanceof retrieve_result)
-        return this.equals((retrieve_result)that);
-      return false;
-    }
-
-    public boolean equals(retrieve_result that) {
-      if (that == null)
-        return false;
-
-      boolean this_present_success = true && this.isSetSuccess();
-      boolean that_present_success = true && that.isSetSuccess();
-      if (this_present_success || that_present_success) {
-        if (!(this_present_success && that_present_success))
-          return false;
-        if (!this.success.equals(that.success))
-          return false;
-      }
-
-      return true;
-    }
-
-    @Override
-    public int hashCode() {
-      HashCodeBuilder builder = new HashCodeBuilder();
-
-      boolean present_success = true && (isSetSuccess());
-      builder.append(present_success);
-      if (present_success)
-        builder.append(success);
-
-      return builder.toHashCode();
-    }
-
-    public int compareTo(retrieve_result other) {
-      if (!getClass().equals(other.getClass())) {
-        return getClass().getName().compareTo(other.getClass().getName());
-      }
-
-      int lastComparison = 0;
-      retrieve_result typedOther = (retrieve_result)other;
-
-      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-      if (isSetSuccess()) {
-        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
-        if (lastComparison != 0) {
-          return lastComparison;
-        }
-      }
-      return 0;
-    }
-
-    public _Fields fieldForId(int fieldId) {
-      return _Fields.findByThriftId(fieldId);
-    }
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-      }
-
-    @Override
-    public String toString() {
-      StringBuilder sb = new StringBuilder("retrieve_result(");
-      boolean first = true;
-
-      sb.append("success:");
-      if (this.success == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.success);
-      }
-      first = false;
-      sb.append(")");
-      return sb.toString();
-    }
-
-    public void validate() throws org.apache.thrift.TException {
-      // check for required fields
-      // check for sub-struct validity
-      if (success != null) {
-        success.validate();
-      }
-    }
-
-    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-      try {
-        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-      try {
-        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-      } catch (org.apache.thrift.TException te) {
-        throw new java.io.IOException(te);
-      }
-    }
-
-    private static class retrieve_resultStandardSchemeFactory implements SchemeFactory {
-      public retrieve_resultStandardScheme getScheme() {
-        return new retrieve_resultStandardScheme();
-      }
-    }
-
-    private static class retrieve_resultStandardScheme extends StandardScheme<retrieve_result> {
-
-      public void read(org.apache.thrift.protocol.TProtocol iprot, retrieve_result struct) throws org.apache.thrift.TException {
-        org.apache.thrift.protocol.TField schemeField;
-        iprot.readStructBegin();
-        while (true)
-        {
-          schemeField = iprot.readFieldBegin();
-          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-            break;
-          }
-          switch (schemeField.id) {
-            case 0: // SUCCESS
-              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
-                struct.success = new UserProfile();
-                struct.success.read(iprot);
-                struct.setSuccessIsSet(true);
-              } else { 
-                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-              }
-              break;
-            default:
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-          }
-          iprot.readFieldEnd();
-        }
-        iprot.readStructEnd();
-
-        // check for required fields of primitive type, which can't be checked in the validate method
-        struct.validate();
-      }
-
-      public void write(org.apache.thrift.protocol.TProtocol oprot, retrieve_result struct) throws org.apache.thrift.TException {
-        struct.validate();
-
-        oprot.writeStructBegin(STRUCT_DESC);
-        if (struct.success != null) {
-          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
-          struct.success.write(oprot);
-          oprot.writeFieldEnd();
-        }
-        oprot.writeFieldStop();
-        oprot.writeStructEnd();
-      }
-
-    }
-
-    private static class retrieve_resultTupleSchemeFactory implements SchemeFactory {
-      public retrieve_resultTupleScheme getScheme() {
-        return new retrieve_resultTupleScheme();
-      }
-    }
-
-    private static class retrieve_resultTupleScheme extends TupleScheme<retrieve_result> {
-
-      @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, retrieve_result struct) throws org.apache.thrift.TException {
-        TTupleProtocol oprot = (TTupleProtocol) prot;
-        BitSet optionals = new BitSet();
-        if (struct.isSetSuccess()) {
-          optionals.set(0);
-        }
-        oprot.writeBitSet(optionals, 1);
-        if (struct.isSetSuccess()) {
-          struct.success.write(oprot);
-        }
-      }
-
-      @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, retrieve_result struct) throws org.apache.thrift.TException {
-        TTupleProtocol iprot = (TTupleProtocol) prot;
-        BitSet incoming = iprot.readBitSet(1);
-        if (incoming.get(0)) {
-          struct.success = new UserProfile();
-          struct.success.read(iprot);
-          struct.setSuccessIsSet(true);
-        }
-      }
-    }
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/thrift/src/test/thrift/user.thrift
----------------------------------------------------------------------
diff --git a/serialization/thrift/src/test/thrift/user.thrift b/serialization/thrift/src/test/thrift/user.thrift
deleted file mode 100644
index d3b86de..0000000
--- a/serialization/thrift/src/test/thrift/user.thrift
+++ /dev/null
@@ -1,29 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
- 
-namespace java org.apache.mina.generated.thrift
-
-struct UserProfile {
-  1: i32 uid,
-  2: string name,
-  3: string blurb
-}
-
-service UserStorage {
-  void store(1: UserProfile user),
-  UserProfile retrieve(1: i32 uid)
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/pom.xml
----------------------------------------------------------------------
diff --git a/thrift/pom.xml b/thrift/pom.xml
new file mode 100644
index 0000000..4e136dc
--- /dev/null
+++ b/thrift/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.mina</groupId>
+        <artifactId>mina-parent</artifactId>
+        <version>3.0.0-M1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>mina-thrift</artifactId>
+    <name>Apache MINA Serialization::Thrift ${project.version}</name>
+    <packaging>bundle</packaging>
+    
+    <properties>
+        <symbolicName>${project.groupId}.thrift</symbolicName>
+        <exportedPackage>${project.groupId}</exportedPackage>
+        <thrift.version>0.9.0</thrift.version>
+    </properties>
+
+    <dependencies>
+        
+        <dependency>
+            <groupId>org.apache.thrift</groupId>
+            <artifactId>libthrift</artifactId>
+            <version>${thrift.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.logging.log4j.adapters</groupId>
+            <artifactId>slf4j-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>mina-codec</artifactId>
+            <type>bundle</type>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>mina-codec</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+            <classifier>tests</classifier>
+        </dependency>
+    </dependencies>
+</project>
+

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/prepare.sh
----------------------------------------------------------------------
diff --git a/thrift/prepare.sh b/thrift/prepare.sh
new file mode 100644
index 0000000..8820aef
--- /dev/null
+++ b/thrift/prepare.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+if hash thrift 2>/dev/null; then
+	VERSION=`thrift --version`
+
+	if [[ $VERSION =~  version\ 0\.9\. ]];
+	then
+		thrift -I src/test/thrift -out src/test/java --gen java:hashcode src/test/thrift/user.thrift
+	else
+		echo "Need Thrift 0.9.x (found $VERSION)"
+	fi
+else
+	echo "No installation of Thrift found"
+fi

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java
----------------------------------------------------------------------
diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java
new file mode 100644
index 0000000..664753c
--- /dev/null
+++ b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited;
+
+import org.apache.mina.codec.delimited.ints.RawInt32;
+import org.apache.thrift.TBase;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ThriftDecoder<M extends TBase<?, ?>> extends SizePrefixedDecoder<M> {
+    static public <L extends TBase<?, ?>> ThriftDecoder<L> newInstance(Class<L> clazz) throws SecurityException,
+            NoSuchMethodException {
+        return new ThriftDecoder<L>(clazz);
+    }
+
+    public ThriftDecoder(Class<M> clazz) throws SecurityException, NoSuchMethodException {
+        super(new RawInt32.Decoder(RawInt32.Endianness.BIG), null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java
----------------------------------------------------------------------
diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java
new file mode 100644
index 0000000..a6d0a04
--- /dev/null
+++ b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited;
+
+import org.apache.mina.codec.delimited.ints.VarInt;
+import org.apache.mina.codec.delimited.serialization.ThriftDynamicMessageDecoder;
+import org.apache.thrift.TBase;
+
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ThriftDynamicDecoder extends
+        SizePrefixedDecoder<ThriftDynamicMessageDecoder.ThriftSerializedMessage> {
+    static public <L extends TBase<?,?>> ThriftDynamicDecoder newInstance() throws SecurityException,
+            NoSuchMethodException {
+        return new ThriftDynamicDecoder();
+    }
+
+    public ThriftDynamicDecoder() throws SecurityException, NoSuchMethodException {
+        super(new VarInt.Decoder(), ThriftDynamicMessageDecoder.newInstance());
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java
----------------------------------------------------------------------
diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java
new file mode 100644
index 0000000..b3fafc6
--- /dev/null
+++ b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited;
+
+import org.apache.mina.codec.delimited.ints.RawInt32;
+import org.apache.mina.codec.delimited.ints.RawInt32.Endianness;
+import org.apache.mina.codec.delimited.serialization.ThriftMessageEncoder;
+import org.apache.thrift.TBase;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ThriftEncoder<OUT extends TBase<?, ?>> extends SizePrefixedEncoder<OUT> {
+
+    static public <L extends TBase<?, ?>> ThriftEncoder<L> newInstance(Class<L> clazz) throws SecurityException,
+            NoSuchMethodException {
+        return new ThriftEncoder<L>(clazz);
+    }
+
+    public ThriftEncoder(Class<OUT> clazz) throws SecurityException, NoSuchMethodException {
+        super(new RawInt32.Encoder(Endianness.BIG), ThriftMessageEncoder.newInstance(clazz));
+    }
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java
----------------------------------------------------------------------
diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java
new file mode 100644
index 0000000..d22f9c1
--- /dev/null
+++ b/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited.serialization;
+
+import java.nio.ByteBuffer;
+
+import org.apache.mina.codec.ProtocolDecoderException;
+import org.apache.mina.codec.delimited.ByteBufferDecoder;
+import org.apache.thrift.TBase;
+import org.apache.thrift.TDeserializer;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TBinaryProtocol;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ThriftDynamicMessageDecoder extends
+		ByteBufferDecoder<ThriftDynamicMessageDecoder.ThriftSerializedMessage> {
+	private TDeserializer deserializer = new TDeserializer(
+			new TBinaryProtocol.Factory());
+
+	@Override
+	public ThriftSerializedMessage decode(ByteBuffer input)
+			throws ProtocolDecoderException {
+		byte array[] = new byte[input.remaining()];
+		input.get(array);
+		return new ThriftSerializedMessage(deserializer, array);
+	}
+
+	final static public class ThriftSerializedMessage {
+		final private byte array[];
+
+		final private TDeserializer deserializer;
+
+		public ThriftSerializedMessage(TDeserializer deserializer, byte array[]) {
+			this.array = array;
+			this.deserializer = deserializer;
+		}
+
+		public <L extends TBase<?, ?>> L get(Class<L> clazz)
+				throws InstantiationException, IllegalAccessException,
+				TException {
+			L object = clazz.newInstance();
+			deserializer.deserialize(object, array);
+			return object;
+		}
+	}
+
+	static public ThriftDynamicMessageDecoder newInstance() {
+		return new ThriftDynamicMessageDecoder();
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java
----------------------------------------------------------------------
diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java
new file mode 100644
index 0000000..e9739c6
--- /dev/null
+++ b/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited.serialization;
+
+import java.nio.ByteBuffer;
+
+import org.apache.mina.codec.ProtocolDecoderException;
+import org.apache.mina.codec.delimited.ByteBufferDecoder;
+import org.apache.thrift.TBase;
+import org.apache.thrift.TDeserializer;
+import org.apache.thrift.protocol.TBinaryProtocol;
+
+public class ThriftMessageDecoder<IN extends TBase<?, ?>> extends ByteBufferDecoder<IN> {
+    private TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
+
+    final private Class<IN> clazz;
+
+    static public <L extends TBase<?, ?>> ThriftMessageDecoder<L> newInstance(Class<L> clazz) {
+        return new ThriftMessageDecoder<L>(clazz);
+    }
+
+    @Override
+    public IN decode(ByteBuffer input) throws ProtocolDecoderException {
+        IN object;
+        try {
+            byte array[] = new byte[input.remaining()];
+            input.get(array);
+            object = clazz.newInstance();
+            deserializer.deserialize(object, array);
+            return object;
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    public ThriftMessageDecoder(Class<IN> clazz) {
+        super();
+        this.clazz = clazz;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageEncoder.java
----------------------------------------------------------------------
diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageEncoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageEncoder.java
new file mode 100644
index 0000000..04b9186
--- /dev/null
+++ b/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageEncoder.java
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited.serialization;
+
+import java.nio.ByteBuffer;
+
+import org.apache.mina.codec.delimited.ByteBufferEncoder;
+import org.apache.thrift.TBase;
+import org.apache.thrift.TException;
+import org.apache.thrift.TSerializer;
+import org.apache.thrift.protocol.TBinaryProtocol;
+
+public class ThriftMessageEncoder<OUT extends TBase<?, ?>> extends ByteBufferEncoder<OUT> {
+    final private TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
+
+    private OUT lastMessage;
+
+    private byte[] lastBuffer;
+
+    static public <L extends TBase<?, ?>> ThriftMessageEncoder<L> newInstance(Class<L> clazz) {
+        return new ThriftMessageEncoder<L>();
+    }
+
+    private byte[] prepareBuffer(OUT message) throws TException {
+        if (message != lastMessage) {
+            lastBuffer = serializer.serialize(message);
+            this.lastMessage = message;
+        }
+        return lastBuffer;
+    }
+
+    @Override
+    public int getEncodedSize(OUT message) {
+        try {
+            return prepareBuffer(message).length;
+        } catch (TException e) {
+            return 0;
+        }
+    }
+
+    @Override
+    public void writeTo(OUT message, ByteBuffer buffer) {
+        try {
+            buffer.put(prepareBuffer(message));
+        } catch (TException e) {
+            //
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/test/java/org/apache/mina/codec/delimited/ThriftTest.java
----------------------------------------------------------------------
diff --git a/thrift/src/test/java/org/apache/mina/codec/delimited/ThriftTest.java b/thrift/src/test/java/org/apache/mina/codec/delimited/ThriftTest.java
new file mode 100644
index 0000000..f4ea116
--- /dev/null
+++ b/thrift/src/test/java/org/apache/mina/codec/delimited/ThriftTest.java
@@ -0,0 +1,71 @@
+package org.apache.mina.codec.delimited;
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+
+
+import java.nio.ByteBuffer;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.mina.generated.thrift.UserProfile;
+import org.apache.thrift.TSerializer;
+import org.apache.thrift.transport.TFramedTransport;
+import org.apache.thrift.transport.TMemoryBuffer;
+
+
+/**
+ * A {@link ThriftEncoder} and {@link ThriftDecoder} test.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ThriftTest extends DelimitTest<UserProfile> {
+
+	@Override
+    public List<UserProfile> getObjects() {
+
+		List<UserProfile> list = new LinkedList<UserProfile>();
+
+		list.add(new UserProfile().setUid(1).setName("Jean Dupond"));
+		list.add(new UserProfile().setUid(2).setName("Marie Blanc"));
+
+		return list;
+	}
+
+	@Override
+    protected ByteBuffer delimitWithOriginal() throws Exception {
+
+		TMemoryBuffer m = new TMemoryBuffer(1000000);
+		TFramedTransport t = new TFramedTransport(m);
+		TSerializer tt = new TSerializer();
+		for (UserProfile up : getObjects()) {
+			t.write(tt.serialize(up));
+			t.flush();
+		}
+		return ByteBuffer.wrap(m.getArray(), 0, m.length());
+
+	}
+
+	@Override
+    public SizePrefixedEncoder<UserProfile> getSerializer()
+			throws SecurityException, NoSuchMethodException {
+		return ThriftEncoder.newInstance(UserProfile.class);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/thrift/src/test/java/org/apache/mina/codec/delimited/serialization/ThriftTest.java
----------------------------------------------------------------------
diff --git a/thrift/src/test/java/org/apache/mina/codec/delimited/serialization/ThriftTest.java b/thrift/src/test/java/org/apache/mina/codec/delimited/serialization/ThriftTest.java
new file mode 100644
index 0000000..6e7cf0b
--- /dev/null
+++ b/thrift/src/test/java/org/apache/mina/codec/delimited/serialization/ThriftTest.java
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.mina.codec.delimited.serialization;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.mina.codec.delimited.ByteBufferDecoder;
+import org.apache.mina.codec.delimited.ByteBufferEncoder;
+import org.apache.mina.generated.thrift.UserProfile;
+import org.junit.Test;
+
+/**
+ * A {@link ThriftMessageEncoder} and {@link ThriftMessageDecoder} test.
+ * 
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ThriftTest extends GenericSerializerTest<UserProfile> {
+
+    @Override
+    public List<UserProfile> getObjects() {
+        List<UserProfile> list = new LinkedList<UserProfile>();
+
+        list.add(new UserProfile().setUid(1).setName("Jean Dupond"));
+        list.add(new UserProfile().setUid(2).setName("Marie Blanc"));
+
+        return list;
+    }
+
+    @Override
+    public ByteBufferDecoder<UserProfile> getDecoder() throws Exception {
+        return ThriftMessageDecoder.newInstance(UserProfile.class);
+    }
+
+    @Override
+    public ByteBufferEncoder<UserProfile> getEncoder() throws Exception {
+        return ThriftMessageEncoder.newInstance(UserProfile.class);
+    }
+
+    @Test
+    public void testDynamic() throws Exception {
+        ByteBufferEncoder<UserProfile> encoder = getEncoder();
+        ThriftDynamicMessageDecoder decoder = new ThriftDynamicMessageDecoder();
+
+        for (UserProfile object : getObjects()) {
+            ThriftDynamicMessageDecoder.ThriftSerializedMessage message = decoder.decode(encoder.encode(object));
+            assertEquals(object, message.get(UserProfile.class));
+        }
+    }
+}


[5/7] flatenned the hierarchy of serialization packages

Posted by jv...@apache.org.
http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java
----------------------------------------------------------------------
diff --git a/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java b/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java
new file mode 100644
index 0000000..f1b61dc
--- /dev/null
+++ b/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java
@@ -0,0 +1,1160 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: src/test/protobuf/calc.proto
+
+package org.apache.mina.generated.protoc;
+
+public final class Calc {
+  private Calc() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface ComputationOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required double x = 1;
+    /**
+     * <code>required double x = 1;</code>
+     */
+    boolean hasX();
+    /**
+     * <code>required double x = 1;</code>
+     */
+    double getX();
+
+    // required double y = 2;
+    /**
+     * <code>required double y = 2;</code>
+     */
+    boolean hasY();
+    /**
+     * <code>required double y = 2;</code>
+     */
+    double getY();
+
+    // required .tutorial.Computation.Operator operator = 3;
+    /**
+     * <code>required .tutorial.Computation.Operator operator = 3;</code>
+     */
+    boolean hasOperator();
+    /**
+     * <code>required .tutorial.Computation.Operator operator = 3;</code>
+     */
+    org.apache.mina.generated.protoc.Calc.Computation.Operator getOperator();
+  }
+  /**
+   * Protobuf type {@code tutorial.Computation}
+   */
+  public static final class Computation extends
+      com.google.protobuf.GeneratedMessage
+      implements ComputationOrBuilder {
+    // Use Computation.newBuilder() to construct.
+    private Computation(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private Computation(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final Computation defaultInstance;
+    public static Computation getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public Computation getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private Computation(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 9: {
+              bitField0_ |= 0x00000001;
+              x_ = input.readDouble();
+              break;
+            }
+            case 17: {
+              bitField0_ |= 0x00000002;
+              y_ = input.readDouble();
+              break;
+            }
+            case 24: {
+              int rawValue = input.readEnum();
+              org.apache.mina.generated.protoc.Calc.Computation.Operator value = org.apache.mina.generated.protoc.Calc.Computation.Operator.valueOf(rawValue);
+              if (value == null) {
+                unknownFields.mergeVarintField(3, rawValue);
+              } else {
+                bitField0_ |= 0x00000004;
+                operator_ = value;
+              }
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Computation_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Computation_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.apache.mina.generated.protoc.Calc.Computation.class, org.apache.mina.generated.protoc.Calc.Computation.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<Computation> PARSER =
+        new com.google.protobuf.AbstractParser<Computation>() {
+      public Computation parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new Computation(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<Computation> getParserForType() {
+      return PARSER;
+    }
+
+    /**
+     * Protobuf enum {@code tutorial.Computation.Operator}
+     */
+    public enum Operator
+        implements com.google.protobuf.ProtocolMessageEnum {
+      /**
+       * <code>PLUS = 0;</code>
+       */
+      PLUS(0, 0),
+      /**
+       * <code>MINUS = 1;</code>
+       */
+      MINUS(1, 1),
+      /**
+       * <code>TIMES = 2;</code>
+       */
+      TIMES(2, 2),
+      /**
+       * <code>DIVIDE = 3;</code>
+       */
+      DIVIDE(3, 3),
+      ;
+
+      /**
+       * <code>PLUS = 0;</code>
+       */
+      public static final int PLUS_VALUE = 0;
+      /**
+       * <code>MINUS = 1;</code>
+       */
+      public static final int MINUS_VALUE = 1;
+      /**
+       * <code>TIMES = 2;</code>
+       */
+      public static final int TIMES_VALUE = 2;
+      /**
+       * <code>DIVIDE = 3;</code>
+       */
+      public static final int DIVIDE_VALUE = 3;
+
+
+      public final int getNumber() { return value; }
+
+      public static Operator valueOf(int value) {
+        switch (value) {
+          case 0: return PLUS;
+          case 1: return MINUS;
+          case 2: return TIMES;
+          case 3: return DIVIDE;
+          default: return null;
+        }
+      }
+
+      public static com.google.protobuf.Internal.EnumLiteMap<Operator>
+          internalGetValueMap() {
+        return internalValueMap;
+      }
+      private static com.google.protobuf.Internal.EnumLiteMap<Operator>
+          internalValueMap =
+            new com.google.protobuf.Internal.EnumLiteMap<Operator>() {
+              public Operator findValueByNumber(int number) {
+                return Operator.valueOf(number);
+              }
+            };
+
+      public final com.google.protobuf.Descriptors.EnumValueDescriptor
+          getValueDescriptor() {
+        return getDescriptor().getValues().get(index);
+      }
+      public final com.google.protobuf.Descriptors.EnumDescriptor
+          getDescriptorForType() {
+        return getDescriptor();
+      }
+      public static final com.google.protobuf.Descriptors.EnumDescriptor
+          getDescriptor() {
+        return org.apache.mina.generated.protoc.Calc.Computation.getDescriptor().getEnumTypes().get(0);
+      }
+
+      private static final Operator[] VALUES = values();
+
+      public static Operator valueOf(
+          com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
+        if (desc.getType() != getDescriptor()) {
+          throw new java.lang.IllegalArgumentException(
+            "EnumValueDescriptor is not for this type.");
+        }
+        return VALUES[desc.getIndex()];
+      }
+
+      private final int index;
+      private final int value;
+
+      private Operator(int index, int value) {
+        this.index = index;
+        this.value = value;
+      }
+
+      // @@protoc_insertion_point(enum_scope:tutorial.Computation.Operator)
+    }
+
+    private int bitField0_;
+    // required double x = 1;
+    public static final int X_FIELD_NUMBER = 1;
+    private double x_;
+    /**
+     * <code>required double x = 1;</code>
+     */
+    public boolean hasX() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required double x = 1;</code>
+     */
+    public double getX() {
+      return x_;
+    }
+
+    // required double y = 2;
+    public static final int Y_FIELD_NUMBER = 2;
+    private double y_;
+    /**
+     * <code>required double y = 2;</code>
+     */
+    public boolean hasY() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>required double y = 2;</code>
+     */
+    public double getY() {
+      return y_;
+    }
+
+    // required .tutorial.Computation.Operator operator = 3;
+    public static final int OPERATOR_FIELD_NUMBER = 3;
+    private org.apache.mina.generated.protoc.Calc.Computation.Operator operator_;
+    /**
+     * <code>required .tutorial.Computation.Operator operator = 3;</code>
+     */
+    public boolean hasOperator() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>required .tutorial.Computation.Operator operator = 3;</code>
+     */
+    public org.apache.mina.generated.protoc.Calc.Computation.Operator getOperator() {
+      return operator_;
+    }
+
+    private void initFields() {
+      x_ = 0D;
+      y_ = 0D;
+      operator_ = org.apache.mina.generated.protoc.Calc.Computation.Operator.PLUS;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasX()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasY()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasOperator()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeDouble(1, x_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeDouble(2, y_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeEnum(3, operator_.getNumber());
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeDoubleSize(1, x_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeDoubleSize(2, y_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeEnumSize(3, operator_.getNumber());
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Computation parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Computation parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Computation parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.apache.mina.generated.protoc.Calc.Computation prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code tutorial.Computation}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.apache.mina.generated.protoc.Calc.ComputationOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Computation_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Computation_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.mina.generated.protoc.Calc.Computation.class, org.apache.mina.generated.protoc.Calc.Computation.Builder.class);
+      }
+
+      // Construct using org.apache.mina.generated.protoc.Calc.Computation.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        x_ = 0D;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        y_ = 0D;
+        bitField0_ = (bitField0_ & ~0x00000002);
+        operator_ = org.apache.mina.generated.protoc.Calc.Computation.Operator.PLUS;
+        bitField0_ = (bitField0_ & ~0x00000004);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Computation_descriptor;
+      }
+
+      public org.apache.mina.generated.protoc.Calc.Computation getDefaultInstanceForType() {
+        return org.apache.mina.generated.protoc.Calc.Computation.getDefaultInstance();
+      }
+
+      public org.apache.mina.generated.protoc.Calc.Computation build() {
+        org.apache.mina.generated.protoc.Calc.Computation result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.apache.mina.generated.protoc.Calc.Computation buildPartial() {
+        org.apache.mina.generated.protoc.Calc.Computation result = new org.apache.mina.generated.protoc.Calc.Computation(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.x_ = x_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.y_ = y_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.operator_ = operator_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.apache.mina.generated.protoc.Calc.Computation) {
+          return mergeFrom((org.apache.mina.generated.protoc.Calc.Computation)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.apache.mina.generated.protoc.Calc.Computation other) {
+        if (other == org.apache.mina.generated.protoc.Calc.Computation.getDefaultInstance()) return this;
+        if (other.hasX()) {
+          setX(other.getX());
+        }
+        if (other.hasY()) {
+          setY(other.getY());
+        }
+        if (other.hasOperator()) {
+          setOperator(other.getOperator());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasX()) {
+          
+          return false;
+        }
+        if (!hasY()) {
+          
+          return false;
+        }
+        if (!hasOperator()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.apache.mina.generated.protoc.Calc.Computation parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.apache.mina.generated.protoc.Calc.Computation) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required double x = 1;
+      private double x_ ;
+      /**
+       * <code>required double x = 1;</code>
+       */
+      public boolean hasX() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required double x = 1;</code>
+       */
+      public double getX() {
+        return x_;
+      }
+      /**
+       * <code>required double x = 1;</code>
+       */
+      public Builder setX(double value) {
+        bitField0_ |= 0x00000001;
+        x_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required double x = 1;</code>
+       */
+      public Builder clearX() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        x_ = 0D;
+        onChanged();
+        return this;
+      }
+
+      // required double y = 2;
+      private double y_ ;
+      /**
+       * <code>required double y = 2;</code>
+       */
+      public boolean hasY() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required double y = 2;</code>
+       */
+      public double getY() {
+        return y_;
+      }
+      /**
+       * <code>required double y = 2;</code>
+       */
+      public Builder setY(double value) {
+        bitField0_ |= 0x00000002;
+        y_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required double y = 2;</code>
+       */
+      public Builder clearY() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        y_ = 0D;
+        onChanged();
+        return this;
+      }
+
+      // required .tutorial.Computation.Operator operator = 3;
+      private org.apache.mina.generated.protoc.Calc.Computation.Operator operator_ = org.apache.mina.generated.protoc.Calc.Computation.Operator.PLUS;
+      /**
+       * <code>required .tutorial.Computation.Operator operator = 3;</code>
+       */
+      public boolean hasOperator() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>required .tutorial.Computation.Operator operator = 3;</code>
+       */
+      public org.apache.mina.generated.protoc.Calc.Computation.Operator getOperator() {
+        return operator_;
+      }
+      /**
+       * <code>required .tutorial.Computation.Operator operator = 3;</code>
+       */
+      public Builder setOperator(org.apache.mina.generated.protoc.Calc.Computation.Operator value) {
+        if (value == null) {
+          throw new NullPointerException();
+        }
+        bitField0_ |= 0x00000004;
+        operator_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required .tutorial.Computation.Operator operator = 3;</code>
+       */
+      public Builder clearOperator() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        operator_ = org.apache.mina.generated.protoc.Calc.Computation.Operator.PLUS;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:tutorial.Computation)
+    }
+
+    static {
+      defaultInstance = new Computation(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:tutorial.Computation)
+  }
+
+  public interface ResultOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required double z = 1;
+    /**
+     * <code>required double z = 1;</code>
+     */
+    boolean hasZ();
+    /**
+     * <code>required double z = 1;</code>
+     */
+    double getZ();
+  }
+  /**
+   * Protobuf type {@code tutorial.Result}
+   */
+  public static final class Result extends
+      com.google.protobuf.GeneratedMessage
+      implements ResultOrBuilder {
+    // Use Result.newBuilder() to construct.
+    private Result(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private Result(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final Result defaultInstance;
+    public static Result getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public Result getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private Result(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 9: {
+              bitField0_ |= 0x00000001;
+              z_ = input.readDouble();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Result_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Result_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.apache.mina.generated.protoc.Calc.Result.class, org.apache.mina.generated.protoc.Calc.Result.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<Result> PARSER =
+        new com.google.protobuf.AbstractParser<Result>() {
+      public Result parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new Result(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<Result> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required double z = 1;
+    public static final int Z_FIELD_NUMBER = 1;
+    private double z_;
+    /**
+     * <code>required double z = 1;</code>
+     */
+    public boolean hasZ() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required double z = 1;</code>
+     */
+    public double getZ() {
+      return z_;
+    }
+
+    private void initFields() {
+      z_ = 0D;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasZ()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeDouble(1, z_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeDoubleSize(1, z_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Result parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Result parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.apache.mina.generated.protoc.Calc.Result parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.apache.mina.generated.protoc.Calc.Result prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code tutorial.Result}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.apache.mina.generated.protoc.Calc.ResultOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Result_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Result_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.apache.mina.generated.protoc.Calc.Result.class, org.apache.mina.generated.protoc.Calc.Result.Builder.class);
+      }
+
+      // Construct using org.apache.mina.generated.protoc.Calc.Result.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        z_ = 0D;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.apache.mina.generated.protoc.Calc.internal_static_tutorial_Result_descriptor;
+      }
+
+      public org.apache.mina.generated.protoc.Calc.Result getDefaultInstanceForType() {
+        return org.apache.mina.generated.protoc.Calc.Result.getDefaultInstance();
+      }
+
+      public org.apache.mina.generated.protoc.Calc.Result build() {
+        org.apache.mina.generated.protoc.Calc.Result result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.apache.mina.generated.protoc.Calc.Result buildPartial() {
+        org.apache.mina.generated.protoc.Calc.Result result = new org.apache.mina.generated.protoc.Calc.Result(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.z_ = z_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.apache.mina.generated.protoc.Calc.Result) {
+          return mergeFrom((org.apache.mina.generated.protoc.Calc.Result)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.apache.mina.generated.protoc.Calc.Result other) {
+        if (other == org.apache.mina.generated.protoc.Calc.Result.getDefaultInstance()) return this;
+        if (other.hasZ()) {
+          setZ(other.getZ());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasZ()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.apache.mina.generated.protoc.Calc.Result parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.apache.mina.generated.protoc.Calc.Result) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required double z = 1;
+      private double z_ ;
+      /**
+       * <code>required double z = 1;</code>
+       */
+      public boolean hasZ() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required double z = 1;</code>
+       */
+      public double getZ() {
+        return z_;
+      }
+      /**
+       * <code>required double z = 1;</code>
+       */
+      public Builder setZ(double value) {
+        bitField0_ |= 0x00000001;
+        z_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required double z = 1;</code>
+       */
+      public Builder clearZ() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        z_ = 0D;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:tutorial.Result)
+    }
+
+    static {
+      defaultInstance = new Result(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:tutorial.Result)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_tutorial_Computation_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_tutorial_Computation_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_tutorial_Result_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_tutorial_Result_fieldAccessorTable;
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\034src/test/protobuf/calc.proto\022\010tutorial" +
+      "\"\215\001\n\013Computation\022\t\n\001x\030\001 \002(\001\022\t\n\001y\030\002 \002(\001\0220" +
+      "\n\010operator\030\003 \002(\0162\036.tutorial.Computation." +
+      "Operator\"6\n\010Operator\022\010\n\004PLUS\020\000\022\t\n\005MINUS\020" +
+      "\001\022\t\n\005TIMES\020\002\022\n\n\006DIVIDE\020\003\"\023\n\006Result\022\t\n\001z\030" +
+      "\001 \002(\001B(\n org.apache.mina.generated.proto" +
+      "cB\004Calc"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          internal_static_tutorial_Computation_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          internal_static_tutorial_Computation_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_tutorial_Computation_descriptor,
+              new java.lang.String[] { "X", "Y", "Operator", });
+          internal_static_tutorial_Result_descriptor =
+            getDescriptor().getMessageTypes().get(1);
+          internal_static_tutorial_Result_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_tutorial_Result_descriptor,
+              new java.lang.String[] { "Z", });
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/test/protobuf/addressbook.proto
----------------------------------------------------------------------
diff --git a/protobuf/src/test/protobuf/addressbook.proto b/protobuf/src/test/protobuf/addressbook.proto
new file mode 100644
index 0000000..6bf919d
--- /dev/null
+++ b/protobuf/src/test/protobuf/addressbook.proto
@@ -0,0 +1,30 @@
+// See README.txt for information and build instructions.
+
+package tutorial;
+
+option java_package = "org.apache.mina.generated.protoc";
+option java_outer_classname = "AddressBookProtos";
+
+message Person {
+  required string name = 1;
+  required int32 id = 2;        // Unique ID number for this person.
+  optional string email = 3;
+
+  enum PhoneType {
+    MOBILE = 0;
+    HOME = 1;
+    WORK = 2;
+  }
+
+  message PhoneNumber {
+    required string number = 1;
+    optional PhoneType type = 2 [default = HOME];
+  }
+
+  repeated PhoneNumber phone = 4;
+}
+
+// Our address book file is just one of these.
+message AddressBook {
+  repeated Person person = 1;
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/protobuf/src/test/protobuf/calc.proto
----------------------------------------------------------------------
diff --git a/protobuf/src/test/protobuf/calc.proto b/protobuf/src/test/protobuf/calc.proto
new file mode 100644
index 0000000..44faf25
--- /dev/null
+++ b/protobuf/src/test/protobuf/calc.proto
@@ -0,0 +1,25 @@
+// See README.txt for information and build instructions.
+
+package tutorial;
+
+option java_package = "org.apache.mina.generated.protoc";
+option java_outer_classname = "Calc";
+
+message Computation {
+  required double x = 1;
+  required double y = 2;
+
+  required Operator operator = 3;
+
+  enum Operator {
+    PLUS = 0;
+    MINUS = 1;
+    TIMES = 2;
+    DIVIDE = 3;
+  }
+
+}
+
+message Result {
+  required double z = 1;
+}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/NOTES.txt
----------------------------------------------------------------------
diff --git a/serialization/NOTES.txt b/serialization/NOTES.txt
deleted file mode 100644
index 22be0dd..0000000
--- a/serialization/NOTES.txt
+++ /dev/null
@@ -1,36 +0,0 @@
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- 
- 
- 
- Notes on Apache Thrift and Google Protocol Buffer in MINA 3.0
- =============================================================
- 
- Both Thrift and Protobuf need a specific executable files to generate the 
- required Java code.
- 
- Both modules doesn't have any dependency against code generated by these
- executable files, but the dedicated unit tests have dependencies against
- them.
- 
- Not having the appropriate version of Apache Thrift or Google Protocol
- Buffer should not prevent developers/users to build MINA 3.0. For this
- particular reason, the generated files are also stored on the
- repository.
- 
- The generation scripts are stored in both directories under the name 
- "prepare.sh". 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/pom.xml
----------------------------------------------------------------------
diff --git a/serialization/pom.xml b/serialization/pom.xml
deleted file mode 100644
index 4485a09..0000000
--- a/serialization/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-  
-  http://www.apache.org/licenses/LICENSE-2.0
-  
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.mina</groupId>
-        <artifactId>mina-parent</artifactId>
-        <version>3.0.0-M1-SNAPSHOT</version>
-    </parent>
-
-    <groupId>org.apache.mina</groupId>
-    <version>3.0.0-M1-SNAPSHOT</version>
-    <artifactId>mina-serialization</artifactId>
-    <name>Apache MINA Serialization ${project.version}</name>
-    <packaging>pom</packaging>
-
-    <description>
-        Parent POM for Apache MINA serialization modules
-    </description>
-
-    <modules>
-        <module>thrift</module>
-        <module>protobuf</module>
-    </modules>
-
-</project>

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/pom.xml
----------------------------------------------------------------------
diff --git a/serialization/protobuf/pom.xml b/serialization/protobuf/pom.xml
deleted file mode 100644
index 17c227a..0000000
--- a/serialization/protobuf/pom.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.mina</groupId>
-        <artifactId>mina-serialization</artifactId>
-        <version>3.0.0-M1-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>mina-protobuf</artifactId>
-    <name>Apache MINA Serialization::Protobuf ${project.version}</name>
-    <packaging>bundle</packaging>
-
-    <properties>
-        <symbolicName>${project.groupId}.protobuf</symbolicName>
-        <exportedPackage>${project.groupId}</exportedPackage>
-        <protobuf.version>2.5.0</protobuf.version>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.google.protobuf</groupId>
-            <artifactId>protobuf-java</artifactId>
-            <version>${protobuf.version}</version>
-            <scope>provided</scope>
-        </dependency>
-
-
-        <dependency>
-            <groupId>org.apache.logging.log4j.adapters</groupId>
-            <artifactId>slf4j-impl</artifactId>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>mina-codec</artifactId>
-            <version>${project.version}</version>
-            <type>bundle</type>
-        </dependency>
-        
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>mina-codec</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-            <classifier>tests</classifier>
-        </dependency>
-        
-    </dependencies>
-</project>
-

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/prepare.sh
----------------------------------------------------------------------
diff --git a/serialization/protobuf/prepare.sh b/serialization/protobuf/prepare.sh
deleted file mode 100644
index 84fd1fc..0000000
--- a/serialization/protobuf/prepare.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-if hash protoc 2>/dev/null; then
-	VERSION=`protoc --version`
-
-	if [[ $VERSION =~ libprotoc\ 2\.5\. ]];
-	then
-		protoc --java_out=src/test/java src/test/protobuf/addressbook.proto src/test/protobuf/calc.proto
-	else
-		echo "Need Google Protocol Buffer 2.5.x (found $VERSION)"
-	fi
-else
-	echo "No installation of Google Protocol Buffer found"
-fi
-

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java b/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java
deleted file mode 100644
index 7072d6e..0000000
--- a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited;
-
-import org.apache.mina.codec.delimited.ints.VarInt;
-import org.apache.mina.codec.delimited.serialization.ProtobufMessageDecoder;
-
-import com.google.protobuf.ExtensionRegistryLite;
-import com.google.protobuf.GeneratedMessage;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ProtobufDecoder<M extends GeneratedMessage> extends SizePrefixedDecoder<M> {
-    static public <L extends GeneratedMessage> ProtobufDecoder<L> newInstance(Class<L> clazz,
-            ExtensionRegistryLite registry) throws SecurityException, NoSuchMethodException {
-        return new ProtobufDecoder<L>(clazz, registry);
-    }
-
-    static public <L extends GeneratedMessage> ProtobufDecoder<L> newInstance(Class<L> clazz) throws SecurityException,
-            NoSuchMethodException {
-        return newInstance(clazz, ExtensionRegistryLite.getEmptyRegistry());
-    }
-
-    public ProtobufDecoder(Class<M> clazz, ExtensionRegistryLite registry) throws SecurityException,
-            NoSuchMethodException {
-        super(new VarInt.Decoder(), ProtobufMessageDecoder.newInstance(clazz, registry));
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java b/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java
deleted file mode 100644
index e3b2506..0000000
--- a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited;
-
-import org.apache.mina.codec.delimited.ints.VarInt;
-import org.apache.mina.codec.delimited.serialization.ProtobufDynamicMessageDecoder;
-
-import com.google.protobuf.GeneratedMessage;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ProtobufDynamicDecoder extends
-        SizePrefixedDecoder<ProtobufDynamicMessageDecoder.ProtobufSerializedMessage> {
-    static public <L extends GeneratedMessage> ProtobufDynamicDecoder newInstance() throws SecurityException,
-            NoSuchMethodException {
-        return new ProtobufDynamicDecoder();
-    }
-
-    public ProtobufDynamicDecoder() throws SecurityException, NoSuchMethodException {
-        super(new VarInt.Decoder(), ProtobufDynamicMessageDecoder.newInstance());
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufEncoder.java
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufEncoder.java b/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufEncoder.java
deleted file mode 100644
index 8386e89..0000000
--- a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufEncoder.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited;
-
-import org.apache.mina.codec.delimited.ints.VarInt;
-import org.apache.mina.codec.delimited.serialization.ProtobufMessageEncoder;
-
-import com.google.protobuf.GeneratedMessage;
-
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ProtobufEncoder<OUT extends GeneratedMessage> extends
-		SizePrefixedEncoder<OUT> {
-
-	static public <L extends GeneratedMessage> ProtobufEncoder<L> newInstance(
-			Class<L> clazz) {
-		return new ProtobufEncoder<L>(clazz);
-	}
-
-	public ProtobufEncoder(Class<OUT> clazz) {
-		super(new VarInt.Encoder(), ProtobufMessageEncoder.newInstance(clazz));
-	}
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java b/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java
deleted file mode 100644
index b574c08..0000000
--- a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited.serialization;
-
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.ByteBuffer;
-
-import org.apache.mina.codec.ProtocolDecoderException;
-import org.apache.mina.codec.delimited.ByteBufferDecoder;
-import org.apache.mina.util.ByteBufferInputStream;
-
-import com.google.protobuf.ExtensionRegistryLite;
-import com.google.protobuf.GeneratedMessage;
-
-/**
- * An alternative decoder for protobuf which allows the use various target
- * classes with the same decoder.
- * 
- * This decoder converts incoming {@link ByteBuffer} into
- * {@link ProtobufSerializedMessage}.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ProtobufDynamicMessageDecoder extends
-        ByteBufferDecoder<ProtobufDynamicMessageDecoder.ProtobufSerializedMessage> {
-
-    static public ProtobufDynamicMessageDecoder newInstance() {
-        return new ProtobufDynamicMessageDecoder();
-    }
-
-    @Override
-    public ProtobufSerializedMessage decode(ByteBuffer input) throws ProtocolDecoderException {
-        return new ProtobufSerializedMessage(input);
-    }
-
-    final static public class ProtobufSerializedMessage {
-        final private ByteBuffer input;
-
-        public ProtobufSerializedMessage(ByteBuffer input) {
-            this.input = input;
-        }
-
-        @SuppressWarnings("unchecked")
-        public <L extends GeneratedMessage> L get(Class<L> clazz, ExtensionRegistryLite registry)
-                throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException,
-                InvocationTargetException {
-            Method parseMethod = clazz.getDeclaredMethod("parseFrom", InputStream.class, ExtensionRegistryLite.class);
-            return (L) parseMethod.invoke(null, new ByteBufferInputStream(input.duplicate()), registry);
-        }
-
-        public <L extends GeneratedMessage> L get(Class<L> clazz) throws SecurityException, NoSuchMethodException,
-                IllegalArgumentException, IllegalAccessException, InvocationTargetException {
-            return get(clazz, ExtensionRegistryLite.getEmptyRegistry());
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java b/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java
deleted file mode 100644
index 94b5218..0000000
--- a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited.serialization;
-
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.nio.ByteBuffer;
-
-import org.apache.mina.codec.ProtocolDecoderException;
-import org.apache.mina.codec.delimited.ByteBufferDecoder;
-import org.apache.mina.util.ByteBufferInputStream;
-
-import com.google.protobuf.ExtensionRegistryLite;
-import com.google.protobuf.GeneratedMessage;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ProtobufMessageDecoder<IN extends GeneratedMessage> extends ByteBufferDecoder<IN> {
-    final private Method parseMethod;
-
-    final private ExtensionRegistryLite registry;
-
-    public static <TYPE extends GeneratedMessage> ProtobufMessageDecoder<TYPE> newInstance(Class<TYPE> c)
-            throws SecurityException, NoSuchMethodException {
-        return newInstance(c, ExtensionRegistryLite.getEmptyRegistry());
-    }
-
-    public static <TYPE extends GeneratedMessage> ProtobufMessageDecoder<TYPE> newInstance(Class<TYPE> c,
-            ExtensionRegistryLite registry) throws SecurityException, NoSuchMethodException {
-        return new ProtobufMessageDecoder<TYPE>(c, registry);
-    }
-
-    private ProtobufMessageDecoder(Class<IN> clazz, ExtensionRegistryLite registry) throws SecurityException,
-            NoSuchMethodException {
-        super();
-        parseMethod = clazz.getDeclaredMethod("parseFrom", InputStream.class, ExtensionRegistryLite.class);
-        this.registry = registry;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public IN decode(ByteBuffer input) throws ProtocolDecoderException {
-        try {
-            return (IN) parseMethod.invoke(null, new ByteBufferInputStream(input), registry);
-        } catch (Exception e) {
-            throw new ProtocolDecoderException(e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageEncoder.java
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageEncoder.java b/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageEncoder.java
deleted file mode 100644
index 178d9b5..0000000
--- a/serialization/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageEncoder.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited.serialization;
-
-import java.nio.ByteBuffer;
-
-import org.apache.mina.codec.delimited.ByteBufferEncoder;
-
-import com.google.protobuf.GeneratedMessage;
-
-/**
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ProtobufMessageEncoder<OUT extends GeneratedMessage> extends ByteBufferEncoder<OUT> {
-
-    static public <T extends GeneratedMessage> ProtobufMessageEncoder<T> newInstance(Class<T> clazz) {
-        return new ProtobufMessageEncoder<T>();
-    }
-
-    @Override
-    public int getEncodedSize(OUT message) {
-        return message.getSerializedSize();
-    }
-
-    @Override
-    public void writeTo(OUT message, ByteBuffer buffer) {
-        buffer.put(message.toByteArray());
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/test/java/org/apache/mina/codec/delimited/ProtobufTest.java
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/test/java/org/apache/mina/codec/delimited/ProtobufTest.java b/serialization/protobuf/src/test/java/org/apache/mina/codec/delimited/ProtobufTest.java
deleted file mode 100644
index 3f90370..0000000
--- a/serialization/protobuf/src/test/java/org/apache/mina/codec/delimited/ProtobufTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.mina.generated.protoc.AddressBookProtos.Person;
-import org.apache.mina.util.ByteBufferOutputStream;
-
-/**
- * A {@link ProtobufEncoder} and {@link ProtobufDecoder} test.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ProtobufTest extends DelimitTest<Person> {
-  
-
-    @Override
-    public List<Person> getObjects() {
-
-        List<Person> list = new LinkedList<Person>();
-
-        list.add(Person.newBuilder().setId(1).setName("Jean Dupond").setEmail("john.white@bigcorp.com").build());
-        list.add(Person.newBuilder().setId(2).setName("Marie Blanc").setEmail("marie.blanc@bigcorp.com").build());
-
-        return list;
-    }
-
-    @Override
-    protected ByteBuffer delimitWithOriginal() throws IOException {
-        ByteBufferOutputStream bbos = new ByteBufferOutputStream();
-        bbos.setElastic(true);
-        for (Person p : getObjects()) {
-            p.writeDelimitedTo(bbos);
-        }
-        return bbos.getByteBuffer();
-    }
-
-    @Override
-    public SizePrefixedEncoder<Person> getSerializer() {
-        return ProtobufEncoder.newInstance(Person.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/1e6bb8b0/serialization/protobuf/src/test/java/org/apache/mina/codec/delimited/serialization/ProtobufTest.java
----------------------------------------------------------------------
diff --git a/serialization/protobuf/src/test/java/org/apache/mina/codec/delimited/serialization/ProtobufTest.java b/serialization/protobuf/src/test/java/org/apache/mina/codec/delimited/serialization/ProtobufTest.java
deleted file mode 100644
index abc96ea..0000000
--- a/serialization/protobuf/src/test/java/org/apache/mina/codec/delimited/serialization/ProtobufTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.apache.mina.codec.delimited.serialization;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.mina.codec.delimited.ByteBufferDecoder;
-import org.apache.mina.codec.delimited.ByteBufferEncoder;
-import org.apache.mina.codec.delimited.serialization.ProtobufDynamicMessageDecoder.ProtobufSerializedMessage;
-import org.apache.mina.generated.protoc.AddressBookProtos.Person;
-import org.junit.Test;
-
-/**
- * A {@link ProtobufMessageEncoder} and {@link ProtobufMessageDecoder} test.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class ProtobufTest extends GenericSerializerTest<Person> {
-
-    @Override
-    public List<Person> getObjects() {
-        List<Person> list = new LinkedList<Person>();
-
-        list.add(Person.newBuilder().setId(1).setName("Jean Dupond").setEmail("john.white@bigcorp.com").build());
-        list.add(Person.newBuilder().setId(2).setName("Marie Blanc").setEmail("marie.blanc@bigcorp.com").build());
-
-        return list;
-    }
- 
-    @Override
-    public ByteBufferDecoder<Person> getDecoder() throws Exception {
-        return ProtobufMessageDecoder.newInstance(Person.class);
-    }
-
-    @Override
-    public ByteBufferEncoder<Person> getEncoder() throws Exception {
-        return new ProtobufMessageEncoder<Person>();
-    }
-
-    @Test
-    public void testDynamic() throws Exception {
-        ByteBufferEncoder<Person> encoder = getEncoder();
-        ProtobufDynamicMessageDecoder decoder = new ProtobufDynamicMessageDecoder();
-
-        for (Person object : getObjects()) {
-            ProtobufSerializedMessage message = decoder.decode(encoder.encode(object));
-            assertEquals(object, message.get(Person.class));
-        }
-    }
-}