You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by an...@apache.org on 2018/09/04 14:02:25 UTC

[1/8] zookeeper git commit: ZOOKEEPER-3080_3.4: MAVEN MIGRATION - Step 1.5 - move jute dir

Repository: zookeeper
Updated Branches:
  refs/heads/branch-3.4 5694559d7 -> 29cc5c1a7


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/resources/zookeeper.jute
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/resources/zookeeper.jute b/zookeeper-jute/src/main/resources/zookeeper.jute
new file mode 100644
index 0000000..27a5a7e
--- /dev/null
+++ b/zookeeper-jute/src/main/resources/zookeeper.jute
@@ -0,0 +1,293 @@
+/**
+ * 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.
+ */
+
+module org.apache.zookeeper.data {
+    class Id {
+        ustring scheme;
+        ustring id;
+    }
+    class ACL {
+        int perms;
+        Id id;
+    }
+    // information shared with the client
+    class Stat {
+        long czxid;      // created zxid
+        long mzxid;      // last modified zxid
+        long ctime;      // created
+        long mtime;      // last modified
+        int version;     // version
+        int cversion;    // child version
+        int aversion;    // acl version
+        long ephemeralOwner; // owner id if ephemeral, 0 otw
+        int dataLength;  //length of the data in the node
+        int numChildren; //number of children of this node
+        long pzxid;      // last modified children
+    }
+    // information explicitly stored by the server persistently
+    class StatPersisted {
+        long czxid;      // created zxid
+        long mzxid;      // last modified zxid
+        long ctime;      // created
+        long mtime;      // last modified
+        int version;     // version
+        int cversion;    // child version
+        int aversion;    // acl version
+        long ephemeralOwner; // owner id if ephemeral, 0 otw
+        long pzxid;      // last modified children
+    }
+
+   // information explicitly stored by the version 1 database of servers 
+   class StatPersistedV1 {
+       long czxid; //created zxid
+       long mzxid; //last modified zxid
+       long ctime; //created
+       long mtime; //last modified
+       int version; //version
+       int cversion; //child version
+       int aversion; //acl version
+       long ephemeralOwner; //owner id if ephemeral. 0 otw
+    }
+}
+
+module org.apache.zookeeper.proto {
+    class ConnectRequest {
+        int protocolVersion;
+        long lastZxidSeen;
+        int timeOut;
+        long sessionId;
+        buffer passwd;
+    }
+    class ConnectResponse {
+        int protocolVersion;
+        int timeOut;
+        long sessionId;
+        buffer passwd;
+    }
+    class SetWatches {
+        long relativeZxid;
+        vector<ustring>dataWatches;
+        vector<ustring>existWatches;
+        vector<ustring>childWatches;
+    }        
+    class RequestHeader {
+        int xid;
+        int type;
+    }
+    class MultiHeader {
+        int type;
+        boolean done;
+        int err;
+    }
+    class AuthPacket {
+        int type;
+        ustring scheme;
+        buffer auth;
+    }
+    class ReplyHeader {
+        int xid;
+        long zxid;
+        int err;
+    }
+    class GetDataRequest {
+        ustring path;
+        boolean watch;
+    }
+    class SetDataRequest {
+        ustring path;
+        buffer data;
+        int version;
+    }
+    class SetDataResponse {
+        org.apache.zookeeper.data.Stat stat;
+    }
+    class GetSASLRequest {
+        buffer token;
+    }
+    class SetSASLRequest {
+        buffer token;
+    }
+    class SetSASLResponse {
+        buffer token;
+    }
+    class CreateRequest {
+        ustring path;
+        buffer data;
+        vector<org.apache.zookeeper.data.ACL> acl;
+        int flags;
+    }
+    class DeleteRequest {
+        ustring path;
+        int version;
+    }
+    class GetChildrenRequest {
+        ustring path;
+        boolean watch;
+    }
+    class GetChildren2Request {
+        ustring path;
+        boolean watch;
+    }
+    class CheckVersionRequest {
+        ustring path;
+        int version;
+    }
+    class GetMaxChildrenRequest {
+        ustring path;
+    }
+    class GetMaxChildrenResponse {
+        int max;
+    }
+    class SetMaxChildrenRequest {
+        ustring path;
+        int max;
+    }
+    class SyncRequest {
+        ustring path;
+    }
+    class SyncResponse {
+        ustring path;
+    }
+    class GetACLRequest {
+        ustring path;
+    }
+    class SetACLRequest {
+        ustring path;
+        vector<org.apache.zookeeper.data.ACL> acl;
+        int version;
+    }
+    class SetACLResponse {
+        org.apache.zookeeper.data.Stat stat;
+    }
+    class WatcherEvent {
+        int type;  // event type
+        int state; // state of the Keeper client runtime
+        ustring path;
+    }
+    class ErrorResponse {
+        int err;
+    }
+    class CreateResponse {
+        ustring path;
+    }
+    class ExistsRequest {
+        ustring path;
+        boolean watch;
+    }
+    class ExistsResponse {
+        org.apache.zookeeper.data.Stat stat;
+    }
+    class GetDataResponse {
+        buffer data;
+        org.apache.zookeeper.data.Stat stat;
+    }
+    class GetChildrenResponse {
+        vector<ustring> children;
+    }
+    class GetChildren2Response {
+        vector<ustring> children;
+        org.apache.zookeeper.data.Stat stat;
+    }
+    class GetACLResponse {
+        vector<org.apache.zookeeper.data.ACL> acl;
+        org.apache.zookeeper.data.Stat stat;
+    }
+}
+
+module org.apache.zookeeper.server.quorum {
+    class LearnerInfo {
+        long serverid;
+        int protocolVersion;
+    }
+    class QuorumPacket {
+        int type; // Request, Ack, Commit, Ping
+        long zxid;
+        buffer data; // Only significant when type is request
+        vector<org.apache.zookeeper.data.Id> authinfo;
+    }
+    class QuorumAuthPacket {
+        long magic;
+        int status;
+        buffer token;
+    }
+}
+
+module org.apache.zookeeper.server.persistence {
+    class FileHeader {
+        int magic;
+        int version;
+        long dbid;
+    }
+}
+
+module org.apache.zookeeper.txn {
+    class TxnHeader {
+        long clientId;
+        int cxid;
+        long zxid;
+        long time;
+        int type;
+    }
+    class CreateTxnV0 {
+        ustring path;
+        buffer data;
+        vector<org.apache.zookeeper.data.ACL> acl;
+        boolean ephemeral;
+    }
+    class CreateTxn {
+        ustring path;
+        buffer data;
+        vector<org.apache.zookeeper.data.ACL> acl;
+        boolean ephemeral;
+        int parentCVersion;
+    }
+    class DeleteTxn {
+        ustring path;
+    }
+    class SetDataTxn {
+        ustring path;
+        buffer data;
+        int version;
+    }
+    class CheckVersionTxn {
+        ustring path;
+        int version;
+    }
+    class SetACLTxn {
+        ustring path;
+        vector<org.apache.zookeeper.data.ACL> acl;
+        int version;
+    }
+    class SetMaxChildrenTxn {
+        ustring path;
+        int max;
+    }
+    class CreateSessionTxn {
+        int timeOut;
+    }
+    class ErrorTxn {
+        int err;
+    }
+    class Txn {
+        int type;
+        buffer data;
+    }
+    class MultiTxn {
+        vector<org.apache.zookeeper.txn.Txn> txns;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/test/java/org/apache/jute/BinaryInputArchiveTest.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/test/java/org/apache/jute/BinaryInputArchiveTest.java b/zookeeper-jute/src/test/java/org/apache/jute/BinaryInputArchiveTest.java
new file mode 100644
index 0000000..a8d067d
--- /dev/null
+++ b/zookeeper-jute/src/test/java/org/apache/jute/BinaryInputArchiveTest.java
@@ -0,0 +1,43 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.jute;
+
+import junit.framework.Assert;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+
+public class BinaryInputArchiveTest {
+
+    @Test
+    public void testReadStringCheckLength() {
+        byte[] buf = new byte[]{
+                Byte.MAX_VALUE, Byte.MAX_VALUE, Byte.MAX_VALUE, Byte.MAX_VALUE};
+        ByteArrayInputStream is = new ByteArrayInputStream(buf);
+        BinaryInputArchive ia = BinaryInputArchive.getArchive(is);
+        try {
+            ia.readString("");
+            Assert.fail("Should have thrown an IOException");
+        } catch (IOException e) {
+            Assert.assertTrue("Not 'Unreasonable length' exception: " + e,
+                    e.getMessage().startsWith(BinaryInputArchive.UNREASONBLE_LENGTH));
+        }
+    }
+}


[8/8] zookeeper git commit: ZOOKEEPER-3080_3.4: MAVEN MIGRATION - Step 1.5 - move jute dir

Posted by an...@apache.org.
ZOOKEEPER-3080_3.4: MAVEN MIGRATION - Step 1.5 - move jute dir

Author: Norbert Kalmar <nk...@yahoo.com>

Reviewers: andor@apache.org

Closes #616 from nkalmar/ZOOKEEPER-3080_3.4


Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/29cc5c1a
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/29cc5c1a
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/29cc5c1a

Branch: refs/heads/branch-3.4
Commit: 29cc5c1a7743cf126e3f9b7badb19cf3e80b69e6
Parents: 5694559
Author: Norbert Kalmar <nk...@yahoo.com>
Authored: Tue Sep 4 16:02:19 2018 +0200
Committer: Andor Molnar <an...@apache.org>
Committed: Tue Sep 4 16:02:19 2018 +0200

----------------------------------------------------------------------
 build.xml                                       |  36 +-
 .../org/apache/jute/BinaryInputArchive.java     | 130 ---
 .../org/apache/jute/BinaryOutputArchive.java    | 146 ----
 .../main/org/apache/jute/CsvInputArchive.java   | 208 -----
 .../main/org/apache/jute/CsvOutputArchive.java  | 150 ----
 src/java/main/org/apache/jute/Index.java        |  38 -
 src/java/main/org/apache/jute/InputArchive.java |  43 -
 .../main/org/apache/jute/OutputArchive.java     |  47 --
 src/java/main/org/apache/jute/Record.java       |  35 -
 src/java/main/org/apache/jute/RecordReader.java |  93 ---
 src/java/main/org/apache/jute/RecordWriter.java | 113 ---
 src/java/main/org/apache/jute/Utils.java        | 282 -------
 .../main/org/apache/jute/XmlInputArchive.java   | 251 ------
 .../main/org/apache/jute/XmlOutputArchive.java  | 251 ------
 .../org/apache/jute/compiler/CGenerator.java    | 142 ----
 .../apache/jute/compiler/CSharpGenerator.java   |  53 --
 .../org/apache/jute/compiler/CppGenerator.java  | 136 ---
 .../main/org/apache/jute/compiler/JBoolean.java |  50 --
 .../main/org/apache/jute/compiler/JBuffer.java  | 106 ---
 .../main/org/apache/jute/compiler/JByte.java    |  34 -
 .../org/apache/jute/compiler/JCompType.java     |  66 --
 .../main/org/apache/jute/compiler/JDouble.java  |  40 -
 .../main/org/apache/jute/compiler/JField.java   | 140 ----
 .../main/org/apache/jute/compiler/JFile.java    |  84 --
 .../main/org/apache/jute/compiler/JFloat.java   |  39 -
 .../main/org/apache/jute/compiler/JInt.java     |  34 -
 .../main/org/apache/jute/compiler/JLong.java    |  38 -
 .../main/org/apache/jute/compiler/JMap.java     | 149 ----
 .../main/org/apache/jute/compiler/JRecord.java  | 776 -----------------
 .../main/org/apache/jute/compiler/JString.java  |  46 -
 .../main/org/apache/jute/compiler/JType.java    | 204 -----
 .../main/org/apache/jute/compiler/JVector.java  | 153 ----
 .../org/apache/jute/compiler/JavaGenerator.java |  57 --
 .../jute/compiler/generated/ParseException.java | 210 -----
 .../org/apache/jute/compiler/generated/Rcc.java | 525 ------------
 .../jute/compiler/generated/RccConstants.java   |  88 --
 .../compiler/generated/RccTokenManager.java     | 833 -------------------
 .../compiler/generated/SimpleCharStream.java    | 457 ----------
 .../apache/jute/compiler/generated/Token.java   |  99 ---
 .../jute/compiler/generated/TokenMgrError.java  | 151 ----
 .../apache/jute/compiler/generated/package.html |  28 -
 .../org/apache/jute/compiler/generated/rcc.jj   | 374 ---------
 .../main/org/apache/jute/compiler/package.html  |  30 -
 src/java/main/org/apache/jute/package.html      | 801 ------------------
 .../org/apache/jute/BinaryInputArchiveTest.java |  43 -
 src/zookeeper.jute                              | 293 -------
 .../org/apache/jute/BinaryInputArchive.java     | 130 +++
 .../org/apache/jute/BinaryOutputArchive.java    | 146 ++++
 .../java/org/apache/jute/CsvInputArchive.java   | 208 +++++
 .../java/org/apache/jute/CsvOutputArchive.java  | 150 ++++
 .../src/main/java/org/apache/jute/Index.java    |  38 +
 .../main/java/org/apache/jute/InputArchive.java |  43 +
 .../java/org/apache/jute/OutputArchive.java     |  47 ++
 .../src/main/java/org/apache/jute/Record.java   |  35 +
 .../main/java/org/apache/jute/RecordReader.java |  93 +++
 .../main/java/org/apache/jute/RecordWriter.java | 113 +++
 .../src/main/java/org/apache/jute/Utils.java    | 282 +++++++
 .../java/org/apache/jute/XmlInputArchive.java   | 251 ++++++
 .../java/org/apache/jute/XmlOutputArchive.java  | 251 ++++++
 .../org/apache/jute/compiler/CGenerator.java    | 142 ++++
 .../apache/jute/compiler/CSharpGenerator.java   |  53 ++
 .../org/apache/jute/compiler/CppGenerator.java  | 136 +++
 .../java/org/apache/jute/compiler/JBoolean.java |  50 ++
 .../java/org/apache/jute/compiler/JBuffer.java  | 106 +++
 .../java/org/apache/jute/compiler/JByte.java    |  34 +
 .../org/apache/jute/compiler/JCompType.java     |  66 ++
 .../java/org/apache/jute/compiler/JDouble.java  |  40 +
 .../java/org/apache/jute/compiler/JField.java   | 140 ++++
 .../java/org/apache/jute/compiler/JFile.java    |  84 ++
 .../java/org/apache/jute/compiler/JFloat.java   |  39 +
 .../java/org/apache/jute/compiler/JInt.java     |  34 +
 .../java/org/apache/jute/compiler/JLong.java    |  38 +
 .../java/org/apache/jute/compiler/JMap.java     | 149 ++++
 .../java/org/apache/jute/compiler/JRecord.java  | 776 +++++++++++++++++
 .../java/org/apache/jute/compiler/JString.java  |  46 +
 .../java/org/apache/jute/compiler/JType.java    | 204 +++++
 .../java/org/apache/jute/compiler/JVector.java  | 153 ++++
 .../org/apache/jute/compiler/JavaGenerator.java |  57 ++
 .../jute/compiler/generated/ParseException.java | 210 +++++
 .../org/apache/jute/compiler/generated/Rcc.java | 525 ++++++++++++
 .../jute/compiler/generated/RccConstants.java   |  88 ++
 .../compiler/generated/RccTokenManager.java     | 833 +++++++++++++++++++
 .../compiler/generated/SimpleCharStream.java    | 457 ++++++++++
 .../apache/jute/compiler/generated/Token.java   |  99 +++
 .../jute/compiler/generated/TokenMgrError.java  | 151 ++++
 .../apache/jute/compiler/generated/package.html |  28 +
 .../org/apache/jute/compiler/generated/rcc.jj   | 374 +++++++++
 .../java/org/apache/jute/compiler/package.html  |  30 +
 .../src/main/java/org/apache/jute/package.html  | 801 ++++++++++++++++++
 .../src/main/resources/zookeeper.jute           | 293 +++++++
 .../org/apache/jute/BinaryInputArchiveTest.java |  43 +
 91 files changed, 8096 insertions(+), 8072 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 021c9b6..4618f5c 100644
--- a/build.xml
+++ b/build.xml
@@ -84,6 +84,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
 
     <property name="src.dir" value="${basedir}/src" />
     <property name="java.src.dir" value="${src.dir}/java/main" />
+    <property name="jute.src.dir" value="${basedir}/zookeeper-jute/src/main/java" />
 
     <property name="lib.dir" value="${src.dir}/java/lib" />
     <property name="lib.dir.includes" value="**/*.jar" />
@@ -102,7 +103,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
     <property name="c.src.dir" value="${basedir}/zookeeper-client/zookeeper-client-c" />
     <property name="csrc_generated.dir" value="${c.src.dir}/generated" />
 
-    <property name="jute.file" value="${src.dir}/zookeeper.jute" />
+    <property name="jute.file" value="${basedir}/zookeeper-jute/src/main/resources/zookeeper.jute" />
 
     <property name="build.classes" value="${build.dir}/classes"/>
     <property name="build.docs" value="${build.dir}/docs" />
@@ -112,6 +113,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
     <property name="test.java.build.dir" value="${build.dir}/test"/>
     <property name="test.java.classes" value="${test.java.build.dir}/classes"/>
     <property name="test.src.dir" value="${src.dir}/java/test"/>
+    <property name="jute.test.src.dir" value="${basedir}/zookeeper-jute/src/test/java" />
     <property name="systest.src.dir" value="${src.dir}/java/systest"/>
     <property name="test.log.dir" value="${test.java.build.dir}/logs" />
     <property name="test.data.dir" value="${test.java.build.dir}/data" />
@@ -311,7 +313,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
     </target>
     
     <target name="jute" depends="init">
-        <javac srcdir="${java.src.dir}" destdir="${build.classes}" includeantruntime="false"
+        <javac srcdir="${jute.src.dir}" destdir="${build.classes}" includeantruntime="false"
             target="${javac.target}" source="${javac.source}"
             includes="org/apache/jute/**" debug="on" classpath="${ivy.lib}/audience-annotations-${audience-annotations.version}.jar" />
     </target>
@@ -328,7 +330,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
         <java classname="org.apache.jute.compiler.generated.Rcc" fork="true" dir="${src_generated.dir}">
             <arg value="-l" />
             <arg value="java" />
-            <arg value="../../zookeeper.jute" />
+            <arg value="../../../zookeeper-jute/src/main/resources/zookeeper.jute" />
             <classpath>
                 <pathelement path="${build.classes}" />
             </classpath>
@@ -337,7 +339,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
         <java classname="org.apache.jute.compiler.generated.Rcc" fork="true" dir="${csrc_generated.dir}">
             <arg value="-l" />
             <arg value="c" />
-            <arg value="../../../src/zookeeper.jute" />
+            <arg value="../../../zookeeper-jute/src/main/resources/zookeeper.jute" />
             <classpath>
                 <pathelement path="${build.classes}" />
             </classpath>
@@ -454,8 +456,10 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
     </target>
 
     <target name="compile" depends="ivy-retrieve,clover,build-generated">
-        <javac srcdir="${java.src.dir}" destdir="${build.classes}" includeantruntime="false"
+        <javac destdir="${build.classes}" includeantruntime="false"
                target="${javac.target}" source="${javac.source}" debug="on">
+            <src path="${java.src.dir}"/>
+            <src path="${jute.src.dir}"/>
             <classpath refid="java.classpath"/>
             <compilerarg value="-Xlint:all"/>
             <compilerarg value="-Xlint:-path"/>
@@ -464,8 +468,10 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
 
     <target name="compile-test" depends="ivy-retrieve-test,compile">
       <mkdir dir="${test.java.classes}"/>
-      <javac srcdir="${test.src.dir}" destdir="${test.java.classes}" includeantruntime="false"
+      <javac destdir="${test.java.classes}" includeantruntime="false"
              target="${javac.target}" source="${javac.source}" debug="on">
+        <src path="${test.src.dir}"/>
+        <src path="${jute.test.src.dir}"/>
         <classpath refid="test.java.classpath"/>
       </javac>
       <javac srcdir="${systest.src.dir}" destdir="${test.java.classes}" includeantruntime="false"
@@ -576,6 +582,9 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
           <include name="org/apache/**"/>
           <exclude name="org/apache/zookeeper/server/**"/>
     	</packageset>
+        <packageset dir="${jute.src.dir}">
+          <include name="org/apache/**"/>
+        </packageset>
     	<packageset dir="${src_generated.dir}">
           <include name="org/apache/**"/>
           <exclude name="org/apache/zookeeper/proto"/>
@@ -610,6 +619,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
             <fileset file="LICENSE.txt" />
             <fileset dir="${build.classes}" excludes="**/.generated"/>
             <fileset dir="${java.src.dir}"/>
+            <fileset dir="${jute.src.dir}"/>
             <fileset dir="${src_generated.dir}" excludes="**/.generated"/>
             <manifest>
                 <attribute name="Main-Class" value="org.apache.zookeeper.server.quorum.QuorumPeerMain" />
@@ -684,6 +694,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
         <jar jarfile="${build.dir}/${final.name}-sources.jar">
             <fileset file="LICENSE.txt" />
             <fileset dir="${java.src.dir}"/>
+            <fileset dir="${jute.src.dir}"/>
             <fileset dir="${src_generated.dir}" excludes="**/.generated"/>
             <manifest>
                 <attribute name="Built-By" value="${user.name}"/>
@@ -834,6 +845,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
           <include name="zookeeper-docs/**"/>
           <include name="zookeeper-contrib/**"/>
           <include name="zookeeper-client/**"/>
+          <include name="zookeeper-jute/**"/>
         </fileset>
         <fileset file="src/pom.template"/>
       </copy>
@@ -1386,14 +1398,21 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
               <include name="**/*${test.category}Test.java"/>
               <exclude name="**/*HammerTest.java"/>
             </fileset>
+            <fileset dir="${jute.test.src.dir}">
+              <include name="**/*${test.category}Test.java" />
+            </fileset>
           </batchtest>
           <batchtest todir="${test.log.dir}" if="fulltest">
             <fileset dir="${test.src.dir}">
               <include name="**/*${test.category}Test.java"/>
             </fileset>
+            <fileset dir="${jute.test.src.dir}">
+              <include name="**/*${test.category}Test.java" />
+            </fileset>
           </batchtest>
           <batchtest todir="${test.log.dir}" if="testcase">
             <fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
+            <fileset dir="${jute.test.src.dir}" includes="**/${testcase}.java"/>
           </batchtest>
         </junit>
         <antcall target="fail.build.on.test.failure"/>
@@ -1709,6 +1728,9 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
             <fileset dir="${java.src.dir}">
                 <include name="**/*.java" />
             </fileset>
+            <fileset dir="${jute.src.dir}">
+                <include name="**/*.java" />
+            </fileset>
             <fileset dir="${src_generated.dir}">
                 <include name="**/*.java" />
             </fileset>
@@ -1994,6 +2016,8 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
          <classpath>
            <source path="${java.src.dir}"
                    output="${build.dir.eclipse-main-classes}" />
+           <source path="${jute.src.dir}"
+                   output="${build.dir.eclipse-main-classes}" />
            <source path="${src_generated.dir}"
                    output="${build.dir.eclipse-main-classes}" />
            <source path="${test.src.dir}"

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/BinaryInputArchive.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/BinaryInputArchive.java b/src/java/main/org/apache/jute/BinaryInputArchive.java
deleted file mode 100644
index 7722bff..0000000
--- a/src/java/main/org/apache/jute/BinaryInputArchive.java
+++ /dev/null
@@ -1,130 +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.jute;
-
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- *
- */
-public class BinaryInputArchive implements InputArchive {
-    static public final String UNREASONBLE_LENGTH= "Unreasonable length = ";
-    private DataInput in;
-    
-    static public BinaryInputArchive getArchive(InputStream strm) {
-        return new BinaryInputArchive(new DataInputStream(strm));
-    }
-    
-    static private class BinaryIndex implements Index {
-        private int nelems;
-        BinaryIndex(int nelems) {
-            this.nelems = nelems;
-        }
-        public boolean done() {
-            return (nelems <= 0);
-        }
-        public void incr() {
-            nelems--;
-        }
-    }
-    /** Creates a new instance of BinaryInputArchive */
-    public BinaryInputArchive(DataInput in) {
-        this.in = in;
-    }
-    
-    public byte readByte(String tag) throws IOException {
-        return in.readByte();
-    }
-    
-    public boolean readBool(String tag) throws IOException {
-        return in.readBoolean();
-    }
-    
-    public int readInt(String tag) throws IOException {
-        return in.readInt();
-    }
-    
-    public long readLong(String tag) throws IOException {
-        return in.readLong();
-    }
-    
-    public float readFloat(String tag) throws IOException {
-        return in.readFloat();
-    }
-    
-    public double readDouble(String tag) throws IOException {
-        return in.readDouble();
-    }
-    
-    public String readString(String tag) throws IOException {
-    	int len = in.readInt();
-    	if (len == -1) return null;
-        checkLength(len);
-    	byte b[] = new byte[len];
-    	in.readFully(b);
-    	return new String(b, "UTF8");
-    }
-    
-    static public final int maxBuffer = Integer.getInteger("jute.maxbuffer", 0xfffff);
-
-    public byte[] readBuffer(String tag) throws IOException {
-        int len = readInt(tag);
-        if (len == -1) return null;
-        checkLength(len);
-        byte[] arr = new byte[len];
-        in.readFully(arr);
-        return arr;
-    }
-    
-    public void readRecord(Record r, String tag) throws IOException {
-        r.deserialize(this, tag);
-    }
-    
-    public void startRecord(String tag) throws IOException {}
-    
-    public void endRecord(String tag) throws IOException {}
-    
-    public Index startVector(String tag) throws IOException {
-        int len = readInt(tag);
-        if (len == -1) {
-        	return null;
-        }
-		return new BinaryIndex(len);
-    }
-    
-    public void endVector(String tag) throws IOException {}
-    
-    public Index startMap(String tag) throws IOException {
-        return new BinaryIndex(readInt(tag));
-    }
-    
-    public void endMap(String tag) throws IOException {}
-
-    // Since this is a rough sanity check, add some padding to maxBuffer to
-    // make up for extra fields, etc. (otherwise e.g. clients may be able to
-    // write buffers larger than we can read from disk!)
-    private void checkLength(int len) throws IOException {
-        if (len < 0 || len > maxBuffer + 1024) {
-            throw new IOException(UNREASONBLE_LENGTH + len);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/BinaryOutputArchive.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/BinaryOutputArchive.java b/src/java/main/org/apache/jute/BinaryOutputArchive.java
deleted file mode 100644
index 213e203..0000000
--- a/src/java/main/org/apache/jute/BinaryOutputArchive.java
+++ /dev/null
@@ -1,146 +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.jute;
-
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.util.List;
-import java.util.TreeMap;
-
-/**
- *
- */
-public class BinaryOutputArchive implements OutputArchive {
-    private ByteBuffer bb = ByteBuffer.allocate(1024);
-
-    private DataOutput out;
-    
-    public static BinaryOutputArchive getArchive(OutputStream strm) {
-        return new BinaryOutputArchive(new DataOutputStream(strm));
-    }
-    
-    /** Creates a new instance of BinaryOutputArchive */
-    public BinaryOutputArchive(DataOutput out) {
-        this.out = out;
-    }
-    
-    public void writeByte(byte b, String tag) throws IOException {
-        out.writeByte(b);
-    }
-    
-    public void writeBool(boolean b, String tag) throws IOException {
-        out.writeBoolean(b);
-    }
-    
-    public void writeInt(int i, String tag) throws IOException {
-        out.writeInt(i);
-    }
-    
-    public void writeLong(long l, String tag) throws IOException {
-        out.writeLong(l);
-    }
-    
-    public void writeFloat(float f, String tag) throws IOException {
-        out.writeFloat(f);
-    }
-    
-    public void writeDouble(double d, String tag) throws IOException {
-        out.writeDouble(d);
-    }
-    
-    /**
-     * create our own char encoder to utf8. This is faster 
-     * then string.getbytes(UTF8).
-     * @param s the string to encode into utf8
-     * @return utf8 byte sequence.
-     */
-    final private ByteBuffer stringToByteBuffer(CharSequence s) {
-        bb.clear();
-        final int len = s.length();
-        for (int i = 0; i < len; i++) {
-            if (bb.remaining() < 3) {
-                ByteBuffer n = ByteBuffer.allocate(bb.capacity() << 1);
-                bb.flip();
-                n.put(bb);
-                bb = n;
-            }
-            char c = s.charAt(i);
-            if (c < 0x80) {
-                bb.put((byte) c);
-            } else if (c < 0x800) {
-                bb.put((byte) (0xc0 | (c >> 6)));
-                bb.put((byte) (0x80 | (c & 0x3f)));
-            } else {
-                bb.put((byte) (0xe0 | (c >> 12)));
-                bb.put((byte) (0x80 | ((c >> 6) & 0x3f)));
-                bb.put((byte) (0x80 | (c & 0x3f)));
-            }
-        }
-        bb.flip();
-        return bb;
-    }
-
-    public void writeString(String s, String tag) throws IOException {
-        if (s == null) {
-            writeInt(-1, "len");
-            return;
-        }
-        ByteBuffer bb = stringToByteBuffer(s);
-        writeInt(bb.remaining(), "len");
-        out.write(bb.array(), bb.position(), bb.limit());
-    }
-
-    public void writeBuffer(byte barr[], String tag)
-    throws IOException {
-    	if (barr == null) {
-    		out.writeInt(-1);
-    		return;
-    	}
-    	out.writeInt(barr.length);
-        out.write(barr);
-    }
-    
-    public void writeRecord(Record r, String tag) throws IOException {
-        r.serialize(this, tag);
-    }
-    
-    public void startRecord(Record r, String tag) throws IOException {}
-    
-    public void endRecord(Record r, String tag) throws IOException {}
-    
-    public void startVector(List v, String tag) throws IOException {
-    	if (v == null) {
-    		writeInt(-1, tag);
-    		return;
-    	}
-        writeInt(v.size(), tag);
-    }
-    
-    public void endVector(List v, String tag) throws IOException {}
-    
-    public void startMap(TreeMap v, String tag) throws IOException {
-        writeInt(v.size(), tag);
-    }
-    
-    public void endMap(TreeMap v, String tag) throws IOException {}
-    
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/CsvInputArchive.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/CsvInputArchive.java b/src/java/main/org/apache/jute/CsvInputArchive.java
deleted file mode 100644
index 3eb40ec..0000000
--- a/src/java/main/org/apache/jute/CsvInputArchive.java
+++ /dev/null
@@ -1,208 +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.jute;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PushbackReader;
-import java.io.UnsupportedEncodingException;
-
-/**
- *
- */
-class CsvInputArchive implements InputArchive {
-    
-    private PushbackReader stream;
-    
-    private class CsvIndex implements Index {
-        public boolean done() {
-            char c = '\0';
-            try {
-                c = (char) stream.read();
-                stream.unread(c);
-            } catch (IOException ex) {
-            }
-            return (c == '}') ? true : false;
-        }
-        public void incr() {}
-    }
-    
-    private void throwExceptionOnError(String tag) throws IOException {
-        throw new IOException("Error deserializing "+tag);
-    }
-    
-    private String readField(String tag) throws IOException {
-        try {
-            StringBuilder buf = new StringBuilder();
-            while (true) {
-                char c = (char) stream.read();
-                switch (c) {
-                    case ',':
-                        return buf.toString();
-                    case '}':
-                    case '\n':
-                    case '\r':
-                        stream.unread(c);
-                        return buf.toString();
-                    default:
-                        buf.append(c);
-                }
-            }
-        } catch (IOException ex) {
-            throw new IOException("Error reading "+tag);
-        }
-    }
-    
-    static CsvInputArchive getArchive(InputStream strm)
-    throws UnsupportedEncodingException {
-        return new CsvInputArchive(strm);
-    }
-    
-    /** Creates a new instance of CsvInputArchive */
-    public CsvInputArchive(InputStream in)
-    throws UnsupportedEncodingException {
-        stream = new PushbackReader(new InputStreamReader(in, "UTF-8"));
-    }
-    
-    public byte readByte(String tag) throws IOException {
-        return (byte) readLong(tag);
-    }
-    
-    public boolean readBool(String tag) throws IOException {
-        String sval = readField(tag);
-        return "T".equals(sval) ? true : false;
-    }
-    
-    public int readInt(String tag) throws IOException {
-        return (int) readLong(tag);
-    }
-    
-    public long readLong(String tag) throws IOException {
-        String sval = readField(tag);
-        try {
-            long lval = Long.parseLong(sval);
-            return lval;
-        } catch (NumberFormatException ex) {
-            throw new IOException("Error deserializing "+tag);
-        }
-    }
-    
-    public float readFloat(String tag) throws IOException {
-        return (float) readDouble(tag);
-    }
-    
-    public double readDouble(String tag) throws IOException {
-        String sval = readField(tag);
-        try {
-            double dval = Double.parseDouble(sval);
-            return dval;
-        } catch (NumberFormatException ex) {
-            throw new IOException("Error deserializing "+tag);
-        }
-    }
-    
-    public String readString(String tag) throws IOException {
-        String sval = readField(tag);
-        return Utils.fromCSVString(sval);
-        
-    }
-    
-    public byte[] readBuffer(String tag) throws IOException {
-        String sval = readField(tag);
-        return Utils.fromCSVBuffer(sval);
-    }
-    
-    public void readRecord(Record r, String tag) throws IOException {
-        r.deserialize(this, tag);
-    }
-    
-    public void startRecord(String tag) throws IOException {
-        if (tag != null && !"".equals(tag)) {
-            char c1 = (char) stream.read();
-            char c2 = (char) stream.read();
-            if (c1 != 's' || c2 != '{') {
-                throw new IOException("Error deserializing "+tag);
-            }
-        }
-    }
-    
-    public void endRecord(String tag) throws IOException {
-        char c = (char) stream.read();
-        if (tag == null || "".equals(tag)) {
-            if (c != '\n' && c != '\r') {
-                throw new IOException("Error deserializing record.");
-            } else {
-                return;
-            }
-        }
-        
-        if (c != '}') {
-            throw new IOException("Error deserializing "+tag);
-        }
-        c = (char) stream.read();
-        if (c != ',') {
-            stream.unread(c);
-        }
-        
-        return;
-    }
-    
-    public Index startVector(String tag) throws IOException {
-        char c1 = (char) stream.read();
-        char c2 = (char) stream.read();
-        if (c1 != 'v' || c2 != '{') {
-            throw new IOException("Error deserializing "+tag);
-        }
-        return new CsvIndex();
-    }
-    
-    public void endVector(String tag) throws IOException {
-        char c = (char) stream.read();
-        if (c != '}') {
-            throw new IOException("Error deserializing "+tag);
-        }
-        c = (char) stream.read();
-        if (c != ',') {
-            stream.unread(c);
-        }
-        return;
-    }
-    
-    public Index startMap(String tag) throws IOException {
-        char c1 = (char) stream.read();
-        char c2 = (char) stream.read();
-        if (c1 != 'm' || c2 != '{') {
-            throw new IOException("Error deserializing "+tag);
-        }
-        return new CsvIndex();
-    }
-    
-    public void endMap(String tag) throws IOException {
-        char c = (char) stream.read();
-        if (c != '}') {
-            throw new IOException("Error deserializing "+tag);
-        }
-        c = (char) stream.read();
-        if (c != ',') {
-            stream.unread(c);
-        }
-        return;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/CsvOutputArchive.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/CsvOutputArchive.java b/src/java/main/org/apache/jute/CsvOutputArchive.java
deleted file mode 100644
index f6d60d8..0000000
--- a/src/java/main/org/apache/jute/CsvOutputArchive.java
+++ /dev/null
@@ -1,150 +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.jute;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.util.List;
-import java.util.TreeMap;
-
-/**
- *
- */
-public class CsvOutputArchive implements OutputArchive {
-
-    private PrintStream stream;
-    private boolean isFirst = true;
-    
-    static CsvOutputArchive getArchive(OutputStream strm)
-    throws UnsupportedEncodingException {
-        return new CsvOutputArchive(strm);
-    }
-    
-    private void throwExceptionOnError(String tag) throws IOException {
-        if (stream.checkError()) {
-            throw new IOException("Error serializing "+tag);
-        }
-    }
- 
-    private void printCommaUnlessFirst() {
-        if (!isFirst) {
-            stream.print(",");
-        }
-        isFirst = false;
-    }
-    
-    /** Creates a new instance of CsvOutputArchive */
-    public CsvOutputArchive(OutputStream out)
-    throws UnsupportedEncodingException {
-        stream = new PrintStream(out, true, "UTF-8");
-    }
-    
-    public void writeByte(byte b, String tag) throws IOException {
-        writeLong((long)b, tag);
-    }
-    
-    public void writeBool(boolean b, String tag) throws IOException {
-        printCommaUnlessFirst();
-        String val = b ? "T" : "F";
-        stream.print(val);
-        throwExceptionOnError(tag);
-    }
-    
-    public void writeInt(int i, String tag) throws IOException {
-        writeLong((long)i, tag);
-    }
-    
-    public void writeLong(long l, String tag) throws IOException {
-        printCommaUnlessFirst();
-        stream.print(l);
-        throwExceptionOnError(tag);
-    }
-    
-    public void writeFloat(float f, String tag) throws IOException {
-        writeDouble((double)f, tag);
-    }
-    
-    public void writeDouble(double d, String tag) throws IOException {
-        printCommaUnlessFirst();
-        stream.print(d);
-        throwExceptionOnError(tag);
-    }
-    
-    public void writeString(String s, String tag) throws IOException {
-        printCommaUnlessFirst();
-        stream.print(Utils.toCSVString(s));
-        throwExceptionOnError(tag);
-    }
-    
-    public void writeBuffer(byte buf[], String tag)
-    throws IOException {
-        printCommaUnlessFirst();
-        stream.print(Utils.toCSVBuffer(buf));
-        throwExceptionOnError(tag);
-    }
-    
-    public void writeRecord(Record r, String tag) throws IOException {
-        if (r == null) {
-            return;
-        }
-        r.serialize(this, tag);
-    }
-    
-    public void startRecord(Record r, String tag) throws IOException {
-        if (tag != null && !"".equals(tag)) {
-            printCommaUnlessFirst();
-            stream.print("s{");
-            isFirst = true;
-        }
-    }
-    
-    public void endRecord(Record r, String tag) throws IOException {
-        if (tag == null || "".equals(tag)) {
-            stream.print("\n");
-            isFirst = true;
-        } else {
-            stream.print("}");
-            isFirst = false;
-        }
-    }
-    
-    public void startVector(List v, String tag) throws IOException {
-        printCommaUnlessFirst();
-        stream.print("v{");
-        isFirst = true;
-    }
-    
-    public void endVector(List v, String tag) throws IOException {
-        stream.print("}");
-        isFirst = false;
-    }
-    
-    public void startMap(TreeMap v, String tag) throws IOException {
-        printCommaUnlessFirst();
-        stream.print("m{");
-        isFirst = true;
-    }
-    
-    public void endMap(TreeMap v, String tag) throws IOException {
-        stream.print("}");
-        isFirst = false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/Index.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/Index.java b/src/java/main/org/apache/jute/Index.java
deleted file mode 100644
index 258c6b5..0000000
--- a/src/java/main/org/apache/jute/Index.java
+++ /dev/null
@@ -1,38 +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.jute;
-
-/**
- * Interface that acts as an iterator for deserializing maps.
- * The deserializer returns an instance that the record uses to
- * read vectors and maps. An example of usage is as follows:
- *
- * <code>
- * Index idx = startVector(...);
- * while (!idx.done()) {
- *   .... // read element of a vector
- *   idx.incr();
- * }
- * </code>
- *
- */
-public interface Index {
-    public boolean done();
-    public void incr();
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/InputArchive.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/InputArchive.java b/src/java/main/org/apache/jute/InputArchive.java
deleted file mode 100644
index b19ab3d..0000000
--- a/src/java/main/org/apache/jute/InputArchive.java
+++ /dev/null
@@ -1,43 +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.jute;
-
-import java.io.IOException;
-
-/**
- * Interface that all the Deserializers have to implement.
- *
- */
-public interface InputArchive {
-    public byte readByte(String tag) throws IOException;
-    public boolean readBool(String tag) throws IOException;
-    public int readInt(String tag) throws IOException;
-    public long readLong(String tag) throws IOException;
-    public float readFloat(String tag) throws IOException;
-    public double readDouble(String tag) throws IOException;
-    public String readString(String tag) throws IOException;
-    public byte[] readBuffer(String tag) throws IOException;
-    public void readRecord(Record r, String tag) throws IOException;
-    public void startRecord(String tag) throws IOException;
-    public void endRecord(String tag) throws IOException;
-    public Index startVector(String tag) throws IOException;
-    public void endVector(String tag) throws IOException;
-    public Index startMap(String tag) throws IOException;
-    public void endMap(String tag) throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/OutputArchive.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/OutputArchive.java b/src/java/main/org/apache/jute/OutputArchive.java
deleted file mode 100644
index 4e084e8..0000000
--- a/src/java/main/org/apache/jute/OutputArchive.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.jute;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.TreeMap;
-
-/**
- * Interface that alll the serializers have to implement.
- *
- */
-public interface OutputArchive {
-    public void writeByte(byte b, String tag) throws IOException;
-    public void writeBool(boolean b, String tag) throws IOException;
-    public void writeInt(int i, String tag) throws IOException;
-    public void writeLong(long l, String tag) throws IOException;
-    public void writeFloat(float f, String tag) throws IOException;
-    public void writeDouble(double d, String tag) throws IOException;
-    public void writeString(String s, String tag) throws IOException;
-    public void writeBuffer(byte buf[], String tag)
-        throws IOException;
-    public void writeRecord(Record r, String tag) throws IOException;
-    public void startRecord(Record r, String tag) throws IOException;
-    public void endRecord(Record r, String tag) throws IOException;
-    public void startVector(List v, String tag) throws IOException;
-    public void endVector(List v, String tag) throws IOException;
-    public void startMap(TreeMap v, String tag) throws IOException;
-    public void endMap(TreeMap v, String tag) throws IOException;
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/Record.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/Record.java b/src/java/main/org/apache/jute/Record.java
deleted file mode 100644
index d955280..0000000
--- a/src/java/main/org/apache/jute/Record.java
+++ /dev/null
@@ -1,35 +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.jute;
-
-import org.apache.yetus.audience.InterfaceAudience;
-
-import java.io.IOException;
-
-/**
- * Interface that is implemented by generated classes.
- * 
- */
-@InterfaceAudience.Public
-public interface Record {
-    public void serialize(OutputArchive archive, String tag)
-        throws IOException;
-    public void deserialize(InputArchive archive, String tag)
-        throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/RecordReader.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/RecordReader.java b/src/java/main/org/apache/jute/RecordReader.java
deleted file mode 100644
index 2977d3f..0000000
--- a/src/java/main/org/apache/jute/RecordReader.java
+++ /dev/null
@@ -1,93 +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.jute;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-
-/**
- * Front-end interface to deserializers. Also acts as a factory
- * for deserializers.
- *
- */
-public class RecordReader {
-    
-    private InputArchive archive;
-
-    static private HashMap archiveFactory;
-    
-    static {
-        archiveFactory = new HashMap();
-        Class[] params = { InputStream.class };
-        try {
-            archiveFactory.put("binary",
-                    BinaryInputArchive.class.getDeclaredMethod(
-                        "getArchive", params));
-            archiveFactory.put("csv",
-                    CsvInputArchive.class.getDeclaredMethod(
-                        "getArchive", params));
-            archiveFactory.put("xml",
-                    XmlInputArchive.class.getDeclaredMethod(
-                        "getArchive", params));
-        } catch (SecurityException ex) {
-            ex.printStackTrace();
-        } catch (NoSuchMethodException ex) {
-            ex.printStackTrace();
-        }
-    }
-    
-    static private InputArchive createArchive(InputStream in, String format)
-    throws IOException {
-        Method factory = (Method) archiveFactory.get(format);
-        if (factory != null) {
-            Object[] params = { in };
-            try {
-                return (InputArchive) factory.invoke(null, params);
-            } catch (IllegalArgumentException ex) {
-                ex.printStackTrace();
-            } catch (InvocationTargetException ex) {
-                ex.printStackTrace();
-            } catch (IllegalAccessException ex) {
-                ex.printStackTrace();
-            }
-        }
-        return null;
-    }
-    /**
-     * Creates a new instance of RecordReader.
-     * @param in Stream from which to deserialize a record
-     * @param format Deserialization format ("binary", "xml", or "csv")
-     */
-    public RecordReader(InputStream in, String format)
-    throws IOException {
-        archive = createArchive(in, format);
-    }
-    
-    /**
-     * Deserialize a record
-     * @param r Record to be deserialized
-     */
-    public void read(Record r) throws IOException {
-        r.deserialize(archive, "");
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/RecordWriter.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/RecordWriter.java b/src/java/main/org/apache/jute/RecordWriter.java
deleted file mode 100644
index 0adbd56..0000000
--- a/src/java/main/org/apache/jute/RecordWriter.java
+++ /dev/null
@@ -1,113 +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.jute;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-
-/**
- * Front-end for serializers. Also serves as a factory for serializers.
- *
- */
-public class RecordWriter {
-    
-    private OutputArchive archive;
-    
-    static private OutputArchive getBinaryArchive(OutputStream out) {
-        return new BinaryOutputArchive(new DataOutputStream(out));
-    }
-    
-    static private OutputArchive getCsvArchive(OutputStream out)
-    throws IOException {
-        try {
-            return new CsvOutputArchive(out);
-        } catch (UnsupportedEncodingException ex) {
-            throw new IOException("Unsupported encoding UTF-8");
-        }
-    }
-    
-    static private OutputArchive getXmlArchive(OutputStream out)
-    throws IOException {
-        return new XmlOutputArchive(out);
-    }
-
-    static HashMap constructFactory() {
-        HashMap factory = new HashMap();
-        Class[] params = { OutputStream.class };
-        try {
-            factory.put("binary",
-                    BinaryOutputArchive.class.getDeclaredMethod(
-                        "getArchive", params));
-            factory.put("csv",
-                    CsvOutputArchive.class.getDeclaredMethod(
-                        "getArchive", params));
-            factory.put("xml",
-                    XmlOutputArchive.class.getDeclaredMethod(
-                        "getArchive", params));
-        } catch (SecurityException ex) {
-            ex.printStackTrace();
-        } catch (NoSuchMethodException ex) {
-            ex.printStackTrace();
-        }
-        return factory;
-    }
-    
-    static private HashMap archiveFactory = constructFactory();
-    
-    static private OutputArchive createArchive(OutputStream out,
-            String format)
-            throws IOException {
-        Method factory = (Method) archiveFactory.get(format);
-        if (factory != null) {
-            Object[] params = { out };
-            try {
-                return (OutputArchive) factory.invoke(null, params);
-            } catch (IllegalArgumentException ex) {
-                ex.printStackTrace();
-            } catch (InvocationTargetException ex) {
-                ex.printStackTrace();
-            } catch (IllegalAccessException ex) {
-                ex.printStackTrace();
-            }
-        }
-        return null;
-    }
-    /**
-     * Creates a new instance of RecordWriter
-     * @param out Output stream where the records will be serialized
-     * @param format Serialization format ("binary", "xml", or "csv")
-     */
-    public RecordWriter(OutputStream out, String format)
-    throws IOException {
-        archive = createArchive(out, format);
-    }
-    
-    /**
-     * Serialize a record
-     * @param r record to be serialized
-     */
-    public void write(Record r) throws IOException {
-        r.serialize(archive, "");
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/Utils.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/Utils.java b/src/java/main/org/apache/jute/Utils.java
deleted file mode 100644
index 1205fa2..0000000
--- a/src/java/main/org/apache/jute/Utils.java
+++ /dev/null
@@ -1,282 +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.jute;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-/**
- * Various utility functions for Hadoop record I/O runtime.
- */
-public class Utils {
-    
-    /** Cannot create a new instance of Utils */
-    private Utils() {
-        super();
-    }
-   
-    /**
-     * equals function that actually compares two buffers.
-     *
-     * @param onearray First buffer
-     * @param twoarray Second buffer
-     * @return true if one and two contain exactly the same content, else false.
-     */
-    public static boolean bufEquals(byte onearray[], byte twoarray[] ) {
-    	if (onearray == twoarray) return true;
-        boolean ret = (onearray.length == twoarray.length);
-        if (!ret) {
-            return ret;
-        }
-        for (int idx = 0; idx < onearray.length; idx++) {
-            if (onearray[idx] != twoarray[idx]) {
-                return false;
-            }
-        }
-        return true;
-    }
-    
-    private static final char[] hexchars = { '0', '1', '2', '3', '4', '5',
-                                            '6', '7', '8', '9', 'A', 'B',
-                                            'C', 'D', 'E', 'F' };
-    /**
-     * 
-     * @param s 
-     * @return 
-     */
-    static String toXMLString(String s) {
-        if (s == null)
-            return "";
-
-        StringBuilder sb = new StringBuilder();
-        for (int idx = 0; idx < s.length(); idx++) {
-          char ch = s.charAt(idx);
-          if (ch == '<') {
-            sb.append("&lt;");
-          } else if (ch == '&') {
-            sb.append("&amp;");
-          } else if (ch == '%') {
-            sb.append("%25");
-          } else if (ch < 0x20) {
-            sb.append("%");
-            sb.append(hexchars[ch/16]);
-            sb.append(hexchars[ch%16]);
-          } else {
-            sb.append(ch);
-          }
-        }
-        return sb.toString();
-    }
-    
-    static private int h2c(char ch) {
-      if (ch >= '0' && ch <= '9') {
-        return ch - '0';
-      } else if (ch >= 'A' && ch <= 'F') {
-        return ch - 'A';
-      } else if (ch >= 'a' && ch <= 'f') {
-        return ch - 'a';
-      }
-      return 0;
-    }
-    
-    /**
-     * 
-     * @param s 
-     * @return 
-     */
-    static String fromXMLString(String s) {
-        StringBuilder sb = new StringBuilder();
-        for (int idx = 0; idx < s.length();) {
-          char ch = s.charAt(idx++);
-          if (ch == '%') {
-            char ch1 = s.charAt(idx++);
-            char ch2 = s.charAt(idx++);
-            char res = (char)(h2c(ch1)*16 + h2c(ch2));
-            sb.append(res);
-          } else {
-            sb.append(ch);
-          }
-        }
-        
-        return sb.toString();
-    }
-    
-    /**
-     * 
-     * @param s 
-     * @return 
-     */
-    static String toCSVString(String s) {
-        if (s == null)
-            return "";
-
-        StringBuilder sb = new StringBuilder(s.length()+1);
-        sb.append('\'');
-        int len = s.length();
-        for (int i = 0; i < len; i++) {
-            char c = s.charAt(i);
-            switch(c) {
-                case '\0':
-                    sb.append("%00");
-                    break;
-                case '\n':
-                    sb.append("%0A");
-                    break;
-                case '\r':
-                    sb.append("%0D");
-                    break;
-                case ',':
-                    sb.append("%2C");
-                    break;
-                case '}':
-                    sb.append("%7D");
-                    break;
-                case '%':
-                    sb.append("%25");
-                    break;
-                default:
-                    sb.append(c);
-            }
-        }
-        return sb.toString();
-    }
-    
-    /**
-     * 
-     * @param s 
-     * @throws java.io.IOException 
-     * @return 
-     */
-    static String fromCSVString(String s) throws IOException {
-        if (s.charAt(0) != '\'') {
-            throw new IOException("Error deserializing string.");
-        }
-        int len = s.length();
-        StringBuilder sb = new StringBuilder(len-1);
-        for (int i = 1; i < len; i++) {
-            char c = s.charAt(i);
-            if (c == '%') {
-                char ch1 = s.charAt(i+1);
-                char ch2 = s.charAt(i+2);
-                i += 2;
-                if (ch1 == '0' && ch2 == '0') { sb.append('\0'); }
-                else if (ch1 == '0' && ch2 == 'A') { sb.append('\n'); }
-                else if (ch1 == '0' && ch2 == 'D') { sb.append('\r'); }
-                else if (ch1 == '2' && ch2 == 'C') { sb.append(','); }
-                else if (ch1 == '7' && ch2 == 'D') { sb.append('}'); }
-                else if (ch1 == '2' && ch2 == '5') { sb.append('%'); }
-                else {throw new IOException("Error deserializing string.");}
-            } else {
-                sb.append(c);
-            }
-        }
-        return sb.toString();
-    }
-    
-    /**
-     * 
-     * @param s 
-     * @return 
-     */
-    static String toXMLBuffer(byte barr[]) {
-        if (barr == null || barr.length == 0) {
-            return "";
-        }
-        StringBuilder sb = new StringBuilder(2*barr.length);
-        for (int idx = 0; idx < barr.length; idx++) {
-            sb.append(Integer.toHexString(barr[idx]));
-        }
-        return sb.toString();
-    }
-    
-    /**
-     * 
-     * @param s 
-     * @throws java.io.IOException 
-     * @return 
-     */
-    static byte[] fromXMLBuffer(String s)
-    throws IOException {
-        ByteArrayOutputStream stream =  new ByteArrayOutputStream();
-        if (s.length() == 0) { return stream.toByteArray(); }
-        int blen = s.length()/2;
-        byte[] barr = new byte[blen];
-        for (int idx = 0; idx < blen; idx++) {
-            char c1 = s.charAt(2*idx);
-            char c2 = s.charAt(2*idx+1);
-            barr[idx] = Byte.parseByte(""+c1+c2, 16);
-        }
-        stream.write(barr);
-        return stream.toByteArray();
-    }
-    
-    /**
-     * 
-     * @param buf 
-     * @return 
-     */
-    static String toCSVBuffer(byte barr[]) {
-        if (barr == null || barr.length == 0) {
-            return "";
-        }
-        StringBuilder sb = new StringBuilder(barr.length + 1);
-        sb.append('#');
-        for(int idx = 0; idx < barr.length; idx++) {
-            sb.append(Integer.toHexString(barr[idx]));
-        }
-        return sb.toString();
-    }
-    
-    /**
-     * Converts a CSV-serialized representation of buffer to a new
-     * ByteArrayOutputStream.
-     * @param s CSV-serialized representation of buffer
-     * @throws java.io.IOException 
-     * @return Deserialized ByteArrayOutputStream
-     */
-    static byte[] fromCSVBuffer(String s)
-    throws IOException {
-        if (s.charAt(0) != '#') {
-            throw new IOException("Error deserializing buffer.");
-        }
-        ByteArrayOutputStream stream =  new ByteArrayOutputStream();
-        if (s.length() == 1) { return stream.toByteArray(); }
-        int blen = (s.length()-1)/2;
-        byte[] barr = new byte[blen];
-        for (int idx = 0; idx < blen; idx++) {
-            char c1 = s.charAt(2*idx+1);
-            char c2 = s.charAt(2*idx+2);
-            barr[idx] = Byte.parseByte(""+c1+c2, 16);
-        }
-        stream.write(barr);
-        return stream.toByteArray();
-    }
-    public static int compareBytes(byte b1[], int off1, int len1, byte b2[], int off2, int len2) {
-        int i;
-        for(i=0; i < len1 && i < len2; i++) {
-            if (b1[off1+i] != b2[off2+i]) {
-                return b1[off1+i] < b2[off2+i] ? -1 : 1;
-            }
-        }
-        if (len1 != len2) {
-            return len1 < len2 ? -1 : 1;
-        }
-        return 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/XmlInputArchive.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/XmlInputArchive.java b/src/java/main/org/apache/jute/XmlInputArchive.java
deleted file mode 100644
index 99e11d1..0000000
--- a/src/java/main/org/apache/jute/XmlInputArchive.java
+++ /dev/null
@@ -1,251 +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.jute;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-/**
- *
- */
-class XmlInputArchive implements InputArchive {
-    
-    static private class Value {
-        private String type;
-        private StringBuffer sb;
-        
-        public Value(String t) {
-            type = t;
-            sb = new StringBuffer();
-        }
-        public void addChars(char[] buf, int offset, int len) {
-            sb.append(buf, offset, len);
-        }
-        public String getValue() { return sb.toString(); }
-        public String getType() { return type; }
-    }
-    
-    private static class XMLParser extends DefaultHandler {
-        private boolean charsValid = false;
-        
-        private ArrayList<Value> valList;
-        
-        private XMLParser(ArrayList<Value> vlist) {
-            valList = vlist;
-        }
-        
-        public void startDocument() throws SAXException {}
-        
-        public void endDocument() throws SAXException {}
-        
-        public void startElement(String ns,
-                String sname,
-                String qname,
-                Attributes attrs) throws SAXException {
-            charsValid = false;
-            if ("boolean".equals(qname) ||
-                    "i4".equals(qname) ||
-                    "int".equals(qname) ||
-                    "string".equals(qname) ||
-                    "double".equals(qname) ||
-                    "ex:i1".equals(qname) ||
-                    "ex:i8".equals(qname) ||
-                    "ex:float".equals(qname)) {
-                charsValid = true;
-                valList.add(new Value(qname));
-            } else if ("struct".equals(qname) ||
-                "array".equals(qname)) {
-                valList.add(new Value(qname));
-            }
-        }
-        
-        public void endElement(String ns,
-                String sname,
-                String qname) throws SAXException {
-            charsValid = false;
-            if ("struct".equals(qname) ||
-                    "array".equals(qname)) {
-                valList.add(new Value("/"+qname));
-            }
-        }
-        
-        public void characters(char buf[], int offset, int len)
-        throws SAXException {
-            if (charsValid) {
-                Value v = valList.get(valList.size()-1);
-                v.addChars(buf, offset,len);
-            }
-        }
-        
-    }
-    
-    private class XmlIndex implements Index {
-        public boolean done() {
-            Value v = valList.get(vIdx);
-            if ("/array".equals(v.getType())) {
-                valList.set(vIdx, null);
-                vIdx++;
-                return true;
-            } else {
-                return false;
-            }
-        }
-        public void incr() {}
-    }
-    
-    private ArrayList<Value> valList;
-    private int vLen;
-    private int vIdx;
-    
-    private Value next() throws IOException {
-        if (vIdx < vLen) {
-            Value v = valList.get(vIdx);
-            valList.set(vIdx, null);
-            vIdx++;
-            return v;
-        } else {
-            throw new IOException("Error in deserialization.");
-        }
-    }
-    
-    static XmlInputArchive getArchive(InputStream strm)
-    throws ParserConfigurationException, SAXException, IOException {
-        return new XmlInputArchive(strm);
-    }
-    
-    /** Creates a new instance of BinaryInputArchive */
-    public XmlInputArchive(InputStream in)
-    throws ParserConfigurationException, SAXException, IOException {
-        valList = new ArrayList<Value>();
-        DefaultHandler handler = new XMLParser(valList);
-        SAXParserFactory factory = SAXParserFactory.newInstance();
-        SAXParser parser = factory.newSAXParser();
-        parser.parse(in, handler);
-        vLen = valList.size();
-        vIdx = 0;
-    }
-    
-    public byte readByte(String tag) throws IOException {
-        Value v = next();
-        if (!"ex:i1".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-        return Byte.parseByte(v.getValue());
-    }
-    
-    public boolean readBool(String tag) throws IOException {
-        Value v = next();
-        if (!"boolean".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-        return "1".equals(v.getValue());
-    }
-    
-    public int readInt(String tag) throws IOException {
-        Value v = next();
-        if (!"i4".equals(v.getType()) &&
-                !"int".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-        return Integer.parseInt(v.getValue());
-    }
-    
-    public long readLong(String tag) throws IOException {
-        Value v = next();
-        if (!"ex:i8".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-        return Long.parseLong(v.getValue());
-    }
-    
-    public float readFloat(String tag) throws IOException {
-        Value v = next();
-        if (!"ex:float".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-        return Float.parseFloat(v.getValue());
-    }
-    
-    public double readDouble(String tag) throws IOException {
-        Value v = next();
-        if (!"double".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-        return Double.parseDouble(v.getValue());
-    }
-    
-    public String readString(String tag) throws IOException {
-        Value v = next();
-        if (!"string".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-        return Utils.fromXMLString(v.getValue());
-    }
-    
-    public byte[] readBuffer(String tag) throws IOException {
-        Value v = next();
-        if (!"string".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-        return Utils.fromXMLBuffer(v.getValue());
-    }
-    
-    public void readRecord(Record r, String tag) throws IOException {
-        r.deserialize(this, tag);
-    }
-    
-    public void startRecord(String tag) throws IOException {
-        Value v = next();
-        if (!"struct".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-    }
-    
-    public void endRecord(String tag) throws IOException {
-        Value v = next();
-        if (!"/struct".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-    }
-    
-    public Index startVector(String tag) throws IOException {
-        Value v = next();
-        if (!"array".equals(v.getType())) {
-            throw new IOException("Error deserializing "+tag+".");
-        }
-        return new XmlIndex();
-    }
-    
-    public void endVector(String tag) throws IOException {}
-    
-    public Index startMap(String tag) throws IOException {
-        return startVector(tag);
-    }
-    
-    public void endMap(String tag) throws IOException { endVector(tag); }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/XmlOutputArchive.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/XmlOutputArchive.java b/src/java/main/org/apache/jute/XmlOutputArchive.java
deleted file mode 100644
index b65e9a0..0000000
--- a/src/java/main/org/apache/jute/XmlOutputArchive.java
+++ /dev/null
@@ -1,251 +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.jute;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.util.List;
-import java.util.Stack;
-import java.util.TreeMap;
-
-/**
- *
- */
-class XmlOutputArchive implements OutputArchive {
-
-    private PrintStream stream;
-    
-    private int indent = 0;
-    
-    private Stack<String> compoundStack;
-    
-    private void putIndent() {
-        StringBuilder sb = new StringBuilder("");
-        for (int idx = 0; idx < indent; idx++) {
-            sb.append("  ");
-        }
-        stream.print(sb.toString());
-    }
-    
-    private void addIndent() {
-        indent++;
-    }
-    
-    private void closeIndent() {
-        indent--;
-    }
-    
-    private void printBeginEnvelope(String tag) {
-        if (!compoundStack.empty()) {
-            String s = compoundStack.peek();
-            if ("struct".equals(s)) {
-                putIndent();
-                stream.print("<member>\n");
-                addIndent();
-                putIndent();
-                stream.print("<name>"+tag+"</name>\n");
-                putIndent();
-                stream.print("<value>");
-            } else if ("vector".equals(s)) {
-                stream.print("<value>");
-            } else if ("map".equals(s)) {
-                stream.print("<value>");
-            }
-        } else {
-            stream.print("<value>");
-        }
-    }
-    
-    private void printEndEnvelope(String tag) {
-        if (!compoundStack.empty()) {
-            String s = compoundStack.peek();
-            if ("struct".equals(s)) {
-                stream.print("</value>\n");
-                closeIndent();
-                putIndent();
-                stream.print("</member>\n");
-            } else if ("vector".equals(s)) {
-                stream.print("</value>\n");
-            } else if ("map".equals(s)) {
-                stream.print("</value>\n");
-            }
-        } else {
-            stream.print("</value>\n");
-        }
-    }
-    
-    private void insideVector(String tag) {
-        printBeginEnvelope(tag);
-        compoundStack.push("vector");
-    }
-    
-    private void outsideVector(String tag) throws IOException {
-        String s = compoundStack.pop();
-        if (!"vector".equals(s)) {
-            throw new IOException("Error serializing vector.");
-        }
-        printEndEnvelope(tag);
-    }
-    
-    private void insideMap(String tag) {
-        printBeginEnvelope(tag);
-        compoundStack.push("map");
-    }
-    
-    private void outsideMap(String tag) throws IOException {
-        String s = compoundStack.pop();
-        if (!"map".equals(s)) {
-            throw new IOException("Error serializing map.");
-        }
-        printEndEnvelope(tag);
-    }
-    
-    private void insideRecord(String tag) {
-        printBeginEnvelope(tag);
-        compoundStack.push("struct");
-    }
-    
-    private void outsideRecord(String tag) throws IOException {
-        String s = compoundStack.pop();
-        if (!"struct".equals(s)) {
-            throw new IOException("Error serializing record.");
-        }
-        printEndEnvelope(tag);
-    }
-    
-    static XmlOutputArchive getArchive(OutputStream strm) {
-        return new XmlOutputArchive(strm);
-    }
-    
-    /** Creates a new instance of XmlOutputArchive */
-    public XmlOutputArchive(OutputStream out) {
-        stream = new PrintStream(out);
-        compoundStack = new Stack<String>();
-    }
-    
-    public void writeByte(byte b, String tag) throws IOException {
-        printBeginEnvelope(tag);
-        stream.print("<ex:i1>");
-        stream.print(Byte.toString(b));
-        stream.print("</ex:i1>");
-        printEndEnvelope(tag);
-    }
-    
-    public void writeBool(boolean b, String tag) throws IOException {
-        printBeginEnvelope(tag);
-        stream.print("<boolean>");
-        stream.print(b ? "1" : "0");
-        stream.print("</boolean>");
-        printEndEnvelope(tag);
-    }
-    
-    public void writeInt(int i, String tag) throws IOException {
-        printBeginEnvelope(tag);
-        stream.print("<i4>");
-        stream.print(Integer.toString(i));
-        stream.print("</i4>");
-        printEndEnvelope(tag);
-    }
-    
-    public void writeLong(long l, String tag) throws IOException {
-        printBeginEnvelope(tag);
-        stream.print("<ex:i8>");
-        stream.print(Long.toString(l));
-        stream.print("</ex:i8>");
-        printEndEnvelope(tag);
-    }
-    
-    public void writeFloat(float f, String tag) throws IOException {
-        printBeginEnvelope(tag);
-        stream.print("<ex:float>");
-        stream.print(Float.toString(f));
-        stream.print("</ex:float>");
-        printEndEnvelope(tag);
-    }
-    
-    public void writeDouble(double d, String tag) throws IOException {
-        printBeginEnvelope(tag);
-        stream.print("<double>");
-        stream.print(Double.toString(d));
-        stream.print("</double>");
-        printEndEnvelope(tag);
-    }
-    
-    public void writeString(String s, String tag) throws IOException {
-        printBeginEnvelope(tag);
-        stream.print("<string>");
-        stream.print(Utils.toXMLString(s));
-        stream.print("</string>");
-        printEndEnvelope(tag);
-    }
-    
-    public void writeBuffer(byte buf[], String tag)
-    throws IOException {
-        printBeginEnvelope(tag);
-        stream.print("<string>");
-        stream.print(Utils.toXMLBuffer(buf));
-        stream.print("</string>");
-        printEndEnvelope(tag);
-    }
-    
-    public void writeRecord(Record r, String tag) throws IOException {
-        r.serialize(this, tag);
-    }
-    
-    public void startRecord(Record r, String tag) throws IOException {
-        insideRecord(tag);
-        stream.print("<struct>\n");
-        addIndent();
-    }
-    
-    public void endRecord(Record r, String tag) throws IOException {
-        closeIndent();
-        putIndent();
-        stream.print("</struct>");
-        outsideRecord(tag);
-    }
-    
-    public void startVector(List v, String tag) throws IOException {
-        insideVector(tag);
-        stream.print("<array>\n");
-        addIndent();
-    }
-    
-    public void endVector(List v, String tag) throws IOException {
-        closeIndent();
-        putIndent();
-        stream.print("</array>");
-        outsideVector(tag);
-    }
-    
-    public void startMap(TreeMap v, String tag) throws IOException {
-        insideMap(tag);
-        stream.print("<array>\n");
-        addIndent();
-    }
-    
-    public void endMap(TreeMap v, String tag) throws IOException {
-        closeIndent();
-        putIndent();
-        stream.print("</array>");
-        outsideMap(tag);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/CGenerator.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/CGenerator.java b/src/java/main/org/apache/jute/compiler/CGenerator.java
deleted file mode 100644
index 689ee21..0000000
--- a/src/java/main/org/apache/jute/compiler/CGenerator.java
+++ /dev/null
@@ -1,142 +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.jute.compiler;
-
-import java.util.ArrayList;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Iterator;
-
-/**
- * C++ Code generator front-end for Hadoop record I/O.
- */
-class CGenerator {
-    private String mName;
-    private ArrayList<JFile> mInclFiles;
-    private ArrayList<JRecord> mRecList;
-    private final File outputDirectory;
-
-    /** Creates a new instance of CppGenerator
-     *
-     * @param name possibly full pathname to the file
-     * @param ilist included files (as JFile)
-     * @param rlist List of records defined within this file
-     * @param outputDirectory
-     */
-    CGenerator(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist,
-            File outputDirectory)
-    {
-        this.outputDirectory = outputDirectory;
-        mName = (new File(name)).getName();
-        mInclFiles = ilist;
-        mRecList = rlist;
-    }
-
-    /**
-     * Generate C++ code. This method only creates the requested file(s)
-     * and spits-out file-level elements (such as include statements etc.)
-     * record-level code is generated by JRecord.
-     */
-    void genCode() throws IOException {
-        if (!outputDirectory.exists()) {
-            if (!outputDirectory.mkdirs()) {
-                throw new IOException("unable to create output directory "
-                        + outputDirectory);
-            }
-        }
-
-        FileWriter c = null;
-        FileWriter h = null;
-        try {
-            c = new FileWriter(new File(outputDirectory, mName+".c"));
-            h = new FileWriter(new File(outputDirectory, mName+".h"));
-
-            h.write("/**\n");
-            h.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
-            h.write("* or more contributor license agreements.  See the NOTICE file\n");
-            h.write("* distributed with this work for additional information\n");
-            h.write("* regarding copyright ownership.  The ASF licenses this file\n");
-            h.write("* to you under the Apache License, Version 2.0 (the\n");
-            h.write("* \"License\"); you may not use this file except in compliance\n");
-            h.write("* with the License.  You may obtain a copy of the License at\n");
-            h.write("*\n");
-            h.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
-            h.write("*\n");
-            h.write("* Unless required by applicable law or agreed to in writing, software\n");
-            h.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
-            h.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
-            h.write("* See the License for the specific language governing permissions and\n");
-            h.write("* limitations under the License.\n");
-            h.write("*/\n");
-            h.write("\n");
-
-            c.write("/**\n");
-            c.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
-            c.write("* or more contributor license agreements.  See the NOTICE file\n");
-            c.write("* distributed with this work for additional information\n");
-            c.write("* regarding copyright ownership.  The ASF licenses this file\n");
-            c.write("* to you under the Apache License, Version 2.0 (the\n");
-            c.write("* \"License\"); you may not use this file except in compliance\n");
-            c.write("* with the License.  You may obtain a copy of the License at\n");
-            c.write("*\n");
-            c.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
-            c.write("*\n");
-            c.write("* Unless required by applicable law or agreed to in writing, software\n");
-            c.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
-            c.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
-            c.write("* See the License for the specific language governing permissions and\n");
-            c.write("* limitations under the License.\n");
-            c.write("*/\n");
-            c.write("\n");
-
-            h.write("#ifndef __"+mName.toUpperCase().replace('.','_')+"__\n");
-            h.write("#define __"+mName.toUpperCase().replace('.','_')+"__\n");
-
-            h.write("#include \"recordio.h\"\n");
-            for (Iterator<JFile> i = mInclFiles.iterator(); i.hasNext();) {
-                JFile f = i.next();
-                h.write("#include \""+f.getName()+".h\"\n");
-            }
-            // required for compilation from C++
-            h.write("\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
-
-            c.write("#include <stdlib.h>\n"); // need it for calloc() & free()
-            c.write("#include \""+mName+".h\"\n\n");
-
-            for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext();) {
-                JRecord jr = i.next();
-                jr.genCCode(h, c);
-            }
-
-            h.write("\n#ifdef __cplusplus\n}\n#endif\n\n");
-            h.write("#endif //"+mName.toUpperCase().replace('.','_')+"__\n");
-        } finally {
-            try {
-                if (h != null) {
-                    h.close();
-                }
-            } finally {
-                if (c != null) {
-                    c.close();
-                }
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/CSharpGenerator.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/CSharpGenerator.java b/src/java/main/org/apache/jute/compiler/CSharpGenerator.java
deleted file mode 100644
index c28751d..0000000
--- a/src/java/main/org/apache/jute/compiler/CSharpGenerator.java
+++ /dev/null
@@ -1,53 +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.jute.compiler;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-
-public class CSharpGenerator {
-    private ArrayList<JRecord> mRecList;
-    private final File outputDirectory;
-
-    /** Creates a new instance of CSharpGenerator
-     *
-     * @param name possibly full pathname to the file
-     * @param ilist included files (as JFile)
-     * @param rlist List of records defined within this file
-     * @param outputDirectory
-     */
-    CSharpGenerator(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist,
-            File outputDirectory)
-     {
-        this.outputDirectory = outputDirectory;
-        mRecList = rlist;
-    }
-
-    /**
-     * Generate C# code. This method only creates the requested file(s)
-     * and spits-out file-level elements (such as include statements etc.)
-     * record-level code is generated by JRecord.
-     */
-    void genCode() throws IOException {
-        for (JRecord rec : mRecList) {
-            rec.genCsharpCode(outputDirectory);
-        }
-    }
-}


[6/8] zookeeper git commit: ZOOKEEPER-3080_3.4: MAVEN MIGRATION - Step 1.5 - move jute dir

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JVector.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JVector.java b/src/java/main/org/apache/jute/compiler/JVector.java
deleted file mode 100644
index 331970b..0000000
--- a/src/java/main/org/apache/jute/compiler/JVector.java
+++ /dev/null
@@ -1,153 +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.jute.compiler;
-
-/**
- *
- */
-public class JVector extends JCompType {
-    
-    static private int level = 0;
-    
-    static private String getId(String id) { return id+getLevel(); }
-    
-    static private String getLevel() { return Integer.toString(level); }
-    
-    static private void incrLevel() { level++; }
-    
-    static private void decrLevel() { level--; }
-    
-    private JType mElement;
-    
-    /** Creates a new instance of JVector */
-    public JVector(JType t) {
-        super("struct " + extractVectorName(t), " ::std::vector<"+t.getCppType()+">", "System.Collections.Generic.List<" + t.getCsharpType() + ">", "java.util.List<" + t.getJavaType() + ">", "Vector",
-                "System.Collections.Generic.List<" + t.getCsharpType() + ">", "java.util.ArrayList<" + t.getJavaType() + ">");
-        mElement = t;
-    }
-    
-    public String getSignature() {
-        return "[" + mElement.getSignature() + "]";
-    }
-    
-    public String genJavaCompareTo(String fname) {
-        return "    throw new UnsupportedOperationException(\"comparing "
-            + fname + " is unimplemented\");\n";
-    }
-    
-    public String genJavaReadWrapper(String fname, String tag, boolean decl) {
-        StringBuilder ret = new StringBuilder("");
-        if (decl) {
-            ret.append("      java.util.List "+fname+";\n");
-        }
-        ret.append("    {\n");
-        incrLevel();
-        ret.append("      Index "+getId("vidx")+" = a_.startVector(\""+tag+"\");\n");
-        ret.append("      if ("+getId("vidx")+"!= null) {");
-        ret.append("          "+fname+"=new java.util.ArrayList<"+ mElement.getJavaType() + ">();\n");
-        ret.append("          for (; !"+getId("vidx")+".done(); "+getId("vidx")+".incr()) {\n");
-        ret.append(mElement.genJavaReadWrapper(getId("e"), getId("e"), true));
-        ret.append("            "+fname+".add("+getId("e")+");\n");
-        ret.append("          }\n");
-        ret.append("      }\n");
-        ret.append("    a_.endVector(\""+tag+"\");\n");
-        decrLevel();
-        ret.append("    }\n");
-        return ret.toString();
-    }
-    
-    public String genJavaReadMethod(String fname, String tag) {
-        return genJavaReadWrapper(fname, tag, false);
-    }
-    
-    public String genJavaWriteWrapper(String fname, String tag) {
-        StringBuilder ret = new StringBuilder("    {\n");
-        incrLevel();
-        ret.append("      a_.startVector("+fname+",\""+tag+"\");\n");
-        ret.append("      if ("+fname+"!= null) {");
-        ret.append("          int "+getId("len")+" = "+fname+".size();\n");
-        ret.append("          for(int "+getId("vidx")+" = 0; "+getId("vidx")+"<"+getId("len")+"; "+getId("vidx")+"++) {\n");
-        ret.append("            "+mElement.getJavaWrapperType()+" "+getId("e")+" = ("+mElement.getJavaWrapperType()+") "+fname+".get("+getId("vidx")+");\n");
-        ret.append(mElement.genJavaWriteWrapper(getId("e"), getId("e")));
-        ret.append("          }\n");
-        ret.append("      }\n");
-        ret.append("      a_.endVector("+fname+",\""+tag+"\");\n");
-        ret.append("    }\n");
-        decrLevel();
-        return ret.toString();
-    }
-    
-    public String genJavaWriteMethod(String fname, String tag) {
-        return genJavaWriteWrapper(fname, tag);
-    }
-    
-    public JType getElementType() {
-    	return mElement;
-    }
-
-    public String genCsharpWriteWrapper(String fname, String tag) {
-        StringBuilder ret = new StringBuilder("    {\n");
-        incrLevel();
-        ret.append("      a_.StartVector("+capitalize(fname)+",\""+tag+"\");\n");
-        ret.append("      if ("+capitalize(fname)+"!= null) {");
-        ret.append("          int "+getId("len")+" = "+capitalize(fname)+".Count;\n");
-        ret.append("          for(int "+getId("vidx")+" = 0; "+getId("vidx")+"<"+getId("len")+"; "+getId("vidx")+"++) {\n");
-        ret.append("            "+mElement.getCsharpWrapperType()+" "+getId("e")+" = ("+mElement.getCsharpWrapperType()+") "+capitalize(fname)+"["+getId("vidx")+"];\n");
-        ret.append(mElement.genCsharpWriteWrapper(getId("e"), getId("e")));
-        ret.append("          }\n");
-        ret.append("      }\n");
-        ret.append("      a_.EndVector("+capitalize(fname)+",\""+tag+"\");\n");
-        ret.append("    }\n");
-        decrLevel();
-        return ret.toString();
-    }
-
-    String genCsharpWriteMethod(String fname, String tag) {
-        return genCsharpWriteWrapper(fname, tag);
-    }
-
-    public String genCsharpReadWrapper(String fname, String tag, boolean decl) {
-        StringBuilder ret = new StringBuilder("");
-        if (decl) {
-            ret.append("      System.Collections.Generic.List<" + mElement.getCsharpType()+ "> "+capitalize(fname)+";\n");
-        }
-        ret.append("    {\n");
-        incrLevel();
-        ret.append("      IIndex "+getId("vidx")+" = a_.StartVector(\""+tag+"\");\n");
-        ret.append("      if ("+getId("vidx")+"!= null) {");
-        ret.append("          "+capitalize(fname)+"=new System.Collections.Generic.List<"+ mElement.getCsharpType() + ">();\n");
-        ret.append("          for (; !"+getId("vidx")+".Done(); "+getId("vidx")+".Incr()) {\n");
-        ret.append(mElement.genCsharpReadWrapper(getId("e"), getId("e"), true));
-        ret.append("            "+capitalize(fname)+".Add("+getId("e")+");\n");
-        ret.append("          }\n");
-        ret.append("      }\n");
-        ret.append("    a_.EndVector(\""+tag+"\");\n");
-        decrLevel();
-        ret.append("    }\n");
-        return ret.toString();
-    }
-    
-    String genCsharpReadMethod(String fname, String tag) {
-        return genCsharpReadWrapper(fname, tag, false);
-    }
-
-    static public String extractVectorName(JType jvType) {
-		return JRecord.extractMethodSuffix(jvType)+"_vector";
-	}
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JavaGenerator.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JavaGenerator.java b/src/java/main/org/apache/jute/compiler/JavaGenerator.java
deleted file mode 100644
index 4078520..0000000
--- a/src/java/main/org/apache/jute/compiler/JavaGenerator.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.jute.compiler;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * Java Code generator front-end for Hadoop record I/O.
- */
-class JavaGenerator {
-    private ArrayList<JRecord> mRecList;
-    private final File outputDirectory;
-    
-    /** Creates a new instance of JavaGenerator
-     *
-     * @param name possibly full pathname to the file
-     * @param incl included files (as JFile)
-     * @param records List of records defined within this file
-     * @param outputDirectory 
-     */
-    JavaGenerator(String name, ArrayList<JFile> incl,
-            ArrayList<JRecord> records, File outputDirectory)
-    {
-        mRecList = records;
-        this.outputDirectory = outputDirectory;
-    }
-    
-    /**
-     * Generate Java code for records. This method is only a front-end to
-     * JRecord, since one file is generated for each record.
-     */
-    void genCode() throws IOException {
-        for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext(); ) {
-            JRecord rec = i.next();
-            rec.genJavaCode(outputDirectory);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/generated/ParseException.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/generated/ParseException.java b/src/java/main/org/apache/jute/compiler/generated/ParseException.java
deleted file mode 100644
index e4b0a9b..0000000
--- a/src/java/main/org/apache/jute/compiler/generated/ParseException.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.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.jute.compiler.generated;
-
-/**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
- */
-public class ParseException extends Exception {
-
-  /**
-   * This constructor is used by the method "generateParseException"
-   * in the generated parser.  Calling this constructor generates
-   * a new object of this type with the fields "currentToken",
-   * "expectedTokenSequences", and "tokenImage" set.  The boolean
-   * flag "specialConstructor" is also set to true to indicate that
-   * this constructor was used to create this object.
-   * This constructor calls its super class with the empty string
-   * to force the "toString" method of parent class "Throwable" to
-   * print the error message in the form:
-   *     ParseException: <result of getMessage>
-   */
-  public ParseException(Token currentTokenVal,
-                        int[][] expectedTokenSequencesVal,
-                        String[] tokenImageVal
-                       )
-  {
-    super("");
-    specialConstructor = true;
-    currentToken = currentTokenVal;
-    expectedTokenSequences = expectedTokenSequencesVal;
-    tokenImage = tokenImageVal;
-  }
-
-  /**
-   * The following constructors are for use by you for whatever
-   * purpose you can think of.  Constructing the exception in this
-   * manner makes the exception behave in the normal way - i.e., as
-   * documented in the class "Throwable".  The fields "errorToken",
-   * "expectedTokenSequences", and "tokenImage" do not contain
-   * relevant information.  The JavaCC generated code does not use
-   * these constructors.
-   */
-
-  public ParseException() {
-    super();
-    specialConstructor = false;
-  }
-
-  public ParseException(String message) {
-    super(message);
-    specialConstructor = false;
-  }
-
-  /**
-   * This variable determines which constructor was used to create
-   * this object and thereby affects the semantics of the
-   * "getMessage" method (see below).
-   */
-  protected boolean specialConstructor;
-
-  /**
-   * This is the last token that has been consumed successfully.  If
-   * this object has been created due to a parse error, the token
-   * followng this token will (therefore) be the first error token.
-   */
-  public Token currentToken;
-
-  /**
-   * Each entry in this array is an array of integers.  Each array
-   * of integers represents a sequence of tokens (by their ordinal
-   * values) that is expected at this point of the parse.
-   */
-  public int[][] expectedTokenSequences;
-
-  /**
-   * This is a reference to the "tokenImage" array of the generated
-   * parser within which the parse error occurred.  This array is
-   * defined in the generated ...Constants interface.
-   */
-  public String[] tokenImage;
-
-  /**
-   * This method has the standard behavior when this object has been
-   * created using the standard constructors.  Otherwise, it uses
-   * "currentToken" and "expectedTokenSequences" to generate a parse
-   * error message and returns it.  If this object has been created
-   * due to a parse error, and you do not catch it (it gets thrown
-   * from the parser), then this method is called during the printing
-   * of the final stack trace, and hence the correct error message
-   * gets displayed.
-   */
-  public String getMessage() {
-    if (!specialConstructor) {
-      return super.getMessage();
-    }
-    StringBuffer expected = new StringBuffer();
-    int maxSize = 0;
-    for (int i = 0; i < expectedTokenSequences.length; i++) {
-      if (maxSize < expectedTokenSequences[i].length) {
-        maxSize = expectedTokenSequences[i].length;
-      }
-      for (int j = 0; j < expectedTokenSequences[i].length; j++) {
-        expected.append(tokenImage[expectedTokenSequences[i][j]]).append(" ");
-      }
-      if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
-        expected.append("...");
-      }
-      expected.append(eol).append("    ");
-    }
-    String retval = "Encountered \"";
-    Token tok = currentToken.next;
-    for (int i = 0; i < maxSize; i++) {
-      if (i != 0) retval += " ";
-      if (tok.kind == 0) {
-        retval += tokenImage[0];
-        break;
-      }
-      retval += add_escapes(tok.image);
-      tok = tok.next; 
-    }
-    retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
-    retval += "." + eol;
-    if (expectedTokenSequences.length == 1) {
-      retval += "Was expecting:" + eol + "    ";
-    } else {
-      retval += "Was expecting one of:" + eol + "    ";
-    }
-    retval += expected.toString();
-    return retval;
-  }
-
-  /**
-   * The end of line string for this machine.
-   */
-  protected String eol = System.getProperty("line.separator", "\n");
- 
-  /**
-   * Used to convert raw characters to their escaped version
-   * when these raw version cannot be used as part of an ASCII
-   * string literal.
-   */
-  protected String add_escapes(String str) {
-      StringBuffer retval = new StringBuffer();
-      char ch;
-      for (int i = 0; i < str.length(); i++) {
-        switch (str.charAt(i))
-        {
-           case 0 :
-              continue;
-           case '\b':
-              retval.append("\\b");
-              continue;
-           case '\t':
-              retval.append("\\t");
-              continue;
-           case '\n':
-              retval.append("\\n");
-              continue;
-           case '\f':
-              retval.append("\\f");
-              continue;
-           case '\r':
-              retval.append("\\r");
-              continue;
-           case '\"':
-              retval.append("\\\"");
-              continue;
-           case '\'':
-              retval.append("\\\'");
-              continue;
-           case '\\':
-              retval.append("\\\\");
-              continue;
-           default:
-              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
-                 String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
-              } else {
-                 retval.append(ch);
-              }
-              continue;
-        }
-      }
-      return retval.toString();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/generated/Rcc.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/generated/Rcc.java b/src/java/main/org/apache/jute/compiler/generated/Rcc.java
deleted file mode 100644
index 1bd4878..0000000
--- a/src/java/main/org/apache/jute/compiler/generated/Rcc.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. Rcc.java */
-/**
- * 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.jute.compiler.generated;
-
-import org.apache.jute.compiler.*;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-public class Rcc implements RccConstants {
-    private static Hashtable recTab = new Hashtable();
-    private static String curDir = System.getProperty("user.dir");
-    private static String curFileName;
-    private static String curModuleName;
-
-    public static void main(String args[]) {
-        String language = "java";
-        ArrayList recFiles = new ArrayList();
-        JFile curFile=null;
-
-        for (int i=0; i<args.length; i++) {
-            if ("-l".equalsIgnoreCase(args[i]) ||
-                "--language".equalsIgnoreCase(args[i])) {
-                language = args[i+1].toLowerCase();
-                i++;
-            } else {
-                recFiles.add(args[i]);
-            }
-        }
-        if (!"c++".equals(language) && !"java".equals(language) && !"c".equals(language)) {
-            System.out.println("Cannot recognize language:" + language);
-            System.exit(1);
-        }
-        if (recFiles.size() == 0) {
-            System.out.println("No record files specified. Exiting.");
-            System.exit(1);
-        }
-        for (int i=0; i<recFiles.size(); i++) {
-            curFileName = (String) recFiles.get(i);
-            File file = new File(curFileName);
-            try {
-                curFile = parseFile(file);
-            } catch (FileNotFoundException e) {
-                System.out.println("File " + (String) recFiles.get(i) + " Not found.");
-                System.exit(1);
-            } catch (ParseException e) {
-                System.out.println(e.toString());
-                System.exit(1);
-            }
-            System.out.println((String) recFiles.get(i) + " Parsed Successfully");
-            try {
-                curFile.genCode(language, new File("."));
-            } catch (IOException e) {
-                System.out.println(e.toString());
-                System.exit(1);
-            }
-        }
-    }
-
-    public static JFile parseFile(File file) throws FileNotFoundException, ParseException {
-        curDir = file.getParent();
-        curFileName = file.getName();
-        FileReader reader = new FileReader(file);
-        try {
-            Rcc parser = new Rcc(reader);
-            recTab = new Hashtable();
-            return parser.Input();
-        } finally {
-            try {
-                reader.close();
-            } catch (IOException e) {
-            }
-        }
-    }
-
-  final public JFile Input() throws ParseException {
-    ArrayList ilist = new ArrayList();
-    ArrayList rlist = new ArrayList();
-    JFile i;
-    ArrayList l;
-    label_1:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case INCLUDE_TKN:
-        i = Include();
-          ilist.add(i);
-        break;
-      case MODULE_TKN:
-        l = Module();
-          rlist.addAll(l);
-        break;
-      default:
-        jj_la1[0] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
-      }
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case MODULE_TKN:
-      case INCLUDE_TKN:
-        ;
-        break;
-      default:
-        jj_la1[1] = jj_gen;
-        break label_1;
-      }
-    }
-    jj_consume_token(0);
-      {if (true) return new JFile(curFileName, ilist, rlist);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public JFile Include() throws ParseException {
-    String fname;
-    Token t;
-    jj_consume_token(INCLUDE_TKN);
-    t = jj_consume_token(CSTRING_TKN);
-        JFile ret = null;
-        fname = t.image.replaceAll("^\"", "").replaceAll("\"$","");
-        File file = new File(curDir, fname);
-        String tmpDir = curDir;
-        String tmpFile = curFileName;
-        curDir = file.getParent();
-        curFileName = file.getName();
-        try {
-            FileReader reader = new FileReader(file);
-            Rcc parser = new Rcc(reader);
-            try {
-                ret = parser.Input();
-                System.out.println(fname + " Parsed Successfully");
-            } catch (ParseException e) {
-                System.out.println(e.toString());
-                System.exit(1);
-            }
-            try {
-                reader.close();
-            } catch (IOException e) {
-            }
-        } catch (FileNotFoundException e) {
-            System.out.println("File " + fname +
-                " Not found.");
-            System.exit(1);
-        }
-        curDir = tmpDir;
-        curFileName = tmpFile;
-        {if (true) return ret;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public ArrayList Module() throws ParseException {
-    String mName;
-    ArrayList rlist;
-    jj_consume_token(MODULE_TKN);
-    mName = ModuleName();
-      curModuleName = mName;
-    jj_consume_token(LBRACE_TKN);
-    rlist = RecordList();
-    jj_consume_token(RBRACE_TKN);
-      {if (true) return rlist;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public String ModuleName() throws ParseException {
-    String name = "";
-    Token t;
-    t = jj_consume_token(IDENT_TKN);
-      name += t.image;
-    label_2:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case DOT_TKN:
-        ;
-        break;
-      default:
-        jj_la1[2] = jj_gen;
-        break label_2;
-      }
-      jj_consume_token(DOT_TKN);
-      t = jj_consume_token(IDENT_TKN);
-          name += "." + t.image;
-    }
-      {if (true) return name;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public ArrayList RecordList() throws ParseException {
-    ArrayList rlist = new ArrayList();
-    JRecord r;
-    label_3:
-    while (true) {
-      r = Record();
-          rlist.add(r);
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case RECORD_TKN:
-        ;
-        break;
-      default:
-        jj_la1[3] = jj_gen;
-        break label_3;
-      }
-    }
-      {if (true) return rlist;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public JRecord Record() throws ParseException {
-    String rname;
-    ArrayList flist = new ArrayList();
-    Token t;
-    JField f;
-    jj_consume_token(RECORD_TKN);
-    t = jj_consume_token(IDENT_TKN);
-      rname = t.image;
-    jj_consume_token(LBRACE_TKN);
-    label_4:
-    while (true) {
-      f = Field();
-          flist.add(f);
-      jj_consume_token(SEMICOLON_TKN);
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case BYTE_TKN:
-      case BOOLEAN_TKN:
-      case INT_TKN:
-      case LONG_TKN:
-      case FLOAT_TKN:
-      case DOUBLE_TKN:
-      case USTRING_TKN:
-      case BUFFER_TKN:
-      case VECTOR_TKN:
-      case MAP_TKN:
-      case IDENT_TKN:
-        ;
-        break;
-      default:
-        jj_la1[4] = jj_gen;
-        break label_4;
-      }
-    }
-    jj_consume_token(RBRACE_TKN);
-        String fqn = curModuleName + "." + rname;
-        JRecord r = new JRecord(fqn, flist);
-        recTab.put(fqn, r);
-        {if (true) return r;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public JField Field() throws ParseException {
-    JType jt;
-    Token t;
-    jt = Type();
-    t = jj_consume_token(IDENT_TKN);
-      {if (true) return new JField(jt, t.image);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public JType Type() throws ParseException {
-    JType jt;
-    Token t;
-    String rname;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case MAP_TKN:
-      jt = Map();
-      {if (true) return jt;}
-      break;
-    case VECTOR_TKN:
-      jt = Vector();
-      {if (true) return jt;}
-      break;
-    case BYTE_TKN:
-      jj_consume_token(BYTE_TKN);
-      {if (true) return new JByte();}
-      break;
-    case BOOLEAN_TKN:
-      jj_consume_token(BOOLEAN_TKN);
-      {if (true) return new JBoolean();}
-      break;
-    case INT_TKN:
-      jj_consume_token(INT_TKN);
-      {if (true) return new JInt();}
-      break;
-    case LONG_TKN:
-      jj_consume_token(LONG_TKN);
-      {if (true) return new JLong();}
-      break;
-    case FLOAT_TKN:
-      jj_consume_token(FLOAT_TKN);
-      {if (true) return new JFloat();}
-      break;
-    case DOUBLE_TKN:
-      jj_consume_token(DOUBLE_TKN);
-      {if (true) return new JDouble();}
-      break;
-    case USTRING_TKN:
-      jj_consume_token(USTRING_TKN);
-      {if (true) return new JString();}
-      break;
-    case BUFFER_TKN:
-      jj_consume_token(BUFFER_TKN);
-      {if (true) return new JBuffer();}
-      break;
-    case IDENT_TKN:
-      rname = ModuleName();
-        if (rname.indexOf('.', 0) < 0) {
-            rname = curModuleName + "." + rname;
-        }
-        JRecord r = (JRecord) recTab.get(rname);
-        if (r == null) {
-            System.out.println("Type " + rname + " not known. Exiting.");
-            System.exit(1);
-        }
-        {if (true) return r;}
-      break;
-    default:
-      jj_la1[5] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    throw new Error("Missing return statement in function");
-  }
-
-  final public JMap Map() throws ParseException {
-    JType jt1;
-    JType jt2;
-    jj_consume_token(MAP_TKN);
-    jj_consume_token(LT_TKN);
-    jt1 = Type();
-    jj_consume_token(COMMA_TKN);
-    jt2 = Type();
-    jj_consume_token(GT_TKN);
-      {if (true) return new JMap(jt1, jt2);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public JVector Vector() throws ParseException {
-    JType jt;
-    jj_consume_token(VECTOR_TKN);
-    jj_consume_token(LT_TKN);
-    jt = Type();
-    jj_consume_token(GT_TKN);
-      {if (true) return new JVector(jt);}
-    throw new Error("Missing return statement in function");
-  }
-
-  public RccTokenManager token_source;
-  SimpleCharStream jj_input_stream;
-  public Token token, jj_nt;
-  private int jj_ntk;
-  private int jj_gen;
-  final private int[] jj_la1 = new int[6];
-  static private int[] jj_la1_0;
-  static private int[] jj_la1_1;
-  static {
-      jj_la1_0();
-      jj_la1_1();
-   }
-   private static void jj_la1_0() {
-      jj_la1_0 = new int[] {0x2800,0x2800,0x40000000,0x1000,0xffc000,0xffc000,};
-   }
-   private static void jj_la1_1() {
-      jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x1,0x1,};
-   }
-
-  public Rcc(java.io.InputStream stream) {
-     this(stream, null);
-  }
-  public Rcc(java.io.InputStream stream, String encoding) {
-    try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
-    token_source = new RccTokenManager(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
-  }
-
-  public void ReInit(java.io.InputStream stream) {
-     ReInit(stream, null);
-  }
-  public void ReInit(java.io.InputStream stream, String encoding) {
-    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
-    token_source.ReInit(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
-  }
-
-  public Rcc(java.io.Reader stream) {
-    jj_input_stream = new SimpleCharStream(stream, 1, 1);
-    token_source = new RccTokenManager(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
-  }
-
-  public void ReInit(java.io.Reader stream) {
-    jj_input_stream.ReInit(stream, 1, 1);
-    token_source.ReInit(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
-  }
-
-  public Rcc(RccTokenManager tm) {
-    token_source = tm;
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
-  }
-
-  public void ReInit(RccTokenManager tm) {
-    token_source = tm;
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
-  }
-
-  final private Token jj_consume_token(int kind) throws ParseException {
-    Token oldToken;
-    if ((oldToken = token).next != null) token = token.next;
-    else token = token.next = token_source.getNextToken();
-    jj_ntk = -1;
-    if (token.kind == kind) {
-      jj_gen++;
-      return token;
-    }
-    token = oldToken;
-    jj_kind = kind;
-    throw generateParseException();
-  }
-
-  final public Token getNextToken() {
-    if (token.next != null) token = token.next;
-    else token = token.next = token_source.getNextToken();
-    jj_ntk = -1;
-    jj_gen++;
-    return token;
-  }
-
-  final public Token getToken(int index) {
-    Token t = token;
-    for (int i = 0; i < index; i++) {
-      if (t.next != null) t = t.next;
-      else t = t.next = token_source.getNextToken();
-    }
-    return t;
-  }
-
-  final private int jj_ntk() {
-    if ((jj_nt=token.next) == null)
-      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
-    else
-      return (jj_ntk = jj_nt.kind);
-  }
-
-  private java.util.Vector jj_expentries = new java.util.Vector();
-  private int[] jj_expentry;
-  private int jj_kind = -1;
-
-  public ParseException generateParseException() {
-    jj_expentries.removeAllElements();
-    boolean[] la1tokens = new boolean[33];
-    for (int i = 0; i < 33; i++) {
-      la1tokens[i] = false;
-    }
-    if (jj_kind >= 0) {
-      la1tokens[jj_kind] = true;
-      jj_kind = -1;
-    }
-    for (int i = 0; i < 6; i++) {
-      if (jj_la1[i] == jj_gen) {
-        for (int j = 0; j < 32; j++) {
-          if ((jj_la1_0[i] & (1<<j)) != 0) {
-            la1tokens[j] = true;
-          }
-          if ((jj_la1_1[i] & (1<<j)) != 0) {
-            la1tokens[32+j] = true;
-          }
-        }
-      }
-    }
-    for (int i = 0; i < 33; i++) {
-      if (la1tokens[i]) {
-        jj_expentry = new int[1];
-        jj_expentry[0] = i;
-        jj_expentries.addElement(jj_expentry);
-      }
-    }
-    int[][] exptokseq = new int[jj_expentries.size()][];
-    for (int i = 0; i < jj_expentries.size(); i++) {
-      exptokseq[i] = (int[])jj_expentries.elementAt(i);
-    }
-    return new ParseException(token, exptokseq, tokenImage);
-  }
-
-  final public void enable_tracing() {
-  }
-
-  final public void disable_tracing() {
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/generated/RccConstants.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/generated/RccConstants.java b/src/java/main/org/apache/jute/compiler/generated/RccConstants.java
deleted file mode 100644
index 9640efb..0000000
--- a/src/java/main/org/apache/jute/compiler/generated/RccConstants.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. RccConstants.java */
-/**
- * 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.jute.compiler.generated;
-
-public interface RccConstants {
-
-  int EOF = 0;
-  int MODULE_TKN = 11;
-  int RECORD_TKN = 12;
-  int INCLUDE_TKN = 13;
-  int BYTE_TKN = 14;
-  int BOOLEAN_TKN = 15;
-  int INT_TKN = 16;
-  int LONG_TKN = 17;
-  int FLOAT_TKN = 18;
-  int DOUBLE_TKN = 19;
-  int USTRING_TKN = 20;
-  int BUFFER_TKN = 21;
-  int VECTOR_TKN = 22;
-  int MAP_TKN = 23;
-  int LBRACE_TKN = 24;
-  int RBRACE_TKN = 25;
-  int LT_TKN = 26;
-  int GT_TKN = 27;
-  int SEMICOLON_TKN = 28;
-  int COMMA_TKN = 29;
-  int DOT_TKN = 30;
-  int CSTRING_TKN = 31;
-  int IDENT_TKN = 32;
-
-  int DEFAULT = 0;
-  int WithinOneLineComment = 1;
-  int WithinMultiLineComment = 2;
-
-  String[] tokenImage = {
-    "<EOF>",
-    "\" \"",
-    "\"\\t\"",
-    "\"\\n\"",
-    "\"\\r\"",
-    "\"//\"",
-    "<token of kind 6>",
-    "<token of kind 7>",
-    "\"/*\"",
-    "\"*/\"",
-    "<token of kind 10>",
-    "\"module\"",
-    "\"class\"",
-    "\"include\"",
-    "\"byte\"",
-    "\"boolean\"",
-    "\"int\"",
-    "\"long\"",
-    "\"float\"",
-    "\"double\"",
-    "\"ustring\"",
-    "\"buffer\"",
-    "\"vector\"",
-    "\"map\"",
-    "\"{\"",
-    "\"}\"",
-    "\"<\"",
-    "\">\"",
-    "\";\"",
-    "\",\"",
-    "\".\"",
-    "<CSTRING_TKN>",
-    "<IDENT_TKN>",
-  };
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/generated/RccTokenManager.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/generated/RccTokenManager.java b/src/java/main/org/apache/jute/compiler/generated/RccTokenManager.java
deleted file mode 100644
index 5ae99e2..0000000
--- a/src/java/main/org/apache/jute/compiler/generated/RccTokenManager.java
+++ /dev/null
@@ -1,833 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. RccTokenManager.java */
-/**
- * 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.jute.compiler.generated;
-import org.apache.jute.compiler.*;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-public class RccTokenManager implements RccConstants
-{
-  public  java.io.PrintStream debugStream = System.out;
-  public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
-private final int jjMoveStringLiteralDfa0_1()
-{
-   return jjMoveNfa_1(0, 0);
-}
-private final void jjCheckNAdd(int state)
-{
-   if (jjrounds[state] != jjround)
-   {
-      jjstateSet[jjnewStateCnt++] = state;
-      jjrounds[state] = jjround;
-   }
-}
-private final void jjAddStates(int start, int end)
-{
-   do {
-      jjstateSet[jjnewStateCnt++] = jjnextStates[start];
-   } while (start++ != end);
-}
-private final void jjCheckNAddTwoStates(int state1, int state2)
-{
-   jjCheckNAdd(state1);
-   jjCheckNAdd(state2);
-}
-private final void jjCheckNAddStates(int start, int end)
-{
-   do {
-      jjCheckNAdd(jjnextStates[start]);
-   } while (start++ != end);
-}
-private final void jjCheckNAddStates(int start)
-{
-   jjCheckNAdd(jjnextStates[start]);
-   jjCheckNAdd(jjnextStates[start + 1]);
-}
-private final int jjMoveNfa_1(int startState, int curPos)
-{
-   int[] nextStates;
-   int startsAt = 0;
-   jjnewStateCnt = 3;
-   int i = 1;
-   jjstateSet[0] = startState;
-   int j, kind = 0x7fffffff;
-   for (;;)
-   {
-      if (++jjround == 0x7fffffff)
-         ReInitRounds();
-      if (curChar < 64)
-      {
-         long l = 1L << curChar;
-         MatchLoop: do
-         {
-            switch(jjstateSet[--i])
-            {
-               case 0:
-                  if ((0x2400L & l) != 0L)
-                  {
-                     if (kind > 6)
-                        kind = 6;
-                  }
-                  if (curChar == 13)
-                     jjstateSet[jjnewStateCnt++] = 1;
-                  break;
-               case 1:
-                  if (curChar == 10 && kind > 6)
-                     kind = 6;
-                  break;
-               case 2:
-                  if (curChar == 13)
-                     jjstateSet[jjnewStateCnt++] = 1;
-                  break;
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      else if (curChar < 128)
-      {
-         long l = 1L << (curChar & 077);
-         MatchLoop: do
-         {
-            switch(jjstateSet[--i])
-            {
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      else
-      {
-         int i2 = (curChar & 0xff) >> 6;
-         long l2 = 1L << (curChar & 077);
-         MatchLoop: do
-         {
-            switch(jjstateSet[--i])
-            {
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      if (kind != 0x7fffffff)
-      {
-         jjmatchedKind = kind;
-         jjmatchedPos = curPos;
-         kind = 0x7fffffff;
-      }
-      ++curPos;
-      if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
-         return curPos;
-      try { curChar = input_stream.readChar(); }
-      catch(java.io.IOException e) { return curPos; }
-   }
-}
-private final int jjStopStringLiteralDfa_0(int pos, long active0)
-{
-   switch (pos)
-   {
-      case 0:
-         if ((active0 & 0xfff800L) != 0L)
-         {
-            jjmatchedKind = 32;
-            return 4;
-         }
-         return -1;
-      case 1:
-         if ((active0 & 0xfff800L) != 0L)
-         {
-            jjmatchedKind = 32;
-            jjmatchedPos = 1;
-            return 4;
-         }
-         return -1;
-      case 2:
-         if ((active0 & 0x7ef800L) != 0L)
-         {
-            jjmatchedKind = 32;
-            jjmatchedPos = 2;
-            return 4;
-         }
-         if ((active0 & 0x810000L) != 0L)
-            return 4;
-         return -1;
-      case 3:
-         if ((active0 & 0x24000L) != 0L)
-            return 4;
-         if ((active0 & 0x7cb800L) != 0L)
-         {
-            jjmatchedKind = 32;
-            jjmatchedPos = 3;
-            return 4;
-         }
-         return -1;
-      case 4:
-         if ((active0 & 0x41000L) != 0L)
-            return 4;
-         if ((active0 & 0x78a800L) != 0L)
-         {
-            jjmatchedKind = 32;
-            jjmatchedPos = 4;
-            return 4;
-         }
-         return -1;
-      case 5:
-         if ((active0 & 0x680800L) != 0L)
-            return 4;
-         if ((active0 & 0x10a000L) != 0L)
-         {
-            jjmatchedKind = 32;
-            jjmatchedPos = 5;
-            return 4;
-         }
-         return -1;
-      default :
-         return -1;
-   }
-}
-private final int jjStartNfa_0(int pos, long active0)
-{
-   return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
-}
-private final int jjStopAtPos(int pos, int kind)
-{
-   jjmatchedKind = kind;
-   jjmatchedPos = pos;
-   return pos + 1;
-}
-private final int jjStartNfaWithStates_0(int pos, int kind, int state)
-{
-   jjmatchedKind = kind;
-   jjmatchedPos = pos;
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) { return pos + 1; }
-   return jjMoveNfa_0(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_0()
-{
-   switch(curChar)
-   {
-      case 44:
-         return jjStopAtPos(0, 29);
-      case 46:
-         return jjStopAtPos(0, 30);
-      case 47:
-         return jjMoveStringLiteralDfa1_0(0x120L);
-      case 59:
-         return jjStopAtPos(0, 28);
-      case 60:
-         return jjStopAtPos(0, 26);
-      case 62:
-         return jjStopAtPos(0, 27);
-      case 98:
-         return jjMoveStringLiteralDfa1_0(0x20c000L);
-      case 99:
-         return jjMoveStringLiteralDfa1_0(0x1000L);
-      case 100:
-         return jjMoveStringLiteralDfa1_0(0x80000L);
-      case 102:
-         return jjMoveStringLiteralDfa1_0(0x40000L);
-      case 105:
-         return jjMoveStringLiteralDfa1_0(0x12000L);
-      case 108:
-         return jjMoveStringLiteralDfa1_0(0x20000L);
-      case 109:
-         return jjMoveStringLiteralDfa1_0(0x800800L);
-      case 117:
-         return jjMoveStringLiteralDfa1_0(0x100000L);
-      case 118:
-         return jjMoveStringLiteralDfa1_0(0x400000L);
-      case 123:
-         return jjStopAtPos(0, 24);
-      case 125:
-         return jjStopAtPos(0, 25);
-      default :
-         return jjMoveNfa_0(0, 0);
-   }
-}
-private final int jjMoveStringLiteralDfa1_0(long active0)
-{
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) {
-      jjStopStringLiteralDfa_0(0, active0);
-      return 1;
-   }
-   switch(curChar)
-   {
-      case 42:
-         if ((active0 & 0x100L) != 0L)
-            return jjStopAtPos(1, 8);
-         break;
-      case 47:
-         if ((active0 & 0x20L) != 0L)
-            return jjStopAtPos(1, 5);
-         break;
-      case 97:
-         return jjMoveStringLiteralDfa2_0(active0, 0x800000L);
-      case 101:
-         return jjMoveStringLiteralDfa2_0(active0, 0x400000L);
-      case 108:
-         return jjMoveStringLiteralDfa2_0(active0, 0x41000L);
-      case 110:
-         return jjMoveStringLiteralDfa2_0(active0, 0x12000L);
-      case 111:
-         return jjMoveStringLiteralDfa2_0(active0, 0xa8800L);
-      case 115:
-         return jjMoveStringLiteralDfa2_0(active0, 0x100000L);
-      case 117:
-         return jjMoveStringLiteralDfa2_0(active0, 0x200000L);
-      case 121:
-         return jjMoveStringLiteralDfa2_0(active0, 0x4000L);
-      default :
-         break;
-   }
-   return jjStartNfa_0(0, active0);
-}
-private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
-{
-   if (((active0 &= old0)) == 0L)
-      return jjStartNfa_0(0, old0); 
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) {
-      jjStopStringLiteralDfa_0(1, active0);
-      return 2;
-   }
-   switch(curChar)
-   {
-      case 97:
-         return jjMoveStringLiteralDfa3_0(active0, 0x1000L);
-      case 99:
-         return jjMoveStringLiteralDfa3_0(active0, 0x402000L);
-      case 100:
-         return jjMoveStringLiteralDfa3_0(active0, 0x800L);
-      case 102:
-         return jjMoveStringLiteralDfa3_0(active0, 0x200000L);
-      case 110:
-         return jjMoveStringLiteralDfa3_0(active0, 0x20000L);
-      case 111:
-         return jjMoveStringLiteralDfa3_0(active0, 0x48000L);
-      case 112:
-         if ((active0 & 0x800000L) != 0L)
-            return jjStartNfaWithStates_0(2, 23, 4);
-         break;
-      case 116:
-         if ((active0 & 0x10000L) != 0L)
-            return jjStartNfaWithStates_0(2, 16, 4);
-         return jjMoveStringLiteralDfa3_0(active0, 0x104000L);
-      case 117:
-         return jjMoveStringLiteralDfa3_0(active0, 0x80000L);
-      default :
-         break;
-   }
-   return jjStartNfa_0(1, active0);
-}
-private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
-{
-   if (((active0 &= old0)) == 0L)
-      return jjStartNfa_0(1, old0); 
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) {
-      jjStopStringLiteralDfa_0(2, active0);
-      return 3;
-   }
-   switch(curChar)
-   {
-      case 97:
-         return jjMoveStringLiteralDfa4_0(active0, 0x40000L);
-      case 98:
-         return jjMoveStringLiteralDfa4_0(active0, 0x80000L);
-      case 101:
-         if ((active0 & 0x4000L) != 0L)
-            return jjStartNfaWithStates_0(3, 14, 4);
-         break;
-      case 102:
-         return jjMoveStringLiteralDfa4_0(active0, 0x200000L);
-      case 103:
-         if ((active0 & 0x20000L) != 0L)
-            return jjStartNfaWithStates_0(3, 17, 4);
-         break;
-      case 108:
-         return jjMoveStringLiteralDfa4_0(active0, 0xa000L);
-      case 114:
-         return jjMoveStringLiteralDfa4_0(active0, 0x100000L);
-      case 115:
-         return jjMoveStringLiteralDfa4_0(active0, 0x1000L);
-      case 116:
-         return jjMoveStringLiteralDfa4_0(active0, 0x400000L);
-      case 117:
-         return jjMoveStringLiteralDfa4_0(active0, 0x800L);
-      default :
-         break;
-   }
-   return jjStartNfa_0(2, active0);
-}
-private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
-{
-   if (((active0 &= old0)) == 0L)
-      return jjStartNfa_0(2, old0); 
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) {
-      jjStopStringLiteralDfa_0(3, active0);
-      return 4;
-   }
-   switch(curChar)
-   {
-      case 101:
-         return jjMoveStringLiteralDfa5_0(active0, 0x208000L);
-      case 105:
-         return jjMoveStringLiteralDfa5_0(active0, 0x100000L);
-      case 108:
-         return jjMoveStringLiteralDfa5_0(active0, 0x80800L);
-      case 111:
-         return jjMoveStringLiteralDfa5_0(active0, 0x400000L);
-      case 115:
-         if ((active0 & 0x1000L) != 0L)
-            return jjStartNfaWithStates_0(4, 12, 4);
-         break;
-      case 116:
-         if ((active0 & 0x40000L) != 0L)
-            return jjStartNfaWithStates_0(4, 18, 4);
-         break;
-      case 117:
-         return jjMoveStringLiteralDfa5_0(active0, 0x2000L);
-      default :
-         break;
-   }
-   return jjStartNfa_0(3, active0);
-}
-private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
-{
-   if (((active0 &= old0)) == 0L)
-      return jjStartNfa_0(3, old0); 
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) {
-      jjStopStringLiteralDfa_0(4, active0);
-      return 5;
-   }
-   switch(curChar)
-   {
-      case 97:
-         return jjMoveStringLiteralDfa6_0(active0, 0x8000L);
-      case 100:
-         return jjMoveStringLiteralDfa6_0(active0, 0x2000L);
-      case 101:
-         if ((active0 & 0x800L) != 0L)
-            return jjStartNfaWithStates_0(5, 11, 4);
-         else if ((active0 & 0x80000L) != 0L)
-            return jjStartNfaWithStates_0(5, 19, 4);
-         break;
-      case 110:
-         return jjMoveStringLiteralDfa6_0(active0, 0x100000L);
-      case 114:
-         if ((active0 & 0x200000L) != 0L)
-            return jjStartNfaWithStates_0(5, 21, 4);
-         else if ((active0 & 0x400000L) != 0L)
-            return jjStartNfaWithStates_0(5, 22, 4);
-         break;
-      default :
-         break;
-   }
-   return jjStartNfa_0(4, active0);
-}
-private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
-{
-   if (((active0 &= old0)) == 0L)
-      return jjStartNfa_0(4, old0); 
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) {
-      jjStopStringLiteralDfa_0(5, active0);
-      return 6;
-   }
-   switch(curChar)
-   {
-      case 101:
-         if ((active0 & 0x2000L) != 0L)
-            return jjStartNfaWithStates_0(6, 13, 4);
-         break;
-      case 103:
-         if ((active0 & 0x100000L) != 0L)
-            return jjStartNfaWithStates_0(6, 20, 4);
-         break;
-      case 110:
-         if ((active0 & 0x8000L) != 0L)
-            return jjStartNfaWithStates_0(6, 15, 4);
-         break;
-      default :
-         break;
-   }
-   return jjStartNfa_0(5, active0);
-}
-static final long[] jjbitVec0 = {
-   0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-private final int jjMoveNfa_0(int startState, int curPos)
-{
-   int[] nextStates;
-   int startsAt = 0;
-   jjnewStateCnt = 5;
-   int i = 1;
-   jjstateSet[0] = startState;
-   int j, kind = 0x7fffffff;
-   for (;;)
-   {
-      if (++jjround == 0x7fffffff)
-         ReInitRounds();
-      if (curChar < 64)
-      {
-         long l = 1L << curChar;
-         MatchLoop: do
-         {
-            switch(jjstateSet[--i])
-            {
-               case 0:
-                  if (curChar == 34)
-                     jjCheckNAdd(1);
-                  break;
-               case 1:
-                  if ((0xfffffffbffffffffL & l) != 0L)
-                     jjCheckNAddTwoStates(1, 2);
-                  break;
-               case 2:
-                  if (curChar == 34 && kind > 31)
-                     kind = 31;
-                  break;
-               case 4:
-                  if ((0x3ff000000000000L & l) == 0L)
-                     break;
-                  if (kind > 32)
-                     kind = 32;
-                  jjstateSet[jjnewStateCnt++] = 4;
-                  break;
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      else if (curChar < 128)
-      {
-         long l = 1L << (curChar & 077);
-         MatchLoop: do
-         {
-            switch(jjstateSet[--i])
-            {
-               case 0:
-                  if ((0x7fffffe07fffffeL & l) == 0L)
-                     break;
-                  if (kind > 32)
-                     kind = 32;
-                  jjCheckNAdd(4);
-                  break;
-               case 1:
-                  jjAddStates(0, 1);
-                  break;
-               case 4:
-                  if ((0x7fffffe87fffffeL & l) == 0L)
-                     break;
-                  if (kind > 32)
-                     kind = 32;
-                  jjCheckNAdd(4);
-                  break;
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      else
-      {
-         int i2 = (curChar & 0xff) >> 6;
-         long l2 = 1L << (curChar & 077);
-         MatchLoop: do
-         {
-            switch(jjstateSet[--i])
-            {
-               case 1:
-                  if ((jjbitVec0[i2] & l2) != 0L)
-                     jjAddStates(0, 1);
-                  break;
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      if (kind != 0x7fffffff)
-      {
-         jjmatchedKind = kind;
-         jjmatchedPos = curPos;
-         kind = 0x7fffffff;
-      }
-      ++curPos;
-      if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt)))
-         return curPos;
-      try { curChar = input_stream.readChar(); }
-      catch(java.io.IOException e) { return curPos; }
-   }
-}
-private final int jjMoveStringLiteralDfa0_2()
-{
-   switch(curChar)
-   {
-      case 42:
-         return jjMoveStringLiteralDfa1_2(0x200L);
-      default :
-         return 1;
-   }
-}
-private final int jjMoveStringLiteralDfa1_2(long active0)
-{
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) {
-      return 1;
-   }
-   switch(curChar)
-   {
-      case 47:
-         if ((active0 & 0x200L) != 0L)
-            return jjStopAtPos(1, 9);
-         break;
-      default :
-         return 2;
-   }
-   return 2;
-}
-static final int[] jjnextStates = {
-   1, 2, 
-};
-public static final String[] jjstrLiteralImages = {
-"", null, null, null, null, null, null, null, null, null, null, 
-"\155\157\144\165\154\145", "\143\154\141\163\163", "\151\156\143\154\165\144\145", "\142\171\164\145", 
-"\142\157\157\154\145\141\156", "\151\156\164", "\154\157\156\147", "\146\154\157\141\164", 
-"\144\157\165\142\154\145", "\165\163\164\162\151\156\147", "\142\165\146\146\145\162", 
-"\166\145\143\164\157\162", "\155\141\160", "\173", "\175", "\74", "\76", "\73", "\54", "\56", null, null, };
-public static final String[] lexStateNames = {
-   "DEFAULT", 
-   "WithinOneLineComment", 
-   "WithinMultiLineComment", 
-};
-public static final int[] jjnewLexState = {
-   -1, -1, -1, -1, -1, 1, 0, -1, 2, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-   -1, -1, -1, -1, -1, -1, -1, -1, 
-};
-static final long[] jjtoToken = {
-   0x1fffff801L, 
-};
-static final long[] jjtoSkip = {
-   0x37eL, 
-};
-static final long[] jjtoSpecial = {
-   0x360L, 
-};
-static final long[] jjtoMore = {
-   0x480L, 
-};
-protected SimpleCharStream input_stream;
-private final int[] jjrounds = new int[5];
-private final int[] jjstateSet = new int[10];
-StringBuffer image;
-int jjimageLen;
-int lengthOfMatch;
-protected char curChar;
-public RccTokenManager(SimpleCharStream stream){
-   if (SimpleCharStream.staticFlag)
-      throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
-   input_stream = stream;
-}
-public RccTokenManager(SimpleCharStream stream, int lexState){
-   this(stream);
-   SwitchTo(lexState);
-}
-public void ReInit(SimpleCharStream stream)
-{
-   jjmatchedPos = jjnewStateCnt = 0;
-   curLexState = defaultLexState;
-   input_stream = stream;
-   ReInitRounds();
-}
-private final void ReInitRounds()
-{
-   int i;
-   jjround = 0x80000001;
-   for (i = 5; i-- > 0;)
-      jjrounds[i] = 0x80000000;
-}
-public void ReInit(SimpleCharStream stream, int lexState)
-{
-   ReInit(stream);
-   SwitchTo(lexState);
-}
-public void SwitchTo(int lexState)
-{
-   if (lexState >= 3 || lexState < 0)
-      throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
-   else
-      curLexState = lexState;
-}
-
-protected Token jjFillToken()
-{
-   Token t = Token.newToken(jjmatchedKind);
-   t.kind = jjmatchedKind;
-   String im = jjstrLiteralImages[jjmatchedKind];
-   t.image = (im == null) ? input_stream.GetImage() : im;
-   t.beginLine = input_stream.getBeginLine();
-   t.beginColumn = input_stream.getBeginColumn();
-   t.endLine = input_stream.getEndLine();
-   t.endColumn = input_stream.getEndColumn();
-   return t;
-}
-
-int curLexState = 0;
-int defaultLexState = 0;
-int jjnewStateCnt;
-int jjround;
-int jjmatchedPos;
-int jjmatchedKind;
-
-public Token getNextToken() 
-{
-  int kind;
-  Token specialToken = null;
-  Token matchedToken;
-  int curPos = 0;
-
-  EOFLoop :
-  for (;;)
-  {   
-   try   
-   {     
-      curChar = input_stream.BeginToken();
-   }     
-   catch(java.io.IOException e)
-   {        
-      jjmatchedKind = 0;
-      matchedToken = jjFillToken();
-      matchedToken.specialToken = specialToken;
-      return matchedToken;
-   }
-   image = null;
-   jjimageLen = 0;
-
-   for (;;)
-   {
-     switch(curLexState)
-     {
-       case 0:
-         try { input_stream.backup(0);
-            while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
-               curChar = input_stream.BeginToken();
-         }
-         catch (java.io.IOException e1) { continue EOFLoop; }
-         jjmatchedKind = 0x7fffffff;
-         jjmatchedPos = 0;
-         curPos = jjMoveStringLiteralDfa0_0();
-         break;
-       case 1:
-         jjmatchedKind = 0x7fffffff;
-         jjmatchedPos = 0;
-         curPos = jjMoveStringLiteralDfa0_1();
-         if (jjmatchedPos == 0 && jjmatchedKind > 7)
-         {
-            jjmatchedKind = 7;
-         }
-         break;
-       case 2:
-         jjmatchedKind = 0x7fffffff;
-         jjmatchedPos = 0;
-         curPos = jjMoveStringLiteralDfa0_2();
-         if (jjmatchedPos == 0 && jjmatchedKind > 10)
-         {
-            jjmatchedKind = 10;
-         }
-         break;
-     }
-     if (jjmatchedKind != 0x7fffffff)
-     {
-        if (jjmatchedPos + 1 < curPos)
-           input_stream.backup(curPos - jjmatchedPos - 1);
-        if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
-        {
-           matchedToken = jjFillToken();
-           matchedToken.specialToken = specialToken;
-       if (jjnewLexState[jjmatchedKind] != -1)
-         curLexState = jjnewLexState[jjmatchedKind];
-           return matchedToken;
-        }
-        else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
-        {
-           if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
-           {
-              matchedToken = jjFillToken();
-              if (specialToken == null)
-                 specialToken = matchedToken;
-              else
-              {
-                 matchedToken.specialToken = specialToken;
-                 specialToken = (specialToken.next = matchedToken);
-              }
-              SkipLexicalActions(matchedToken);
-           }
-           else 
-              SkipLexicalActions(null);
-         if (jjnewLexState[jjmatchedKind] != -1)
-           curLexState = jjnewLexState[jjmatchedKind];
-           continue EOFLoop;
-        }
-        jjimageLen += jjmatchedPos + 1;
-      if (jjnewLexState[jjmatchedKind] != -1)
-        curLexState = jjnewLexState[jjmatchedKind];
-        curPos = 0;
-        jjmatchedKind = 0x7fffffff;
-        try {
-           curChar = input_stream.readChar();
-           continue;
-        }
-        catch (java.io.IOException e1) { }
-     }
-     int error_line = input_stream.getEndLine();
-     int error_column = input_stream.getEndColumn();
-     String error_after = null;
-     boolean EOFSeen = false;
-     try { input_stream.readChar(); input_stream.backup(1); }
-     catch (java.io.IOException e1) {
-        EOFSeen = true;
-        error_after = curPos <= 1 ? "" : input_stream.GetImage();
-        if (curChar == '\n' || curChar == '\r') {
-           error_line++;
-           error_column = 0;
-        }
-        else
-           error_column++;
-     }
-     if (!EOFSeen) {
-        input_stream.backup(1);
-        error_after = curPos <= 1 ? "" : input_stream.GetImage();
-     }
-     throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
-   }
-  }
-}
-
-void SkipLexicalActions(Token matchedToken)
-{
-   switch(jjmatchedKind)
-   {
-      default :
-         break;
-   }
-}
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/generated/SimpleCharStream.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/generated/SimpleCharStream.java b/src/java/main/org/apache/jute/compiler/generated/SimpleCharStream.java
deleted file mode 100644
index e38b451..0000000
--- a/src/java/main/org/apache/jute/compiler/generated/SimpleCharStream.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.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.jute.compiler.generated;
-
-/**
- * An implementation of interface CharStream, where the stream is assumed to
- * contain only ASCII characters (without unicode processing).
- */
-
-public class SimpleCharStream
-{
-  public static final boolean staticFlag = false;
-  int bufsize;
-  int available;
-  int tokenBegin;
-  public int bufpos = -1;
-  protected int bufline[];
-  protected int bufcolumn[];
-
-  protected int column = 0;
-  protected int line = 1;
-
-  protected boolean prevCharIsCR = false;
-  protected boolean prevCharIsLF = false;
-
-  protected java.io.Reader inputStream;
-
-  protected char[] buffer;
-  protected int maxNextCharInd = 0;
-  protected int inBuf = 0;
-  protected int tabSize = 8;
-
-  protected void setTabSize(int i) { tabSize = i; }
-  protected int getTabSize(int i) { return tabSize; }
-
-
-  protected void ExpandBuff(boolean wrapAround)
-  {
-     char[] newbuffer = new char[bufsize + 2048];
-     int newbufline[] = new int[bufsize + 2048];
-     int newbufcolumn[] = new int[bufsize + 2048];
-
-     try
-     {
-        if (wrapAround)
-        {
-           System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
-           System.arraycopy(buffer, 0, newbuffer,
-                                             bufsize - tokenBegin, bufpos);
-           buffer = newbuffer;
-
-           System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
-           System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
-           bufline = newbufline;
-
-           System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
-           System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
-           bufcolumn = newbufcolumn;
-
-           maxNextCharInd = (bufpos += (bufsize - tokenBegin));
-        }
-        else
-        {
-           System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
-           buffer = newbuffer;
-
-           System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
-           bufline = newbufline;
-
-           System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
-           bufcolumn = newbufcolumn;
-
-           maxNextCharInd = (bufpos -= tokenBegin);
-        }
-     }
-     catch (Throwable t)
-     {
-        throw new Error(t.getMessage());
-     }
-
-
-     bufsize += 2048;
-     available = bufsize;
-     tokenBegin = 0;
-  }
-
-  protected void FillBuff() throws java.io.IOException
-  {
-     if (maxNextCharInd == available)
-     {
-        if (available == bufsize)
-        {
-           if (tokenBegin > 2048)
-           {
-              bufpos = maxNextCharInd = 0;
-              available = tokenBegin;
-           }
-           else if (tokenBegin < 0)
-              bufpos = maxNextCharInd = 0;
-           else
-              ExpandBuff(false);
-        }
-        else if (available > tokenBegin)
-           available = bufsize;
-        else if ((tokenBegin - available) < 2048)
-           ExpandBuff(true);
-        else
-           available = tokenBegin;
-     }
-
-     int i;
-     try {
-        if ((i = inputStream.read(buffer, maxNextCharInd,
-                                    available - maxNextCharInd)) == -1)
-        {
-           inputStream.close();
-           throw new java.io.IOException();
-        }
-        else
-           maxNextCharInd += i;
-        return;
-     }
-     catch(java.io.IOException e) {
-        --bufpos;
-        backup(0);
-        if (tokenBegin == -1)
-           tokenBegin = bufpos;
-        throw e;
-     }
-  }
-
-  public char BeginToken() throws java.io.IOException
-  {
-     tokenBegin = -1;
-     char c = readChar();
-     tokenBegin = bufpos;
-
-     return c;
-  }
-
-  protected void UpdateLineColumn(char c)
-  {
-     column++;
-
-     if (prevCharIsLF)
-     {
-        prevCharIsLF = false;
-        line += (column = 1);
-     }
-     else if (prevCharIsCR)
-     {
-        prevCharIsCR = false;
-        if (c == '\n')
-        {
-           prevCharIsLF = true;
-        }
-        else
-           line += (column = 1);
-     }
-
-     switch (c)
-     {
-        case '\r' :
-           prevCharIsCR = true;
-           break;
-        case '\n' :
-           prevCharIsLF = true;
-           break;
-        case '\t' :
-           column--;
-           column += (tabSize - (column % tabSize));
-           break;
-        default :
-           break;
-     }
-
-     bufline[bufpos] = line;
-     bufcolumn[bufpos] = column;
-  }
-
-  public char readChar() throws java.io.IOException
-  {
-     if (inBuf > 0)
-     {
-        --inBuf;
-
-        if (++bufpos == bufsize)
-           bufpos = 0;
-
-        return buffer[bufpos];
-     }
-
-     if (++bufpos >= maxNextCharInd)
-        FillBuff();
-
-     char c = buffer[bufpos];
-
-     UpdateLineColumn(c);
-     return (c);
-  }
-
-  /**
-   * @deprecated 
-   * @see #getEndColumn
-   */
-
-  public int getColumn() {
-     return bufcolumn[bufpos];
-  }
-
-  /**
-   * @deprecated 
-   * @see #getEndLine
-   */
-
-  public int getLine() {
-     return bufline[bufpos];
-  }
-
-  public int getEndColumn() {
-     return bufcolumn[bufpos];
-  }
-
-  public int getEndLine() {
-     return bufline[bufpos];
-  }
-
-  public int getBeginColumn() {
-     return bufcolumn[tokenBegin];
-  }
-
-  public int getBeginLine() {
-     return bufline[tokenBegin];
-  }
-
-  public void backup(int amount) {
-
-    inBuf += amount;
-    if ((bufpos -= amount) < 0)
-       bufpos += bufsize;
-  }
-
-  public SimpleCharStream(java.io.Reader dstream, int startline,
-  int startcolumn, int buffersize)
-  {
-    inputStream = dstream;
-    line = startline;
-    column = startcolumn - 1;
-
-    available = bufsize = buffersize;
-    buffer = new char[buffersize];
-    bufline = new int[buffersize];
-    bufcolumn = new int[buffersize];
-  }
-
-  public SimpleCharStream(java.io.Reader dstream, int startline,
-                          int startcolumn)
-  {
-     this(dstream, startline, startcolumn, 4096);
-  }
-
-  public SimpleCharStream(java.io.Reader dstream)
-  {
-     this(dstream, 1, 1, 4096);
-  }
-  public void ReInit(java.io.Reader dstream, int startline,
-  int startcolumn, int buffersize)
-  {
-    inputStream = dstream;
-    line = startline;
-    column = startcolumn - 1;
-
-    if (buffer == null || buffersize != buffer.length)
-    {
-      available = bufsize = buffersize;
-      buffer = new char[buffersize];
-      bufline = new int[buffersize];
-      bufcolumn = new int[buffersize];
-    }
-    prevCharIsLF = prevCharIsCR = false;
-    tokenBegin = inBuf = maxNextCharInd = 0;
-    bufpos = -1;
-  }
-
-  public void ReInit(java.io.Reader dstream, int startline,
-                     int startcolumn)
-  {
-     ReInit(dstream, startline, startcolumn, 4096);
-  }
-
-  public void ReInit(java.io.Reader dstream)
-  {
-     ReInit(dstream, 1, 1, 4096);
-  }
-  public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
-  int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
-  {
-     this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
-  }
-
-  public SimpleCharStream(java.io.InputStream dstream, int startline,
-  int startcolumn, int buffersize)
-  {
-     this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
-  }
-
-  public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
-                          int startcolumn) throws java.io.UnsupportedEncodingException
-  {
-     this(dstream, encoding, startline, startcolumn, 4096);
-  }
-
-  public SimpleCharStream(java.io.InputStream dstream, int startline,
-                          int startcolumn)
-  {
-     this(dstream, startline, startcolumn, 4096);
-  }
-
-  public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
-  {
-     this(dstream, encoding, 1, 1, 4096);
-  }
-
-  public SimpleCharStream(java.io.InputStream dstream)
-  {
-     this(dstream, 1, 1, 4096);
-  }
-
-  public void ReInit(java.io.InputStream dstream, String encoding, int startline,
-                          int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
-  {
-     ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
-  }
-
-  public void ReInit(java.io.InputStream dstream, int startline,
-                          int startcolumn, int buffersize)
-  {
-     ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
-  }
-
-  public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
-  {
-     ReInit(dstream, encoding, 1, 1, 4096);
-  }
-
-  public void ReInit(java.io.InputStream dstream)
-  {
-     ReInit(dstream, 1, 1, 4096);
-  }
-  public void ReInit(java.io.InputStream dstream, String encoding, int startline,
-                     int startcolumn) throws java.io.UnsupportedEncodingException
-  {
-     ReInit(dstream, encoding, startline, startcolumn, 4096);
-  }
-  public void ReInit(java.io.InputStream dstream, int startline,
-                     int startcolumn)
-  {
-     ReInit(dstream, startline, startcolumn, 4096);
-  }
-  public String GetImage()
-  {
-     if (bufpos >= tokenBegin)
-        return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
-     else
-        return new String(buffer, tokenBegin, bufsize - tokenBegin) +
-                              new String(buffer, 0, bufpos + 1);
-  }
-
-  public char[] GetSuffix(int len)
-  {
-     char[] ret = new char[len];
-
-     if ((bufpos + 1) >= len)
-        System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
-     else
-     {
-        System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
-                                                          len - bufpos - 1);
-        System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
-     }
-
-     return ret;
-  }
-
-  public void Done()
-  {
-     buffer = null;
-     bufline = null;
-     bufcolumn = null;
-  }
-
-  /**
-   * Method to adjust line and column numbers for the start of a token.
-   */
-  public void adjustBeginLineColumn(int newLine, int newCol)
-  {
-     int start = tokenBegin;
-     int len;
-
-     if (bufpos >= tokenBegin)
-     {
-        len = bufpos - tokenBegin + inBuf + 1;
-     }
-     else
-     {
-        len = bufsize - tokenBegin + bufpos + 1 + inBuf;
-     }
-
-     int i = 0, j = 0, k = 0;
-     int nextColDiff = 0, columnDiff = 0;
-
-     while (i < len &&
-            bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
-     {
-        bufline[j] = newLine;
-        nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
-        bufcolumn[j] = newCol + columnDiff;
-        columnDiff = nextColDiff;
-        i++;
-     } 
-
-     if (i < len)
-     {
-        bufline[j] = newLine++;
-        bufcolumn[j] = newCol + columnDiff;
-
-        while (i++ < len)
-        {
-           if (bufline[j = start % bufsize] != bufline[++start % bufsize])
-              bufline[j] = newLine++;
-           else
-              bufline[j] = newLine;
-        }
-     }
-
-     line = bufline[j];
-     column = bufcolumn[j];
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/generated/Token.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/generated/Token.java b/src/java/main/org/apache/jute/compiler/generated/Token.java
deleted file mode 100644
index 3e7018b..0000000
--- a/src/java/main/org/apache/jute/compiler/generated/Token.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.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.jute.compiler.generated;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token {
-
-  /**
-   * An integer that describes the kind of this token.  This numbering
-   * system is determined by JavaCCParser, and a table of these numbers is
-   * stored in the file ...Constants.java.
-   */
-  public int kind;
-
-  /**
-   * beginLine and beginColumn describe the position of the first character
-   * of this token; endLine and endColumn describe the position of the
-   * last character of this token.
-   */
-  public int beginLine, beginColumn, endLine, endColumn;
-
-  /**
-   * The string image of the token.
-   */
-  public String image;
-
-  /**
-   * A reference to the next regular (non-special) token from the input
-   * stream.  If this is the last token from the input stream, or if the
-   * token manager has not read tokens beyond this one, this field is
-   * set to null.  This is true only if this token is also a regular
-   * token.  Otherwise, see below for a description of the contents of
-   * this field.
-   */
-  public Token next;
-
-  /**
-   * This field is used to access special tokens that occur prior to this
-   * token, but after the immediately preceding regular (non-special) token.
-   * If there are no such special tokens, this field is set to null.
-   * When there are more than one such special token, this field refers
-   * to the last of these special tokens, which in turn refers to the next
-   * previous special token through its specialToken field, and so on
-   * until the first special token (whose specialToken field is null).
-   * The next fields of special tokens refer to other special tokens that
-   * immediately follow it (without an intervening regular token).  If there
-   * is no such token, this field is null.
-   */
-  public Token specialToken;
-
-  /**
-   * Returns the image.
-   */
-  public String toString()
-  {
-     return image;
-  }
-
-  /**
-   * Returns a new Token object, by default. However, if you want, you
-   * can create and return subclass objects based on the value of ofKind.
-   * Simply add the cases to the switch for all those special cases.
-   * For example, if you have a subclass of Token called IDToken that
-   * you want to create if ofKind is ID, simlpy add something like :
-   *
-   *    case MyParserConstants.ID : return new IDToken();
-   *
-   * to the following switch statement. Then you can cast matchedToken
-   * variable to the appropriate type and use it in your lexical actions.
-   */
-  public static final Token newToken(int ofKind)
-  {
-     switch(ofKind)
-     {
-       default : return new Token();
-     }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/generated/TokenMgrError.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/generated/TokenMgrError.java b/src/java/main/org/apache/jute/compiler/generated/TokenMgrError.java
deleted file mode 100644
index e246962..0000000
--- a/src/java/main/org/apache/jute/compiler/generated/TokenMgrError.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.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.jute.compiler.generated;
-
-public class TokenMgrError extends Error
-{
-   /*
-    * Ordinals for various reasons why an Error of this type can be thrown.
-    */
-
-   /**
-    * Lexical error occured.
-    */
-   static final int LEXICAL_ERROR = 0;
-
-   /**
-    * An attempt wass made to create a second instance of a static token manager.
-    */
-   static final int STATIC_LEXER_ERROR = 1;
-
-   /**
-    * Tried to change to an invalid lexical state.
-    */
-   static final int INVALID_LEXICAL_STATE = 2;
-
-   /**
-    * Detected (and bailed out of) an infinite loop in the token manager.
-    */
-   static final int LOOP_DETECTED = 3;
-
-   /**
-    * Indicates the reason why the exception is thrown. It will have
-    * one of the above 4 values.
-    */
-   int errorCode;
-
-   /**
-    * Replaces unprintable characters by their espaced (or unicode escaped)
-    * equivalents in the given string
-    */
-   protected static final String addEscapes(String str) {
-      StringBuffer retval = new StringBuffer();
-      char ch;
-      for (int i = 0; i < str.length(); i++) {
-        switch (str.charAt(i))
-        {
-           case 0 :
-              continue;
-           case '\b':
-              retval.append("\\b");
-              continue;
-           case '\t':
-              retval.append("\\t");
-              continue;
-           case '\n':
-              retval.append("\\n");
-              continue;
-           case '\f':
-              retval.append("\\f");
-              continue;
-           case '\r':
-              retval.append("\\r");
-              continue;
-           case '\"':
-              retval.append("\\\"");
-              continue;
-           case '\'':
-              retval.append("\\\'");
-              continue;
-           case '\\':
-              retval.append("\\\\");
-              continue;
-           default:
-              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
-                 String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
-              } else {
-                 retval.append(ch);
-              }
-              continue;
-        }
-      }
-      return retval.toString();
-   }
-
-   /**
-    * Returns a detailed message for the Error when it is thrown by the
-    * token manager to indicate a lexical error.
-    * Parameters : 
-    *    EOFSeen     : indicates if EOF caused the lexicl error
-    *    curLexState : lexical state in which this error occured
-    *    errorLine   : line number when the error occured
-    *    errorColumn : column number when the error occured
-    *    errorAfter  : prefix that was seen before this error occured
-    *    curchar     : the offending character
-    * Note: You can customize the lexical error message by modifying this method.
-    */
-   protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
-      return("Lexical error at line " +
-           errorLine + ", column " +
-           errorColumn + ".  Encountered: " +
-           (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
-           "after : \"" + addEscapes(errorAfter) + "\"");
-   }
-
-   /**
-    * You can also modify the body of this method to customize your error messages.
-    * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
-    * of end-users concern, so you can return something like : 
-    *
-    *     "Internal Error : Please file a bug report .... "
-    *
-    * from this method for such cases in the release version of your parser.
-    */
-   public String getMessage() {
-      return super.getMessage();
-   }
-
-   /*
-    * Constructors of various flavors follow.
-    */
-
-   public TokenMgrError() {
-   }
-
-   public TokenMgrError(String message, int reason) {
-      super(message);
-      errorCode = reason;
-   }
-
-   public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
-      this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
-   }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/generated/package.html
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/generated/package.html b/src/java/main/org/apache/jute/compiler/generated/package.html
deleted file mode 100644
index 8ef8a8c..0000000
--- a/src/java/main/org/apache/jute/compiler/generated/package.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<!--
-   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.
--->
-
-<html>
-  <head>
-    <title>Hadoop Record Compiler: Parser</title>
-  </head>
-  <body>
-  This package contains code generated by JavaCC from the
-  Hadoop record syntax file rcc.jj. For details about the
-  record file syntax please @see org.apache.hadoop.record.
-  </body>
-</html>


[4/8] zookeeper git commit: ZOOKEEPER-3080_3.4: MAVEN MIGRATION - Step 1.5 - move jute dir

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/Utils.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/Utils.java b/zookeeper-jute/src/main/java/org/apache/jute/Utils.java
new file mode 100644
index 0000000..1205fa2
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/Utils.java
@@ -0,0 +1,282 @@
+/**
+ * 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.jute;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+/**
+ * Various utility functions for Hadoop record I/O runtime.
+ */
+public class Utils {
+    
+    /** Cannot create a new instance of Utils */
+    private Utils() {
+        super();
+    }
+   
+    /**
+     * equals function that actually compares two buffers.
+     *
+     * @param onearray First buffer
+     * @param twoarray Second buffer
+     * @return true if one and two contain exactly the same content, else false.
+     */
+    public static boolean bufEquals(byte onearray[], byte twoarray[] ) {
+    	if (onearray == twoarray) return true;
+        boolean ret = (onearray.length == twoarray.length);
+        if (!ret) {
+            return ret;
+        }
+        for (int idx = 0; idx < onearray.length; idx++) {
+            if (onearray[idx] != twoarray[idx]) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    private static final char[] hexchars = { '0', '1', '2', '3', '4', '5',
+                                            '6', '7', '8', '9', 'A', 'B',
+                                            'C', 'D', 'E', 'F' };
+    /**
+     * 
+     * @param s 
+     * @return 
+     */
+    static String toXMLString(String s) {
+        if (s == null)
+            return "";
+
+        StringBuilder sb = new StringBuilder();
+        for (int idx = 0; idx < s.length(); idx++) {
+          char ch = s.charAt(idx);
+          if (ch == '<') {
+            sb.append("&lt;");
+          } else if (ch == '&') {
+            sb.append("&amp;");
+          } else if (ch == '%') {
+            sb.append("%25");
+          } else if (ch < 0x20) {
+            sb.append("%");
+            sb.append(hexchars[ch/16]);
+            sb.append(hexchars[ch%16]);
+          } else {
+            sb.append(ch);
+          }
+        }
+        return sb.toString();
+    }
+    
+    static private int h2c(char ch) {
+      if (ch >= '0' && ch <= '9') {
+        return ch - '0';
+      } else if (ch >= 'A' && ch <= 'F') {
+        return ch - 'A';
+      } else if (ch >= 'a' && ch <= 'f') {
+        return ch - 'a';
+      }
+      return 0;
+    }
+    
+    /**
+     * 
+     * @param s 
+     * @return 
+     */
+    static String fromXMLString(String s) {
+        StringBuilder sb = new StringBuilder();
+        for (int idx = 0; idx < s.length();) {
+          char ch = s.charAt(idx++);
+          if (ch == '%') {
+            char ch1 = s.charAt(idx++);
+            char ch2 = s.charAt(idx++);
+            char res = (char)(h2c(ch1)*16 + h2c(ch2));
+            sb.append(res);
+          } else {
+            sb.append(ch);
+          }
+        }
+        
+        return sb.toString();
+    }
+    
+    /**
+     * 
+     * @param s 
+     * @return 
+     */
+    static String toCSVString(String s) {
+        if (s == null)
+            return "";
+
+        StringBuilder sb = new StringBuilder(s.length()+1);
+        sb.append('\'');
+        int len = s.length();
+        for (int i = 0; i < len; i++) {
+            char c = s.charAt(i);
+            switch(c) {
+                case '\0':
+                    sb.append("%00");
+                    break;
+                case '\n':
+                    sb.append("%0A");
+                    break;
+                case '\r':
+                    sb.append("%0D");
+                    break;
+                case ',':
+                    sb.append("%2C");
+                    break;
+                case '}':
+                    sb.append("%7D");
+                    break;
+                case '%':
+                    sb.append("%25");
+                    break;
+                default:
+                    sb.append(c);
+            }
+        }
+        return sb.toString();
+    }
+    
+    /**
+     * 
+     * @param s 
+     * @throws java.io.IOException 
+     * @return 
+     */
+    static String fromCSVString(String s) throws IOException {
+        if (s.charAt(0) != '\'') {
+            throw new IOException("Error deserializing string.");
+        }
+        int len = s.length();
+        StringBuilder sb = new StringBuilder(len-1);
+        for (int i = 1; i < len; i++) {
+            char c = s.charAt(i);
+            if (c == '%') {
+                char ch1 = s.charAt(i+1);
+                char ch2 = s.charAt(i+2);
+                i += 2;
+                if (ch1 == '0' && ch2 == '0') { sb.append('\0'); }
+                else if (ch1 == '0' && ch2 == 'A') { sb.append('\n'); }
+                else if (ch1 == '0' && ch2 == 'D') { sb.append('\r'); }
+                else if (ch1 == '2' && ch2 == 'C') { sb.append(','); }
+                else if (ch1 == '7' && ch2 == 'D') { sb.append('}'); }
+                else if (ch1 == '2' && ch2 == '5') { sb.append('%'); }
+                else {throw new IOException("Error deserializing string.");}
+            } else {
+                sb.append(c);
+            }
+        }
+        return sb.toString();
+    }
+    
+    /**
+     * 
+     * @param s 
+     * @return 
+     */
+    static String toXMLBuffer(byte barr[]) {
+        if (barr == null || barr.length == 0) {
+            return "";
+        }
+        StringBuilder sb = new StringBuilder(2*barr.length);
+        for (int idx = 0; idx < barr.length; idx++) {
+            sb.append(Integer.toHexString(barr[idx]));
+        }
+        return sb.toString();
+    }
+    
+    /**
+     * 
+     * @param s 
+     * @throws java.io.IOException 
+     * @return 
+     */
+    static byte[] fromXMLBuffer(String s)
+    throws IOException {
+        ByteArrayOutputStream stream =  new ByteArrayOutputStream();
+        if (s.length() == 0) { return stream.toByteArray(); }
+        int blen = s.length()/2;
+        byte[] barr = new byte[blen];
+        for (int idx = 0; idx < blen; idx++) {
+            char c1 = s.charAt(2*idx);
+            char c2 = s.charAt(2*idx+1);
+            barr[idx] = Byte.parseByte(""+c1+c2, 16);
+        }
+        stream.write(barr);
+        return stream.toByteArray();
+    }
+    
+    /**
+     * 
+     * @param buf 
+     * @return 
+     */
+    static String toCSVBuffer(byte barr[]) {
+        if (barr == null || barr.length == 0) {
+            return "";
+        }
+        StringBuilder sb = new StringBuilder(barr.length + 1);
+        sb.append('#');
+        for(int idx = 0; idx < barr.length; idx++) {
+            sb.append(Integer.toHexString(barr[idx]));
+        }
+        return sb.toString();
+    }
+    
+    /**
+     * Converts a CSV-serialized representation of buffer to a new
+     * ByteArrayOutputStream.
+     * @param s CSV-serialized representation of buffer
+     * @throws java.io.IOException 
+     * @return Deserialized ByteArrayOutputStream
+     */
+    static byte[] fromCSVBuffer(String s)
+    throws IOException {
+        if (s.charAt(0) != '#') {
+            throw new IOException("Error deserializing buffer.");
+        }
+        ByteArrayOutputStream stream =  new ByteArrayOutputStream();
+        if (s.length() == 1) { return stream.toByteArray(); }
+        int blen = (s.length()-1)/2;
+        byte[] barr = new byte[blen];
+        for (int idx = 0; idx < blen; idx++) {
+            char c1 = s.charAt(2*idx+1);
+            char c2 = s.charAt(2*idx+2);
+            barr[idx] = Byte.parseByte(""+c1+c2, 16);
+        }
+        stream.write(barr);
+        return stream.toByteArray();
+    }
+    public static int compareBytes(byte b1[], int off1, int len1, byte b2[], int off2, int len2) {
+        int i;
+        for(i=0; i < len1 && i < len2; i++) {
+            if (b1[off1+i] != b2[off2+i]) {
+                return b1[off1+i] < b2[off2+i] ? -1 : 1;
+            }
+        }
+        if (len1 != len2) {
+            return len1 < len2 ? -1 : 1;
+        }
+        return 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/XmlInputArchive.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/XmlInputArchive.java b/zookeeper-jute/src/main/java/org/apache/jute/XmlInputArchive.java
new file mode 100644
index 0000000..99e11d1
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/XmlInputArchive.java
@@ -0,0 +1,251 @@
+/**
+ * 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.jute;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+/**
+ *
+ */
+class XmlInputArchive implements InputArchive {
+    
+    static private class Value {
+        private String type;
+        private StringBuffer sb;
+        
+        public Value(String t) {
+            type = t;
+            sb = new StringBuffer();
+        }
+        public void addChars(char[] buf, int offset, int len) {
+            sb.append(buf, offset, len);
+        }
+        public String getValue() { return sb.toString(); }
+        public String getType() { return type; }
+    }
+    
+    private static class XMLParser extends DefaultHandler {
+        private boolean charsValid = false;
+        
+        private ArrayList<Value> valList;
+        
+        private XMLParser(ArrayList<Value> vlist) {
+            valList = vlist;
+        }
+        
+        public void startDocument() throws SAXException {}
+        
+        public void endDocument() throws SAXException {}
+        
+        public void startElement(String ns,
+                String sname,
+                String qname,
+                Attributes attrs) throws SAXException {
+            charsValid = false;
+            if ("boolean".equals(qname) ||
+                    "i4".equals(qname) ||
+                    "int".equals(qname) ||
+                    "string".equals(qname) ||
+                    "double".equals(qname) ||
+                    "ex:i1".equals(qname) ||
+                    "ex:i8".equals(qname) ||
+                    "ex:float".equals(qname)) {
+                charsValid = true;
+                valList.add(new Value(qname));
+            } else if ("struct".equals(qname) ||
+                "array".equals(qname)) {
+                valList.add(new Value(qname));
+            }
+        }
+        
+        public void endElement(String ns,
+                String sname,
+                String qname) throws SAXException {
+            charsValid = false;
+            if ("struct".equals(qname) ||
+                    "array".equals(qname)) {
+                valList.add(new Value("/"+qname));
+            }
+        }
+        
+        public void characters(char buf[], int offset, int len)
+        throws SAXException {
+            if (charsValid) {
+                Value v = valList.get(valList.size()-1);
+                v.addChars(buf, offset,len);
+            }
+        }
+        
+    }
+    
+    private class XmlIndex implements Index {
+        public boolean done() {
+            Value v = valList.get(vIdx);
+            if ("/array".equals(v.getType())) {
+                valList.set(vIdx, null);
+                vIdx++;
+                return true;
+            } else {
+                return false;
+            }
+        }
+        public void incr() {}
+    }
+    
+    private ArrayList<Value> valList;
+    private int vLen;
+    private int vIdx;
+    
+    private Value next() throws IOException {
+        if (vIdx < vLen) {
+            Value v = valList.get(vIdx);
+            valList.set(vIdx, null);
+            vIdx++;
+            return v;
+        } else {
+            throw new IOException("Error in deserialization.");
+        }
+    }
+    
+    static XmlInputArchive getArchive(InputStream strm)
+    throws ParserConfigurationException, SAXException, IOException {
+        return new XmlInputArchive(strm);
+    }
+    
+    /** Creates a new instance of BinaryInputArchive */
+    public XmlInputArchive(InputStream in)
+    throws ParserConfigurationException, SAXException, IOException {
+        valList = new ArrayList<Value>();
+        DefaultHandler handler = new XMLParser(valList);
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        SAXParser parser = factory.newSAXParser();
+        parser.parse(in, handler);
+        vLen = valList.size();
+        vIdx = 0;
+    }
+    
+    public byte readByte(String tag) throws IOException {
+        Value v = next();
+        if (!"ex:i1".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+        return Byte.parseByte(v.getValue());
+    }
+    
+    public boolean readBool(String tag) throws IOException {
+        Value v = next();
+        if (!"boolean".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+        return "1".equals(v.getValue());
+    }
+    
+    public int readInt(String tag) throws IOException {
+        Value v = next();
+        if (!"i4".equals(v.getType()) &&
+                !"int".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+        return Integer.parseInt(v.getValue());
+    }
+    
+    public long readLong(String tag) throws IOException {
+        Value v = next();
+        if (!"ex:i8".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+        return Long.parseLong(v.getValue());
+    }
+    
+    public float readFloat(String tag) throws IOException {
+        Value v = next();
+        if (!"ex:float".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+        return Float.parseFloat(v.getValue());
+    }
+    
+    public double readDouble(String tag) throws IOException {
+        Value v = next();
+        if (!"double".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+        return Double.parseDouble(v.getValue());
+    }
+    
+    public String readString(String tag) throws IOException {
+        Value v = next();
+        if (!"string".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+        return Utils.fromXMLString(v.getValue());
+    }
+    
+    public byte[] readBuffer(String tag) throws IOException {
+        Value v = next();
+        if (!"string".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+        return Utils.fromXMLBuffer(v.getValue());
+    }
+    
+    public void readRecord(Record r, String tag) throws IOException {
+        r.deserialize(this, tag);
+    }
+    
+    public void startRecord(String tag) throws IOException {
+        Value v = next();
+        if (!"struct".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+    }
+    
+    public void endRecord(String tag) throws IOException {
+        Value v = next();
+        if (!"/struct".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+    }
+    
+    public Index startVector(String tag) throws IOException {
+        Value v = next();
+        if (!"array".equals(v.getType())) {
+            throw new IOException("Error deserializing "+tag+".");
+        }
+        return new XmlIndex();
+    }
+    
+    public void endVector(String tag) throws IOException {}
+    
+    public Index startMap(String tag) throws IOException {
+        return startVector(tag);
+    }
+    
+    public void endMap(String tag) throws IOException { endVector(tag); }
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/XmlOutputArchive.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/XmlOutputArchive.java b/zookeeper-jute/src/main/java/org/apache/jute/XmlOutputArchive.java
new file mode 100644
index 0000000..b65e9a0
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/XmlOutputArchive.java
@@ -0,0 +1,251 @@
+/**
+ * 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.jute;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.List;
+import java.util.Stack;
+import java.util.TreeMap;
+
+/**
+ *
+ */
+class XmlOutputArchive implements OutputArchive {
+
+    private PrintStream stream;
+    
+    private int indent = 0;
+    
+    private Stack<String> compoundStack;
+    
+    private void putIndent() {
+        StringBuilder sb = new StringBuilder("");
+        for (int idx = 0; idx < indent; idx++) {
+            sb.append("  ");
+        }
+        stream.print(sb.toString());
+    }
+    
+    private void addIndent() {
+        indent++;
+    }
+    
+    private void closeIndent() {
+        indent--;
+    }
+    
+    private void printBeginEnvelope(String tag) {
+        if (!compoundStack.empty()) {
+            String s = compoundStack.peek();
+            if ("struct".equals(s)) {
+                putIndent();
+                stream.print("<member>\n");
+                addIndent();
+                putIndent();
+                stream.print("<name>"+tag+"</name>\n");
+                putIndent();
+                stream.print("<value>");
+            } else if ("vector".equals(s)) {
+                stream.print("<value>");
+            } else if ("map".equals(s)) {
+                stream.print("<value>");
+            }
+        } else {
+            stream.print("<value>");
+        }
+    }
+    
+    private void printEndEnvelope(String tag) {
+        if (!compoundStack.empty()) {
+            String s = compoundStack.peek();
+            if ("struct".equals(s)) {
+                stream.print("</value>\n");
+                closeIndent();
+                putIndent();
+                stream.print("</member>\n");
+            } else if ("vector".equals(s)) {
+                stream.print("</value>\n");
+            } else if ("map".equals(s)) {
+                stream.print("</value>\n");
+            }
+        } else {
+            stream.print("</value>\n");
+        }
+    }
+    
+    private void insideVector(String tag) {
+        printBeginEnvelope(tag);
+        compoundStack.push("vector");
+    }
+    
+    private void outsideVector(String tag) throws IOException {
+        String s = compoundStack.pop();
+        if (!"vector".equals(s)) {
+            throw new IOException("Error serializing vector.");
+        }
+        printEndEnvelope(tag);
+    }
+    
+    private void insideMap(String tag) {
+        printBeginEnvelope(tag);
+        compoundStack.push("map");
+    }
+    
+    private void outsideMap(String tag) throws IOException {
+        String s = compoundStack.pop();
+        if (!"map".equals(s)) {
+            throw new IOException("Error serializing map.");
+        }
+        printEndEnvelope(tag);
+    }
+    
+    private void insideRecord(String tag) {
+        printBeginEnvelope(tag);
+        compoundStack.push("struct");
+    }
+    
+    private void outsideRecord(String tag) throws IOException {
+        String s = compoundStack.pop();
+        if (!"struct".equals(s)) {
+            throw new IOException("Error serializing record.");
+        }
+        printEndEnvelope(tag);
+    }
+    
+    static XmlOutputArchive getArchive(OutputStream strm) {
+        return new XmlOutputArchive(strm);
+    }
+    
+    /** Creates a new instance of XmlOutputArchive */
+    public XmlOutputArchive(OutputStream out) {
+        stream = new PrintStream(out);
+        compoundStack = new Stack<String>();
+    }
+    
+    public void writeByte(byte b, String tag) throws IOException {
+        printBeginEnvelope(tag);
+        stream.print("<ex:i1>");
+        stream.print(Byte.toString(b));
+        stream.print("</ex:i1>");
+        printEndEnvelope(tag);
+    }
+    
+    public void writeBool(boolean b, String tag) throws IOException {
+        printBeginEnvelope(tag);
+        stream.print("<boolean>");
+        stream.print(b ? "1" : "0");
+        stream.print("</boolean>");
+        printEndEnvelope(tag);
+    }
+    
+    public void writeInt(int i, String tag) throws IOException {
+        printBeginEnvelope(tag);
+        stream.print("<i4>");
+        stream.print(Integer.toString(i));
+        stream.print("</i4>");
+        printEndEnvelope(tag);
+    }
+    
+    public void writeLong(long l, String tag) throws IOException {
+        printBeginEnvelope(tag);
+        stream.print("<ex:i8>");
+        stream.print(Long.toString(l));
+        stream.print("</ex:i8>");
+        printEndEnvelope(tag);
+    }
+    
+    public void writeFloat(float f, String tag) throws IOException {
+        printBeginEnvelope(tag);
+        stream.print("<ex:float>");
+        stream.print(Float.toString(f));
+        stream.print("</ex:float>");
+        printEndEnvelope(tag);
+    }
+    
+    public void writeDouble(double d, String tag) throws IOException {
+        printBeginEnvelope(tag);
+        stream.print("<double>");
+        stream.print(Double.toString(d));
+        stream.print("</double>");
+        printEndEnvelope(tag);
+    }
+    
+    public void writeString(String s, String tag) throws IOException {
+        printBeginEnvelope(tag);
+        stream.print("<string>");
+        stream.print(Utils.toXMLString(s));
+        stream.print("</string>");
+        printEndEnvelope(tag);
+    }
+    
+    public void writeBuffer(byte buf[], String tag)
+    throws IOException {
+        printBeginEnvelope(tag);
+        stream.print("<string>");
+        stream.print(Utils.toXMLBuffer(buf));
+        stream.print("</string>");
+        printEndEnvelope(tag);
+    }
+    
+    public void writeRecord(Record r, String tag) throws IOException {
+        r.serialize(this, tag);
+    }
+    
+    public void startRecord(Record r, String tag) throws IOException {
+        insideRecord(tag);
+        stream.print("<struct>\n");
+        addIndent();
+    }
+    
+    public void endRecord(Record r, String tag) throws IOException {
+        closeIndent();
+        putIndent();
+        stream.print("</struct>");
+        outsideRecord(tag);
+    }
+    
+    public void startVector(List v, String tag) throws IOException {
+        insideVector(tag);
+        stream.print("<array>\n");
+        addIndent();
+    }
+    
+    public void endVector(List v, String tag) throws IOException {
+        closeIndent();
+        putIndent();
+        stream.print("</array>");
+        outsideVector(tag);
+    }
+    
+    public void startMap(TreeMap v, String tag) throws IOException {
+        insideMap(tag);
+        stream.print("<array>\n");
+        addIndent();
+    }
+    
+    public void endMap(TreeMap v, String tag) throws IOException {
+        closeIndent();
+        putIndent();
+        stream.print("</array>");
+        outsideMap(tag);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/CGenerator.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/CGenerator.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/CGenerator.java
new file mode 100644
index 0000000..689ee21
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/CGenerator.java
@@ -0,0 +1,142 @@
+/**
+ * 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.jute.compiler;
+
+import java.util.ArrayList;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+
+/**
+ * C++ Code generator front-end for Hadoop record I/O.
+ */
+class CGenerator {
+    private String mName;
+    private ArrayList<JFile> mInclFiles;
+    private ArrayList<JRecord> mRecList;
+    private final File outputDirectory;
+
+    /** Creates a new instance of CppGenerator
+     *
+     * @param name possibly full pathname to the file
+     * @param ilist included files (as JFile)
+     * @param rlist List of records defined within this file
+     * @param outputDirectory
+     */
+    CGenerator(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist,
+            File outputDirectory)
+    {
+        this.outputDirectory = outputDirectory;
+        mName = (new File(name)).getName();
+        mInclFiles = ilist;
+        mRecList = rlist;
+    }
+
+    /**
+     * Generate C++ code. This method only creates the requested file(s)
+     * and spits-out file-level elements (such as include statements etc.)
+     * record-level code is generated by JRecord.
+     */
+    void genCode() throws IOException {
+        if (!outputDirectory.exists()) {
+            if (!outputDirectory.mkdirs()) {
+                throw new IOException("unable to create output directory "
+                        + outputDirectory);
+            }
+        }
+
+        FileWriter c = null;
+        FileWriter h = null;
+        try {
+            c = new FileWriter(new File(outputDirectory, mName+".c"));
+            h = new FileWriter(new File(outputDirectory, mName+".h"));
+
+            h.write("/**\n");
+            h.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
+            h.write("* or more contributor license agreements.  See the NOTICE file\n");
+            h.write("* distributed with this work for additional information\n");
+            h.write("* regarding copyright ownership.  The ASF licenses this file\n");
+            h.write("* to you under the Apache License, Version 2.0 (the\n");
+            h.write("* \"License\"); you may not use this file except in compliance\n");
+            h.write("* with the License.  You may obtain a copy of the License at\n");
+            h.write("*\n");
+            h.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
+            h.write("*\n");
+            h.write("* Unless required by applicable law or agreed to in writing, software\n");
+            h.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
+            h.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
+            h.write("* See the License for the specific language governing permissions and\n");
+            h.write("* limitations under the License.\n");
+            h.write("*/\n");
+            h.write("\n");
+
+            c.write("/**\n");
+            c.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
+            c.write("* or more contributor license agreements.  See the NOTICE file\n");
+            c.write("* distributed with this work for additional information\n");
+            c.write("* regarding copyright ownership.  The ASF licenses this file\n");
+            c.write("* to you under the Apache License, Version 2.0 (the\n");
+            c.write("* \"License\"); you may not use this file except in compliance\n");
+            c.write("* with the License.  You may obtain a copy of the License at\n");
+            c.write("*\n");
+            c.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
+            c.write("*\n");
+            c.write("* Unless required by applicable law or agreed to in writing, software\n");
+            c.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
+            c.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
+            c.write("* See the License for the specific language governing permissions and\n");
+            c.write("* limitations under the License.\n");
+            c.write("*/\n");
+            c.write("\n");
+
+            h.write("#ifndef __"+mName.toUpperCase().replace('.','_')+"__\n");
+            h.write("#define __"+mName.toUpperCase().replace('.','_')+"__\n");
+
+            h.write("#include \"recordio.h\"\n");
+            for (Iterator<JFile> i = mInclFiles.iterator(); i.hasNext();) {
+                JFile f = i.next();
+                h.write("#include \""+f.getName()+".h\"\n");
+            }
+            // required for compilation from C++
+            h.write("\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
+
+            c.write("#include <stdlib.h>\n"); // need it for calloc() & free()
+            c.write("#include \""+mName+".h\"\n\n");
+
+            for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext();) {
+                JRecord jr = i.next();
+                jr.genCCode(h, c);
+            }
+
+            h.write("\n#ifdef __cplusplus\n}\n#endif\n\n");
+            h.write("#endif //"+mName.toUpperCase().replace('.','_')+"__\n");
+        } finally {
+            try {
+                if (h != null) {
+                    h.close();
+                }
+            } finally {
+                if (c != null) {
+                    c.close();
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/CSharpGenerator.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/CSharpGenerator.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/CSharpGenerator.java
new file mode 100644
index 0000000..c28751d
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/CSharpGenerator.java
@@ -0,0 +1,53 @@
+/**
+ * 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.jute.compiler;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+public class CSharpGenerator {
+    private ArrayList<JRecord> mRecList;
+    private final File outputDirectory;
+
+    /** Creates a new instance of CSharpGenerator
+     *
+     * @param name possibly full pathname to the file
+     * @param ilist included files (as JFile)
+     * @param rlist List of records defined within this file
+     * @param outputDirectory
+     */
+    CSharpGenerator(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist,
+            File outputDirectory)
+     {
+        this.outputDirectory = outputDirectory;
+        mRecList = rlist;
+    }
+
+    /**
+     * Generate C# code. This method only creates the requested file(s)
+     * and spits-out file-level elements (such as include statements etc.)
+     * record-level code is generated by JRecord.
+     */
+    void genCode() throws IOException {
+        for (JRecord rec : mRecList) {
+            rec.genCsharpCode(outputDirectory);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/CppGenerator.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/CppGenerator.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/CppGenerator.java
new file mode 100644
index 0000000..98892a3
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/CppGenerator.java
@@ -0,0 +1,136 @@
+/**
+ * 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.jute.compiler;
+
+import java.util.ArrayList;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+
+/**
+ * C++ Code generator front-end for Hadoop record I/O.
+ */
+class CppGenerator {
+    private String mName;
+    private ArrayList<JFile> mInclFiles;
+    private ArrayList<JRecord> mRecList;
+    private final File outputDirectory;
+
+    /** Creates a new instance of CppGenerator
+     *
+     * @param name possibly full pathname to the file
+     * @param ilist included files (as JFile)
+     * @param rlist List of records defined within this file
+     * @param outputDirectory
+     */
+    CppGenerator(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist,
+            File outputDirectory)
+     {
+        this.outputDirectory = outputDirectory;
+        mName = (new File(name)).getName();
+        mInclFiles = ilist;
+        mRecList = rlist;
+    }
+
+    /**
+     * Generate C++ code. This method only creates the requested file(s)
+     * and spits-out file-level elements (such as include statements etc.)
+     * record-level code is generated by JRecord.
+     */
+    void genCode() throws IOException {
+        if (!outputDirectory.exists()) {
+            if (!outputDirectory.mkdirs()) {
+                throw new IOException("unable to create output directory "
+                        + outputDirectory);
+            }
+        }
+        FileWriter cc = null;
+        FileWriter hh = null;
+
+        try {
+            cc = new FileWriter(new File(outputDirectory, mName+".cc"));
+            hh = new FileWriter(new File(outputDirectory, mName+".hh"));
+            hh.write("/**\n");
+            hh.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
+            hh.write("* or more contributor license agreements.  See the NOTICE file\n");
+            hh.write("* distributed with this work for additional information\n");
+            hh.write("* regarding copyright ownership.  The ASF licenses this file\n");
+            hh.write("* to you under the Apache License, Version 2.0 (the\n");
+            hh.write("* \"License\"); you may not use this file except in compliance\n");
+            hh.write("* with the License.  You may obtain a copy of the License at\n");
+            hh.write("*\n");
+            hh.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
+            hh.write("*\n");
+            hh.write("* Unless required by applicable law or agreed to in writing, software\n");
+            hh.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
+            hh.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
+            hh.write("* See the License for the specific language governing permissions and\n");
+            hh.write("* limitations under the License.\n");
+            hh.write("*/\n");
+            hh.write("\n");
+
+            cc.write("/**\n");
+            cc.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
+            cc.write("* or more contributor license agreements.  See the NOTICE file\n");
+            cc.write("* distributed with this work for additional information\n");
+            cc.write("* regarding copyright ownership.  The ASF licenses this file\n");
+            cc.write("* to you under the Apache License, Version 2.0 (the\n");
+            cc.write("* \"License\"); you may not use this file except in compliance\n");
+            cc.write("* with the License.  You may obtain a copy of the License at\n");
+            cc.write("*\n");
+            cc.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
+            cc.write("*\n");
+            cc.write("* Unless required by applicable law or agreed to in writing, software\n");
+            cc.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
+            cc.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
+            cc.write("* See the License for the specific language governing permissions and\n");
+            cc.write("* limitations under the License.\n");
+            cc.write("*/\n");
+            cc.write("\n");
+
+            hh.write("#ifndef __"+mName.toUpperCase().replace('.','_')+"__\n");
+            hh.write("#define __"+mName.toUpperCase().replace('.','_')+"__\n");
+
+            hh.write("#include \"recordio.hh\"\n");
+            for (Iterator<JFile> i = mInclFiles.iterator(); i.hasNext();) {
+                JFile f = i.next();
+                hh.write("#include \""+f.getName()+".hh\"\n");
+            }
+            cc.write("#include \""+mName+".hh\"\n");
+
+            for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext();) {
+                JRecord jr = i.next();
+                jr.genCppCode(hh, cc);
+            }
+
+            hh.write("#endif //"+mName.toUpperCase().replace('.','_')+"__\n");
+        } finally {
+            try {
+                if (hh != null) {
+                    hh.close();
+                }
+            } finally {
+                if (cc != null) {
+                    cc.close();
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JBoolean.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JBoolean.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JBoolean.java
new file mode 100644
index 0000000..b45b161
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JBoolean.java
@@ -0,0 +1,50 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ *
+ */
+public class JBoolean extends JType {
+    
+    /** Creates a new instance of JBoolean */
+    public JBoolean() {
+        super("int32_t", "bool", "bool", "boolean", "Bool", "Boolean", "bool", "toBoolean");
+    }
+    
+    public String getSignature() {
+        return "z";
+    }
+    
+    public String genJavaCompareTo(String fname) {
+        return "    ret = ("+fname+" == peer."+fname+")? 0 : ("+fname+"?1:-1);\n";
+    }
+    
+    public String genJavaHashCode(String fname) {
+        return "     ret = ("+fname+")?0:1;\n";
+    }
+
+    String genCsharpHashCode(String fname) {
+        return "     ret = ("+capitalize(fname)+")?0:1;\n";
+    }
+
+    String genCsharpCompareTo(String name) {
+        return "    ret = ("+capitalize(name)+" == peer."+capitalize(name)+")? 0 : ("+capitalize(name)+"?1:-1);\n";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JBuffer.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JBuffer.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JBuffer.java
new file mode 100644
index 0000000..b2be5bd
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JBuffer.java
@@ -0,0 +1,106 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ *
+ */
+public class JBuffer extends JCompType {
+    
+    /** Creates a new instance of JBuffer */
+    public JBuffer() {
+        super("struct buffer", " ::std::string", "byte[]", "byte[]", "Buffer", "byte[]", "byte[]");
+    }
+    
+    public String genCppGetSet(String fname, int fIdx) {
+        String cgetFunc = "  virtual const "+getCppType()+"& get"+fname+"() const {\n";
+        cgetFunc += "    return m"+fname+";\n";
+        cgetFunc += "  }\n";
+        String getFunc = "  virtual "+getCppType()+"& get"+fname+"() {\n";
+        getFunc += "    bs_.set("+fIdx+");return m"+fname+";\n";
+        getFunc += "  }\n";
+        return cgetFunc + getFunc;
+    }
+    
+    public String getSignature() {
+        return "B";
+    }
+    
+    public String genJavaReadWrapper(String fname, String tag, boolean decl) {
+        String ret = "";
+        if (decl) {
+            ret = "    byte[] "+fname+";\n";
+        }
+        return ret + "        "+fname+"=a_.readBuffer(\""+tag+"\");\n";
+    }
+    
+    public String genJavaWriteWrapper(String fname, String tag) {
+        return "        a_.writeBuffer("+fname+",\""+tag+"\");\n";
+    }
+    
+    public String genJavaCompareTo(String fname, String other) {
+      StringBuilder sb = new StringBuilder();
+      sb.append("    {\n");
+      sb.append("      byte[] my = "+fname+";\n");
+      sb.append("      byte[] ur = "+other+";\n");
+      sb.append("      ret = org.apache.jute.Utils.compareBytes(my,0,my.length,ur,0,ur.length);\n");
+      sb.append("    }\n");
+      return sb.toString();
+    }
+    
+    public String genJavaCompareTo(String fname) {
+        return genJavaCompareTo(fname, "peer."+fname);
+    }
+    public String genJavaCompareToWrapper(String fname, String other) {
+      return "    "+genJavaCompareTo(fname, other);
+    }
+    
+    public String genJavaEquals(String fname, String peer) {
+        return "    ret = org.apache.jute.Utils.bufEquals("+fname+","+peer+");\n";
+    }
+    
+    public String genJavaHashCode(String fname) {
+        return "    ret = java.util.Arrays.toString("+fname+").hashCode();\n";
+    }
+    
+    public String genJavaSlurpBytes(String b, String s, String l) {
+      StringBuilder sb = new StringBuilder();
+      sb.append("        {\n");
+      sb.append("           int i = org.apache.jute.Utils.readVInt("+b+", "+s+");\n");
+      sb.append("           int z = WritableUtils.getVIntSize(i);\n");
+      sb.append("           "+s+" += z+i; "+l+" -= (z+i);\n");
+      sb.append("        }\n");
+      return sb.toString();
+    }
+    
+    public String genJavaCompareBytes() {
+      StringBuilder sb = new StringBuilder();
+      sb.append("        {\n");
+      sb.append("           int i1 = org.apache.jute.Utils.readVInt(b1, s1);\n");
+      sb.append("           int i2 = org.apache.jute.Utils.readVInt(b2, s2);\n");
+      sb.append("           int z1 = WritableUtils.getVIntSize(i1);\n");
+      sb.append("           int z2 = WritableUtils.getVIntSize(i2);\n");
+      sb.append("           s1+=z1; s2+=z2; l1-=z1; l2-=z2;\n");
+      sb.append("           int r1 = org.apache.jute.Utils.compareBytes(b1,s1,l1,b2,s2,l2);\n");
+      sb.append("           if (r1 != 0) { return (r1<0)?-1:0; }\n");
+      sb.append("           s1+=i1; s2+=i2; l1-=i1; l1-=i2;\n");
+      sb.append("        }\n");
+      return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JByte.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JByte.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JByte.java
new file mode 100644
index 0000000..4b1cea4
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JByte.java
@@ -0,0 +1,34 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ *
+ */
+public class JByte extends JType {
+    
+    /** Creates a new instance of JByte */
+    public JByte() {
+        super("char", "int8_t", "byte", "byte", "Byte", "Byte", "byte", "toByte");
+    }
+    
+    public String getSignature() {
+        return "b";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JCompType.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JCompType.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JCompType.java
new file mode 100644
index 0000000..d98658f
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JCompType.java
@@ -0,0 +1,66 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ * Abstract base class for all the "compound" types such as ustring,
+ * buffer, vector, map, and record.
+ */
+abstract class JCompType extends JType {
+    
+    /** Creates a new instance of JCompType */
+    JCompType(String cType, String cppType, String csharpType, String javaType, String suffix, String wrapper, String csharpWrapper) {
+        super(cType, cppType, csharpType, javaType, suffix, wrapper, csharpWrapper, null);
+    }
+    
+    String genCppGetSet(String fname, int fIdx) {
+        String cgetFunc = "  virtual const "+getCppType()+"& get"+fname+"() const {\n";
+        cgetFunc += "    return m"+fname+";\n";
+        cgetFunc += "  }\n";
+        String getFunc = "  virtual "+getCppType()+"& get"+fname+"() {\n";
+        getFunc += "    bs_.set("+fIdx+");return m"+fname+";\n";
+        getFunc += "  }\n";
+        return cgetFunc + getFunc;
+    }
+    
+    String genJavaCompareTo(String fname) {
+        return "    ret = "+fname+".compareTo(peer."+fname+");\n";
+    }
+    
+    String genJavaEquals(String fname, String peer) {
+        return "    ret = "+fname+".equals("+peer+");\n";
+    }
+    
+    String genJavaHashCode(String fname) {
+        return "    ret = "+fname+".hashCode();\n";
+    }
+
+    String genCsharpHashCode(String fname) {
+        return "    ret = "+capitalize(fname)+".GetHashCode();\n";
+    }
+
+    String genCsharpEquals(String name, String peer) {
+        String[] peerSplit = peer.split("\\.");
+        return "    ret = "+capitalize(name)+".Equals("+peerSplit[0] + "." + capitalize(peerSplit[1]) + ");\n";
+    }
+
+    String genCsharpCompareTo(String name) {
+        return "    ret = "+capitalize(name)+".CompareTo(peer."+capitalize(name)+");\n";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JDouble.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JDouble.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JDouble.java
new file mode 100644
index 0000000..21f9cc8
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JDouble.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.jute.compiler;
+
+/**
+ *
+ */
+public class JDouble extends JType {
+    
+    /** Creates a new instance of JDouble */
+    public JDouble() {
+        super("double", "double", "double", "double", "Double", "Double", "double", "toDouble");
+    }
+    
+    public String getSignature() {
+        return "d";
+    }
+    
+    public String genJavaHashCode(String fname) {
+        String tmp = "Double.doubleToLongBits("+fname+")";
+        return "    ret = (int)("+tmp+"^("+tmp+">>>32));\n";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JField.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JField.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JField.java
new file mode 100644
index 0000000..50f9fc9
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JField.java
@@ -0,0 +1,140 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ *
+ */
+public class JField {
+    private JType mType;
+    private String mName;
+    /**
+     * Creates a new instance of JField
+     */
+    public JField(JType type, String name) {
+        mType = type;
+        mName = name;
+    }
+    
+    public String getSignature() {
+        return mType.getSignature();
+    }
+    
+    public String genCppDecl() {
+        return mType.genCppDecl(mName);
+    }
+    
+	public String genCDecl() {
+		return mType.genCDecl(mName);
+	}
+
+    public String genCsharpDecl() {
+        return mType.genCsharpDecl(mName);
+    }
+
+    public String genCsharpConstructorParam(String fname) {
+        return mType.genCsharpConstructorParam(fname);
+    }
+	
+    public String genJavaDecl() {
+        return mType.genJavaDecl(mName);
+    }
+    
+    public String genJavaConstructorParam(String fname) {
+        return mType.genJavaConstructorParam(fname);
+    }
+    
+    public String getName() {
+        return mName;
+    }
+
+    public String getCsharpName() {
+        return "Id".equals(mName) ? "ZKId" : mName;
+    }
+    
+    public String getTag() {
+        return mName;
+    }
+    
+    public JType getType() {
+        return mType;
+    }
+    
+    public String genCppGetSet(int fIdx) {
+        return mType.genCppGetSet(mName, fIdx);
+    }
+
+    public String genCsharpConstructorSet(String fname) {
+        return mType.genCsharpConstructorSet(mName, fname);
+    }
+
+    public String genCsharpGetSet(int fIdx) {
+        return mType.genCsharpGetSet(getCsharpName(), fIdx);
+    }
+
+    public String genCsharpWriteMethodName() {
+        return mType.genCsharpWriteMethod(getCsharpName(), getTag());
+    }
+
+    public String genCsharpReadMethodName() {
+        return mType.genCsharpReadMethod(getCsharpName(), getTag());
+    }
+
+    public String genCsharpCompareTo() {
+        return mType.genCsharpCompareTo(getCsharpName());
+    }
+
+    public String genCsharpEquals() {
+        return mType.genCsharpEquals(getCsharpName(), "peer."+getCsharpName());
+    }
+
+    public String genCsharpHashCode() {
+        return mType.genCsharpHashCode(getCsharpName());
+    }
+
+    
+    public String genJavaGetSet(int fIdx) {
+        return mType.genJavaGetSet(mName, fIdx);
+    }
+    
+    public String genJavaWriteMethodName() {
+        return mType.genJavaWriteMethod(getName(), getTag());
+    }
+    
+    public String genJavaReadMethodName() {
+        return mType.genJavaReadMethod(getName(), getTag());
+    }
+    
+    public String genJavaCompareTo() {
+        return mType.genJavaCompareTo(getName());
+    }
+    
+    public String genJavaEquals() {
+        return mType.genJavaEquals(getName(), "peer."+getName());
+    }
+    
+    public String genJavaHashCode() {
+        return mType.genJavaHashCode(getName());
+    }
+
+    public String genJavaConstructorSet(String fname) {
+        return mType.genJavaConstructorSet(mName, fname);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JFile.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JFile.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JFile.java
new file mode 100644
index 0000000..e5b0ba3
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JFile.java
@@ -0,0 +1,84 @@
+/**
+ * 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.jute.compiler;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+/**
+ * Container for the Hadoop Record DDL.
+ * The main components of the file are filename, list of included files,
+ * and records defined in that file.
+ *
+ */
+public class JFile {
+    
+    private String mName;
+    private ArrayList<JFile> mInclFiles;
+    private ArrayList<JRecord> mRecords;
+    
+    /** Creates a new instance of JFile
+     *
+     * @param name possibly full pathname to the file
+     * @param inclFiles included files (as JFile)
+     * @param recList List of records defined within this file
+     */
+    public JFile(String name, ArrayList<JFile> inclFiles,
+            ArrayList<JRecord> recList)
+    {
+        mName = name;
+        mInclFiles = inclFiles;
+        mRecords = recList;
+    }
+    
+    /** Strip the other pathname components and return the basename */
+    String getName() {
+        int idx = mName.lastIndexOf('/');
+        return (idx > 0) ? mName.substring(idx) : mName; 
+    }
+    
+    /** Generate record code in given language. Language should be all
+     *  lowercase.
+     * @param outputDirectory 
+     */
+    public void genCode(String language, File outputDirectory)
+        throws IOException
+    {
+        if ("c++".equals(language)) {
+            CppGenerator gen = new CppGenerator(mName, mInclFiles, mRecords,
+                    outputDirectory);
+            gen.genCode();
+        } else if ("java".equals(language)) {
+            JavaGenerator gen = new JavaGenerator(mName, mInclFiles, mRecords,
+                    outputDirectory);
+            gen.genCode();
+        } else if ("c".equals(language)) {
+        	CGenerator gen = new CGenerator(mName, mInclFiles, mRecords,
+        	        outputDirectory);
+        	gen.genCode();
+        } else if ("csharp".equals(language)) {
+        	CSharpGenerator gen = new CSharpGenerator(mName, mInclFiles, mRecords,
+        	        outputDirectory);
+        	gen.genCode();
+        } else {
+            throw new IOException("Cannnot recognize language:" + language);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JFloat.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JFloat.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JFloat.java
new file mode 100644
index 0000000..a4be6ec
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JFloat.java
@@ -0,0 +1,39 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ *
+ */
+public class JFloat extends JType {
+    
+    /** Creates a new instance of JFloat */
+    public JFloat() {
+        super("float", "float", "float", "float", "Float", "Float", "float", "toFloat");
+    }
+    
+    public String getSignature() {
+        return "f";
+    }
+    
+    public String genJavaHashCode(String fname) {
+        return "    ret = Float.floatToIntBits("+fname+");\n";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JInt.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JInt.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JInt.java
new file mode 100644
index 0000000..23b902e
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JInt.java
@@ -0,0 +1,34 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ *
+ */
+public class JInt extends JType {
+    
+    /** Creates a new instance of JInt */
+    public JInt() {
+        super("int32_t", "int32_t", "int", "int", "Int", "Integer", "int", "toInt");
+    }
+    
+    public String getSignature() {
+        return "i";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JLong.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JLong.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JLong.java
new file mode 100644
index 0000000..342fd9a
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JLong.java
@@ -0,0 +1,38 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ *
+ */
+public class JLong extends JType {
+    
+    /** Creates a new instance of JLong */
+    public JLong() {
+        super("int64_t", "int64_t", "long", "long", "Long", "Long", "long", "toLong");
+    }
+    
+    public String getSignature() {
+        return "l";
+    }
+    
+    public String genJavaHashCode(String fname) {
+        return "    ret = (int) ("+fname+"^("+fname+">>>32));\n";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JMap.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JMap.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JMap.java
new file mode 100644
index 0000000..cc503be
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JMap.java
@@ -0,0 +1,149 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ *
+ */
+public class JMap extends JCompType {
+   
+    static private int level = 0;
+    
+    static private String getLevel() { return Integer.toString(level); }
+    
+    static private void incrLevel() { level++; }
+    
+    static private void decrLevel() { level--; }
+    
+    static private String getId(String id) { return id+getLevel(); }
+    
+    private JType mKey;
+    private JType mValue;
+    
+    /** Creates a new instance of JMap */
+    public JMap(JType t1, JType t2) {
+        super("#error", " ::std::map<"+t1.getCppType()+","+t2.getCppType()+">",
+                "System.Collections.Generic.SortedDictionary<string, string>", "java.util.TreeMap", "Map", "System.Collections.Generic.SortedDictionary<string, string>", "java.util.TreeMap");
+        mKey = t1;
+        mValue = t2;
+    }
+    
+    public String getSignature() {
+        return "{" + mKey.getSignature() + mValue.getSignature() +"}";
+    }
+    
+    public String genJavaCompareTo(String fname) {
+        return "    throw new UnsupportedOperationException(\"comparing "
+            + fname + " is unimplemented\");\n";
+    }
+    
+    public String genJavaReadWrapper(String fname, String tag, boolean decl) {
+        StringBuilder ret = new StringBuilder("");
+        if (decl) {
+            ret.append("    java.util.TreeMap "+fname+";\n");
+        }
+        ret.append("    {\n");
+        incrLevel();
+        ret.append("      org.apache.jute.Index "+getId("midx")+" = a_.startMap(\""+tag+"\");\n");
+        ret.append("      "+fname+"=new java.util.TreeMap();\n");
+        ret.append("      for (; !"+getId("midx")+".done(); "+getId("midx")+".incr()) {\n");
+        ret.append(mKey.genJavaReadWrapper(getId("k"),getId("k"),true));
+        ret.append(mValue.genJavaReadWrapper(getId("v"),getId("v"),true));
+        ret.append("        "+fname+".put("+getId("k")+","+getId("v")+");\n");
+        ret.append("      }\n");
+        ret.append("    a_.endMap(\""+tag+"\");\n");
+        decrLevel();
+        ret.append("    }\n");
+        return ret.toString();
+    }
+    
+    public String genJavaReadMethod(String fname, String tag) {
+        return genJavaReadWrapper(fname, tag, false);
+    }
+    
+    public String genJavaWriteWrapper(String fname, String tag) {
+        StringBuilder ret = new StringBuilder("    {\n");
+        incrLevel();
+        ret.append("      a_.startMap("+fname+",\""+tag+"\");\n");
+        ret.append("      java.util.Set "+getId("es")+" = "+fname+".entrySet();\n");
+        ret.append("      for(java.util.Iterator "+getId("midx")+" = "+getId("es")+".iterator(); "+getId("midx")+".hasNext(); ) {\n");
+        ret.append("        java.util.Map.Entry "+getId("me")+" = (java.util.Map.Entry) "+getId("midx")+".next();\n");
+        ret.append("        "+mKey.getJavaWrapperType()+" "+getId("k")+" = ("+mKey.getJavaWrapperType()+") "+getId("me")+".getKey();\n");
+        ret.append("        "+mValue.getJavaWrapperType()+" "+getId("v")+" = ("+mValue.getJavaWrapperType()+") "+getId("me")+".getValue();\n");
+        ret.append(mKey.genJavaWriteWrapper(getId("k"),getId("k")));
+        ret.append(mValue.genJavaWriteWrapper(getId("v"),getId("v")));
+        ret.append("      }\n");
+        ret.append("      a_.endMap("+fname+",\""+tag+"\");\n");
+        ret.append("    }\n");
+        decrLevel();
+        return ret.toString();
+    }
+    
+    public String genJavaWriteMethod(String fname, String tag) {
+        return genJavaWriteWrapper(fname, tag);
+    }
+
+    public String genCsharpWriteWrapper(String fname, int tag) {
+        StringBuilder ret = new StringBuilder("    {\n");
+        incrLevel();
+        ret.append("      a_.StartMap("+fname+",\""+tag+"\");\n");
+        ret.append("      java.util.Set "+getId("es")+" = "+fname+".entrySet();\n");
+        ret.append("      for(java.util.Iterator "+getId("midx")+" = "+getId("es")+".iterator(); "+getId("midx")+".hasNext(); ) {\n");
+        ret.append("        java.util.Map.Entry "+getId("me")+" = (java.util.Map.Entry) "+getId("midx")+".next();\n");
+        ret.append("        "+mKey.getCsharpWrapperType()+" "+getId("k")+" = ("+mKey.getCsharpWrapperType()+") "+getId("me")+".getKey();\n");
+        ret.append("        "+mValue.getCsharpWrapperType()+" "+getId("v")+" = ("+mValue.getCsharpWrapperType()+") "+getId("me")+".getValue();\n");
+        ret.append(mKey.genCsharpWriteWrapper(getId("k"),getId("k")));
+        ret.append(mValue.genCsharpWriteWrapper(getId("v"),getId("v")));
+        ret.append("      }\n");
+        ret.append("      a_.EndMap("+fname+",\""+tag+"\");\n");
+        ret.append("    }\n");
+        decrLevel();
+        return ret.toString();
+    }
+
+    String genCsharpWriteMethod(String fname, int tag) {
+        return genCsharpWriteWrapper(fname, tag);
+    }
+
+    public String genCsharpReadWrapper(String fname, int tag, boolean decl) {
+        StringBuilder ret = new StringBuilder("");
+        if (decl) {
+            ret.append("    System.Collections.SortedDictionary<string,string> "+capitalize(fname)+";\n");
+        }
+        ret.append("    {\n");
+        incrLevel();
+        ret.append("      Org.Apache.Jute.IIndex "+getId("midx")+" = a_.StartMap(\""+tag+"\");\n");
+        ret.append("      "+fname+"= new System.Collections.SortedDictionary<string,string>();\n");
+        ret.append("      for (; !"+getId("midx")+".done(); "+getId("midx")+".incr()) {\n");
+        ret.append(mKey.genCsharpReadWrapper(getId("k"),getId("k"),true));
+        ret.append(mValue.genCsharpReadWrapper(getId("v"),getId("v"),true));
+        ret.append("        "+fname+".Add("+getId("k")+","+getId("v")+");\n");
+        ret.append("      }\n");
+        ret.append("    a_.EndMap(\""+tag+"\");\n");
+        decrLevel();
+        ret.append("    }\n");
+        return ret.toString();
+    }
+
+
+
+    String genCsharpReadMethod(String fname, int tag) {
+        return genCsharpReadWrapper(fname, tag, false);
+    }
+}


[2/8] zookeeper git commit: ZOOKEEPER-3080_3.4: MAVEN MIGRATION - Step 1.5 - move jute dir

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/RccTokenManager.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/RccTokenManager.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/RccTokenManager.java
new file mode 100644
index 0000000..5ae99e2
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/RccTokenManager.java
@@ -0,0 +1,833 @@
+/* Generated By:JavaCC: Do not edit this line. RccTokenManager.java */
+/**
+ * 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.jute.compiler.generated;
+import org.apache.jute.compiler.*;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+public class RccTokenManager implements RccConstants
+{
+  public  java.io.PrintStream debugStream = System.out;
+  public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
+private final int jjMoveStringLiteralDfa0_1()
+{
+   return jjMoveNfa_1(0, 0);
+}
+private final void jjCheckNAdd(int state)
+{
+   if (jjrounds[state] != jjround)
+   {
+      jjstateSet[jjnewStateCnt++] = state;
+      jjrounds[state] = jjround;
+   }
+}
+private final void jjAddStates(int start, int end)
+{
+   do {
+      jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+   } while (start++ != end);
+}
+private final void jjCheckNAddTwoStates(int state1, int state2)
+{
+   jjCheckNAdd(state1);
+   jjCheckNAdd(state2);
+}
+private final void jjCheckNAddStates(int start, int end)
+{
+   do {
+      jjCheckNAdd(jjnextStates[start]);
+   } while (start++ != end);
+}
+private final void jjCheckNAddStates(int start)
+{
+   jjCheckNAdd(jjnextStates[start]);
+   jjCheckNAdd(jjnextStates[start + 1]);
+}
+private final int jjMoveNfa_1(int startState, int curPos)
+{
+   int[] nextStates;
+   int startsAt = 0;
+   jjnewStateCnt = 3;
+   int i = 1;
+   jjstateSet[0] = startState;
+   int j, kind = 0x7fffffff;
+   for (;;)
+   {
+      if (++jjround == 0x7fffffff)
+         ReInitRounds();
+      if (curChar < 64)
+      {
+         long l = 1L << curChar;
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 0:
+                  if ((0x2400L & l) != 0L)
+                  {
+                     if (kind > 6)
+                        kind = 6;
+                  }
+                  if (curChar == 13)
+                     jjstateSet[jjnewStateCnt++] = 1;
+                  break;
+               case 1:
+                  if (curChar == 10 && kind > 6)
+                     kind = 6;
+                  break;
+               case 2:
+                  if (curChar == 13)
+                     jjstateSet[jjnewStateCnt++] = 1;
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      else if (curChar < 128)
+      {
+         long l = 1L << (curChar & 077);
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      else
+      {
+         int i2 = (curChar & 0xff) >> 6;
+         long l2 = 1L << (curChar & 077);
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      if (kind != 0x7fffffff)
+      {
+         jjmatchedKind = kind;
+         jjmatchedPos = curPos;
+         kind = 0x7fffffff;
+      }
+      ++curPos;
+      if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
+         return curPos;
+      try { curChar = input_stream.readChar(); }
+      catch(java.io.IOException e) { return curPos; }
+   }
+}
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+   switch (pos)
+   {
+      case 0:
+         if ((active0 & 0xfff800L) != 0L)
+         {
+            jjmatchedKind = 32;
+            return 4;
+         }
+         return -1;
+      case 1:
+         if ((active0 & 0xfff800L) != 0L)
+         {
+            jjmatchedKind = 32;
+            jjmatchedPos = 1;
+            return 4;
+         }
+         return -1;
+      case 2:
+         if ((active0 & 0x7ef800L) != 0L)
+         {
+            jjmatchedKind = 32;
+            jjmatchedPos = 2;
+            return 4;
+         }
+         if ((active0 & 0x810000L) != 0L)
+            return 4;
+         return -1;
+      case 3:
+         if ((active0 & 0x24000L) != 0L)
+            return 4;
+         if ((active0 & 0x7cb800L) != 0L)
+         {
+            jjmatchedKind = 32;
+            jjmatchedPos = 3;
+            return 4;
+         }
+         return -1;
+      case 4:
+         if ((active0 & 0x41000L) != 0L)
+            return 4;
+         if ((active0 & 0x78a800L) != 0L)
+         {
+            jjmatchedKind = 32;
+            jjmatchedPos = 4;
+            return 4;
+         }
+         return -1;
+      case 5:
+         if ((active0 & 0x680800L) != 0L)
+            return 4;
+         if ((active0 & 0x10a000L) != 0L)
+         {
+            jjmatchedKind = 32;
+            jjmatchedPos = 5;
+            return 4;
+         }
+         return -1;
+      default :
+         return -1;
+   }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+   return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private final int jjStopAtPos(int pos, int kind)
+{
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   return pos + 1;
+}
+private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) { return pos + 1; }
+   return jjMoveNfa_0(state, pos + 1);
+}
+private final int jjMoveStringLiteralDfa0_0()
+{
+   switch(curChar)
+   {
+      case 44:
+         return jjStopAtPos(0, 29);
+      case 46:
+         return jjStopAtPos(0, 30);
+      case 47:
+         return jjMoveStringLiteralDfa1_0(0x120L);
+      case 59:
+         return jjStopAtPos(0, 28);
+      case 60:
+         return jjStopAtPos(0, 26);
+      case 62:
+         return jjStopAtPos(0, 27);
+      case 98:
+         return jjMoveStringLiteralDfa1_0(0x20c000L);
+      case 99:
+         return jjMoveStringLiteralDfa1_0(0x1000L);
+      case 100:
+         return jjMoveStringLiteralDfa1_0(0x80000L);
+      case 102:
+         return jjMoveStringLiteralDfa1_0(0x40000L);
+      case 105:
+         return jjMoveStringLiteralDfa1_0(0x12000L);
+      case 108:
+         return jjMoveStringLiteralDfa1_0(0x20000L);
+      case 109:
+         return jjMoveStringLiteralDfa1_0(0x800800L);
+      case 117:
+         return jjMoveStringLiteralDfa1_0(0x100000L);
+      case 118:
+         return jjMoveStringLiteralDfa1_0(0x400000L);
+      case 123:
+         return jjStopAtPos(0, 24);
+      case 125:
+         return jjStopAtPos(0, 25);
+      default :
+         return jjMoveNfa_0(0, 0);
+   }
+}
+private final int jjMoveStringLiteralDfa1_0(long active0)
+{
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(0, active0);
+      return 1;
+   }
+   switch(curChar)
+   {
+      case 42:
+         if ((active0 & 0x100L) != 0L)
+            return jjStopAtPos(1, 8);
+         break;
+      case 47:
+         if ((active0 & 0x20L) != 0L)
+            return jjStopAtPos(1, 5);
+         break;
+      case 97:
+         return jjMoveStringLiteralDfa2_0(active0, 0x800000L);
+      case 101:
+         return jjMoveStringLiteralDfa2_0(active0, 0x400000L);
+      case 108:
+         return jjMoveStringLiteralDfa2_0(active0, 0x41000L);
+      case 110:
+         return jjMoveStringLiteralDfa2_0(active0, 0x12000L);
+      case 111:
+         return jjMoveStringLiteralDfa2_0(active0, 0xa8800L);
+      case 115:
+         return jjMoveStringLiteralDfa2_0(active0, 0x100000L);
+      case 117:
+         return jjMoveStringLiteralDfa2_0(active0, 0x200000L);
+      case 121:
+         return jjMoveStringLiteralDfa2_0(active0, 0x4000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(0, active0);
+}
+private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(0, old0); 
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(1, active0);
+      return 2;
+   }
+   switch(curChar)
+   {
+      case 97:
+         return jjMoveStringLiteralDfa3_0(active0, 0x1000L);
+      case 99:
+         return jjMoveStringLiteralDfa3_0(active0, 0x402000L);
+      case 100:
+         return jjMoveStringLiteralDfa3_0(active0, 0x800L);
+      case 102:
+         return jjMoveStringLiteralDfa3_0(active0, 0x200000L);
+      case 110:
+         return jjMoveStringLiteralDfa3_0(active0, 0x20000L);
+      case 111:
+         return jjMoveStringLiteralDfa3_0(active0, 0x48000L);
+      case 112:
+         if ((active0 & 0x800000L) != 0L)
+            return jjStartNfaWithStates_0(2, 23, 4);
+         break;
+      case 116:
+         if ((active0 & 0x10000L) != 0L)
+            return jjStartNfaWithStates_0(2, 16, 4);
+         return jjMoveStringLiteralDfa3_0(active0, 0x104000L);
+      case 117:
+         return jjMoveStringLiteralDfa3_0(active0, 0x80000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(1, active0);
+}
+private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(1, old0); 
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(2, active0);
+      return 3;
+   }
+   switch(curChar)
+   {
+      case 97:
+         return jjMoveStringLiteralDfa4_0(active0, 0x40000L);
+      case 98:
+         return jjMoveStringLiteralDfa4_0(active0, 0x80000L);
+      case 101:
+         if ((active0 & 0x4000L) != 0L)
+            return jjStartNfaWithStates_0(3, 14, 4);
+         break;
+      case 102:
+         return jjMoveStringLiteralDfa4_0(active0, 0x200000L);
+      case 103:
+         if ((active0 & 0x20000L) != 0L)
+            return jjStartNfaWithStates_0(3, 17, 4);
+         break;
+      case 108:
+         return jjMoveStringLiteralDfa4_0(active0, 0xa000L);
+      case 114:
+         return jjMoveStringLiteralDfa4_0(active0, 0x100000L);
+      case 115:
+         return jjMoveStringLiteralDfa4_0(active0, 0x1000L);
+      case 116:
+         return jjMoveStringLiteralDfa4_0(active0, 0x400000L);
+      case 117:
+         return jjMoveStringLiteralDfa4_0(active0, 0x800L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(2, active0);
+}
+private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(2, old0); 
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(3, active0);
+      return 4;
+   }
+   switch(curChar)
+   {
+      case 101:
+         return jjMoveStringLiteralDfa5_0(active0, 0x208000L);
+      case 105:
+         return jjMoveStringLiteralDfa5_0(active0, 0x100000L);
+      case 108:
+         return jjMoveStringLiteralDfa5_0(active0, 0x80800L);
+      case 111:
+         return jjMoveStringLiteralDfa5_0(active0, 0x400000L);
+      case 115:
+         if ((active0 & 0x1000L) != 0L)
+            return jjStartNfaWithStates_0(4, 12, 4);
+         break;
+      case 116:
+         if ((active0 & 0x40000L) != 0L)
+            return jjStartNfaWithStates_0(4, 18, 4);
+         break;
+      case 117:
+         return jjMoveStringLiteralDfa5_0(active0, 0x2000L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(3, active0);
+}
+private final int jjMoveStringLiteralDfa5_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(3, old0); 
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(4, active0);
+      return 5;
+   }
+   switch(curChar)
+   {
+      case 97:
+         return jjMoveStringLiteralDfa6_0(active0, 0x8000L);
+      case 100:
+         return jjMoveStringLiteralDfa6_0(active0, 0x2000L);
+      case 101:
+         if ((active0 & 0x800L) != 0L)
+            return jjStartNfaWithStates_0(5, 11, 4);
+         else if ((active0 & 0x80000L) != 0L)
+            return jjStartNfaWithStates_0(5, 19, 4);
+         break;
+      case 110:
+         return jjMoveStringLiteralDfa6_0(active0, 0x100000L);
+      case 114:
+         if ((active0 & 0x200000L) != 0L)
+            return jjStartNfaWithStates_0(5, 21, 4);
+         else if ((active0 & 0x400000L) != 0L)
+            return jjStartNfaWithStates_0(5, 22, 4);
+         break;
+      default :
+         break;
+   }
+   return jjStartNfa_0(4, active0);
+}
+private final int jjMoveStringLiteralDfa6_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(4, old0); 
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(5, active0);
+      return 6;
+   }
+   switch(curChar)
+   {
+      case 101:
+         if ((active0 & 0x2000L) != 0L)
+            return jjStartNfaWithStates_0(6, 13, 4);
+         break;
+      case 103:
+         if ((active0 & 0x100000L) != 0L)
+            return jjStartNfaWithStates_0(6, 20, 4);
+         break;
+      case 110:
+         if ((active0 & 0x8000L) != 0L)
+            return jjStartNfaWithStates_0(6, 15, 4);
+         break;
+      default :
+         break;
+   }
+   return jjStartNfa_0(5, active0);
+}
+static final long[] jjbitVec0 = {
+   0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+private final int jjMoveNfa_0(int startState, int curPos)
+{
+   int[] nextStates;
+   int startsAt = 0;
+   jjnewStateCnt = 5;
+   int i = 1;
+   jjstateSet[0] = startState;
+   int j, kind = 0x7fffffff;
+   for (;;)
+   {
+      if (++jjround == 0x7fffffff)
+         ReInitRounds();
+      if (curChar < 64)
+      {
+         long l = 1L << curChar;
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 0:
+                  if (curChar == 34)
+                     jjCheckNAdd(1);
+                  break;
+               case 1:
+                  if ((0xfffffffbffffffffL & l) != 0L)
+                     jjCheckNAddTwoStates(1, 2);
+                  break;
+               case 2:
+                  if (curChar == 34 && kind > 31)
+                     kind = 31;
+                  break;
+               case 4:
+                  if ((0x3ff000000000000L & l) == 0L)
+                     break;
+                  if (kind > 32)
+                     kind = 32;
+                  jjstateSet[jjnewStateCnt++] = 4;
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      else if (curChar < 128)
+      {
+         long l = 1L << (curChar & 077);
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 0:
+                  if ((0x7fffffe07fffffeL & l) == 0L)
+                     break;
+                  if (kind > 32)
+                     kind = 32;
+                  jjCheckNAdd(4);
+                  break;
+               case 1:
+                  jjAddStates(0, 1);
+                  break;
+               case 4:
+                  if ((0x7fffffe87fffffeL & l) == 0L)
+                     break;
+                  if (kind > 32)
+                     kind = 32;
+                  jjCheckNAdd(4);
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      else
+      {
+         int i2 = (curChar & 0xff) >> 6;
+         long l2 = 1L << (curChar & 077);
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 1:
+                  if ((jjbitVec0[i2] & l2) != 0L)
+                     jjAddStates(0, 1);
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      if (kind != 0x7fffffff)
+      {
+         jjmatchedKind = kind;
+         jjmatchedPos = curPos;
+         kind = 0x7fffffff;
+      }
+      ++curPos;
+      if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt)))
+         return curPos;
+      try { curChar = input_stream.readChar(); }
+      catch(java.io.IOException e) { return curPos; }
+   }
+}
+private final int jjMoveStringLiteralDfa0_2()
+{
+   switch(curChar)
+   {
+      case 42:
+         return jjMoveStringLiteralDfa1_2(0x200L);
+      default :
+         return 1;
+   }
+}
+private final int jjMoveStringLiteralDfa1_2(long active0)
+{
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      return 1;
+   }
+   switch(curChar)
+   {
+      case 47:
+         if ((active0 & 0x200L) != 0L)
+            return jjStopAtPos(1, 9);
+         break;
+      default :
+         return 2;
+   }
+   return 2;
+}
+static final int[] jjnextStates = {
+   1, 2, 
+};
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, null, null, null, null, null, null, 
+"\155\157\144\165\154\145", "\143\154\141\163\163", "\151\156\143\154\165\144\145", "\142\171\164\145", 
+"\142\157\157\154\145\141\156", "\151\156\164", "\154\157\156\147", "\146\154\157\141\164", 
+"\144\157\165\142\154\145", "\165\163\164\162\151\156\147", "\142\165\146\146\145\162", 
+"\166\145\143\164\157\162", "\155\141\160", "\173", "\175", "\74", "\76", "\73", "\54", "\56", null, null, };
+public static final String[] lexStateNames = {
+   "DEFAULT", 
+   "WithinOneLineComment", 
+   "WithinMultiLineComment", 
+};
+public static final int[] jjnewLexState = {
+   -1, -1, -1, -1, -1, 1, 0, -1, 2, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
+   -1, -1, -1, -1, -1, -1, -1, -1, 
+};
+static final long[] jjtoToken = {
+   0x1fffff801L, 
+};
+static final long[] jjtoSkip = {
+   0x37eL, 
+};
+static final long[] jjtoSpecial = {
+   0x360L, 
+};
+static final long[] jjtoMore = {
+   0x480L, 
+};
+protected SimpleCharStream input_stream;
+private final int[] jjrounds = new int[5];
+private final int[] jjstateSet = new int[10];
+StringBuffer image;
+int jjimageLen;
+int lengthOfMatch;
+protected char curChar;
+public RccTokenManager(SimpleCharStream stream){
+   if (SimpleCharStream.staticFlag)
+      throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+   input_stream = stream;
+}
+public RccTokenManager(SimpleCharStream stream, int lexState){
+   this(stream);
+   SwitchTo(lexState);
+}
+public void ReInit(SimpleCharStream stream)
+{
+   jjmatchedPos = jjnewStateCnt = 0;
+   curLexState = defaultLexState;
+   input_stream = stream;
+   ReInitRounds();
+}
+private final void ReInitRounds()
+{
+   int i;
+   jjround = 0x80000001;
+   for (i = 5; i-- > 0;)
+      jjrounds[i] = 0x80000000;
+}
+public void ReInit(SimpleCharStream stream, int lexState)
+{
+   ReInit(stream);
+   SwitchTo(lexState);
+}
+public void SwitchTo(int lexState)
+{
+   if (lexState >= 3 || lexState < 0)
+      throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+   else
+      curLexState = lexState;
+}
+
+protected Token jjFillToken()
+{
+   Token t = Token.newToken(jjmatchedKind);
+   t.kind = jjmatchedKind;
+   String im = jjstrLiteralImages[jjmatchedKind];
+   t.image = (im == null) ? input_stream.GetImage() : im;
+   t.beginLine = input_stream.getBeginLine();
+   t.beginColumn = input_stream.getBeginColumn();
+   t.endLine = input_stream.getEndLine();
+   t.endColumn = input_stream.getEndColumn();
+   return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+public Token getNextToken() 
+{
+  int kind;
+  Token specialToken = null;
+  Token matchedToken;
+  int curPos = 0;
+
+  EOFLoop :
+  for (;;)
+  {   
+   try   
+   {     
+      curChar = input_stream.BeginToken();
+   }     
+   catch(java.io.IOException e)
+   {        
+      jjmatchedKind = 0;
+      matchedToken = jjFillToken();
+      matchedToken.specialToken = specialToken;
+      return matchedToken;
+   }
+   image = null;
+   jjimageLen = 0;
+
+   for (;;)
+   {
+     switch(curLexState)
+     {
+       case 0:
+         try { input_stream.backup(0);
+            while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
+               curChar = input_stream.BeginToken();
+         }
+         catch (java.io.IOException e1) { continue EOFLoop; }
+         jjmatchedKind = 0x7fffffff;
+         jjmatchedPos = 0;
+         curPos = jjMoveStringLiteralDfa0_0();
+         break;
+       case 1:
+         jjmatchedKind = 0x7fffffff;
+         jjmatchedPos = 0;
+         curPos = jjMoveStringLiteralDfa0_1();
+         if (jjmatchedPos == 0 && jjmatchedKind > 7)
+         {
+            jjmatchedKind = 7;
+         }
+         break;
+       case 2:
+         jjmatchedKind = 0x7fffffff;
+         jjmatchedPos = 0;
+         curPos = jjMoveStringLiteralDfa0_2();
+         if (jjmatchedPos == 0 && jjmatchedKind > 10)
+         {
+            jjmatchedKind = 10;
+         }
+         break;
+     }
+     if (jjmatchedKind != 0x7fffffff)
+     {
+        if (jjmatchedPos + 1 < curPos)
+           input_stream.backup(curPos - jjmatchedPos - 1);
+        if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+        {
+           matchedToken = jjFillToken();
+           matchedToken.specialToken = specialToken;
+       if (jjnewLexState[jjmatchedKind] != -1)
+         curLexState = jjnewLexState[jjmatchedKind];
+           return matchedToken;
+        }
+        else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+        {
+           if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
+           {
+              matchedToken = jjFillToken();
+              if (specialToken == null)
+                 specialToken = matchedToken;
+              else
+              {
+                 matchedToken.specialToken = specialToken;
+                 specialToken = (specialToken.next = matchedToken);
+              }
+              SkipLexicalActions(matchedToken);
+           }
+           else 
+              SkipLexicalActions(null);
+         if (jjnewLexState[jjmatchedKind] != -1)
+           curLexState = jjnewLexState[jjmatchedKind];
+           continue EOFLoop;
+        }
+        jjimageLen += jjmatchedPos + 1;
+      if (jjnewLexState[jjmatchedKind] != -1)
+        curLexState = jjnewLexState[jjmatchedKind];
+        curPos = 0;
+        jjmatchedKind = 0x7fffffff;
+        try {
+           curChar = input_stream.readChar();
+           continue;
+        }
+        catch (java.io.IOException e1) { }
+     }
+     int error_line = input_stream.getEndLine();
+     int error_column = input_stream.getEndColumn();
+     String error_after = null;
+     boolean EOFSeen = false;
+     try { input_stream.readChar(); input_stream.backup(1); }
+     catch (java.io.IOException e1) {
+        EOFSeen = true;
+        error_after = curPos <= 1 ? "" : input_stream.GetImage();
+        if (curChar == '\n' || curChar == '\r') {
+           error_line++;
+           error_column = 0;
+        }
+        else
+           error_column++;
+     }
+     if (!EOFSeen) {
+        input_stream.backup(1);
+        error_after = curPos <= 1 ? "" : input_stream.GetImage();
+     }
+     throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+   }
+  }
+}
+
+void SkipLexicalActions(Token matchedToken)
+{
+   switch(jjmatchedKind)
+   {
+      default :
+         break;
+   }
+}
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/SimpleCharStream.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/SimpleCharStream.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/SimpleCharStream.java
new file mode 100644
index 0000000..e38b451
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/SimpleCharStream.java
@@ -0,0 +1,457 @@
+/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.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.jute.compiler.generated;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public class SimpleCharStream
+{
+  public static final boolean staticFlag = false;
+  int bufsize;
+  int available;
+  int tokenBegin;
+  public int bufpos = -1;
+  protected int bufline[];
+  protected int bufcolumn[];
+
+  protected int column = 0;
+  protected int line = 1;
+
+  protected boolean prevCharIsCR = false;
+  protected boolean prevCharIsLF = false;
+
+  protected java.io.Reader inputStream;
+
+  protected char[] buffer;
+  protected int maxNextCharInd = 0;
+  protected int inBuf = 0;
+  protected int tabSize = 8;
+
+  protected void setTabSize(int i) { tabSize = i; }
+  protected int getTabSize(int i) { return tabSize; }
+
+
+  protected void ExpandBuff(boolean wrapAround)
+  {
+     char[] newbuffer = new char[bufsize + 2048];
+     int newbufline[] = new int[bufsize + 2048];
+     int newbufcolumn[] = new int[bufsize + 2048];
+
+     try
+     {
+        if (wrapAround)
+        {
+           System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+           System.arraycopy(buffer, 0, newbuffer,
+                                             bufsize - tokenBegin, bufpos);
+           buffer = newbuffer;
+
+           System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+           System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+           bufline = newbufline;
+
+           System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+           System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+           bufcolumn = newbufcolumn;
+
+           maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+        }
+        else
+        {
+           System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+           buffer = newbuffer;
+
+           System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+           bufline = newbufline;
+
+           System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+           bufcolumn = newbufcolumn;
+
+           maxNextCharInd = (bufpos -= tokenBegin);
+        }
+     }
+     catch (Throwable t)
+     {
+        throw new Error(t.getMessage());
+     }
+
+
+     bufsize += 2048;
+     available = bufsize;
+     tokenBegin = 0;
+  }
+
+  protected void FillBuff() throws java.io.IOException
+  {
+     if (maxNextCharInd == available)
+     {
+        if (available == bufsize)
+        {
+           if (tokenBegin > 2048)
+           {
+              bufpos = maxNextCharInd = 0;
+              available = tokenBegin;
+           }
+           else if (tokenBegin < 0)
+              bufpos = maxNextCharInd = 0;
+           else
+              ExpandBuff(false);
+        }
+        else if (available > tokenBegin)
+           available = bufsize;
+        else if ((tokenBegin - available) < 2048)
+           ExpandBuff(true);
+        else
+           available = tokenBegin;
+     }
+
+     int i;
+     try {
+        if ((i = inputStream.read(buffer, maxNextCharInd,
+                                    available - maxNextCharInd)) == -1)
+        {
+           inputStream.close();
+           throw new java.io.IOException();
+        }
+        else
+           maxNextCharInd += i;
+        return;
+     }
+     catch(java.io.IOException e) {
+        --bufpos;
+        backup(0);
+        if (tokenBegin == -1)
+           tokenBegin = bufpos;
+        throw e;
+     }
+  }
+
+  public char BeginToken() throws java.io.IOException
+  {
+     tokenBegin = -1;
+     char c = readChar();
+     tokenBegin = bufpos;
+
+     return c;
+  }
+
+  protected void UpdateLineColumn(char c)
+  {
+     column++;
+
+     if (prevCharIsLF)
+     {
+        prevCharIsLF = false;
+        line += (column = 1);
+     }
+     else if (prevCharIsCR)
+     {
+        prevCharIsCR = false;
+        if (c == '\n')
+        {
+           prevCharIsLF = true;
+        }
+        else
+           line += (column = 1);
+     }
+
+     switch (c)
+     {
+        case '\r' :
+           prevCharIsCR = true;
+           break;
+        case '\n' :
+           prevCharIsLF = true;
+           break;
+        case '\t' :
+           column--;
+           column += (tabSize - (column % tabSize));
+           break;
+        default :
+           break;
+     }
+
+     bufline[bufpos] = line;
+     bufcolumn[bufpos] = column;
+  }
+
+  public char readChar() throws java.io.IOException
+  {
+     if (inBuf > 0)
+     {
+        --inBuf;
+
+        if (++bufpos == bufsize)
+           bufpos = 0;
+
+        return buffer[bufpos];
+     }
+
+     if (++bufpos >= maxNextCharInd)
+        FillBuff();
+
+     char c = buffer[bufpos];
+
+     UpdateLineColumn(c);
+     return (c);
+  }
+
+  /**
+   * @deprecated 
+   * @see #getEndColumn
+   */
+
+  public int getColumn() {
+     return bufcolumn[bufpos];
+  }
+
+  /**
+   * @deprecated 
+   * @see #getEndLine
+   */
+
+  public int getLine() {
+     return bufline[bufpos];
+  }
+
+  public int getEndColumn() {
+     return bufcolumn[bufpos];
+  }
+
+  public int getEndLine() {
+     return bufline[bufpos];
+  }
+
+  public int getBeginColumn() {
+     return bufcolumn[tokenBegin];
+  }
+
+  public int getBeginLine() {
+     return bufline[tokenBegin];
+  }
+
+  public void backup(int amount) {
+
+    inBuf += amount;
+    if ((bufpos -= amount) < 0)
+       bufpos += bufsize;
+  }
+
+  public SimpleCharStream(java.io.Reader dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+    inputStream = dstream;
+    line = startline;
+    column = startcolumn - 1;
+
+    available = bufsize = buffersize;
+    buffer = new char[buffersize];
+    bufline = new int[buffersize];
+    bufcolumn = new int[buffersize];
+  }
+
+  public SimpleCharStream(java.io.Reader dstream, int startline,
+                          int startcolumn)
+  {
+     this(dstream, startline, startcolumn, 4096);
+  }
+
+  public SimpleCharStream(java.io.Reader dstream)
+  {
+     this(dstream, 1, 1, 4096);
+  }
+  public void ReInit(java.io.Reader dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+    inputStream = dstream;
+    line = startline;
+    column = startcolumn - 1;
+
+    if (buffer == null || buffersize != buffer.length)
+    {
+      available = bufsize = buffersize;
+      buffer = new char[buffersize];
+      bufline = new int[buffersize];
+      bufcolumn = new int[buffersize];
+    }
+    prevCharIsLF = prevCharIsCR = false;
+    tokenBegin = inBuf = maxNextCharInd = 0;
+    bufpos = -1;
+  }
+
+  public void ReInit(java.io.Reader dstream, int startline,
+                     int startcolumn)
+  {
+     ReInit(dstream, startline, startcolumn, 4096);
+  }
+
+  public void ReInit(java.io.Reader dstream)
+  {
+     ReInit(dstream, 1, 1, 4096);
+  }
+  public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
+  int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
+  {
+     this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+  }
+
+  public SimpleCharStream(java.io.InputStream dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+     this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
+  }
+
+  public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
+                          int startcolumn) throws java.io.UnsupportedEncodingException
+  {
+     this(dstream, encoding, startline, startcolumn, 4096);
+  }
+
+  public SimpleCharStream(java.io.InputStream dstream, int startline,
+                          int startcolumn)
+  {
+     this(dstream, startline, startcolumn, 4096);
+  }
+
+  public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
+  {
+     this(dstream, encoding, 1, 1, 4096);
+  }
+
+  public SimpleCharStream(java.io.InputStream dstream)
+  {
+     this(dstream, 1, 1, 4096);
+  }
+
+  public void ReInit(java.io.InputStream dstream, String encoding, int startline,
+                          int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
+  {
+     ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
+  }
+
+  public void ReInit(java.io.InputStream dstream, int startline,
+                          int startcolumn, int buffersize)
+  {
+     ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
+  }
+
+  public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
+  {
+     ReInit(dstream, encoding, 1, 1, 4096);
+  }
+
+  public void ReInit(java.io.InputStream dstream)
+  {
+     ReInit(dstream, 1, 1, 4096);
+  }
+  public void ReInit(java.io.InputStream dstream, String encoding, int startline,
+                     int startcolumn) throws java.io.UnsupportedEncodingException
+  {
+     ReInit(dstream, encoding, startline, startcolumn, 4096);
+  }
+  public void ReInit(java.io.InputStream dstream, int startline,
+                     int startcolumn)
+  {
+     ReInit(dstream, startline, startcolumn, 4096);
+  }
+  public String GetImage()
+  {
+     if (bufpos >= tokenBegin)
+        return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+     else
+        return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+                              new String(buffer, 0, bufpos + 1);
+  }
+
+  public char[] GetSuffix(int len)
+  {
+     char[] ret = new char[len];
+
+     if ((bufpos + 1) >= len)
+        System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+     else
+     {
+        System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+                                                          len - bufpos - 1);
+        System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+     }
+
+     return ret;
+  }
+
+  public void Done()
+  {
+     buffer = null;
+     bufline = null;
+     bufcolumn = null;
+  }
+
+  /**
+   * Method to adjust line and column numbers for the start of a token.
+   */
+  public void adjustBeginLineColumn(int newLine, int newCol)
+  {
+     int start = tokenBegin;
+     int len;
+
+     if (bufpos >= tokenBegin)
+     {
+        len = bufpos - tokenBegin + inBuf + 1;
+     }
+     else
+     {
+        len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+     }
+
+     int i = 0, j = 0, k = 0;
+     int nextColDiff = 0, columnDiff = 0;
+
+     while (i < len &&
+            bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+     {
+        bufline[j] = newLine;
+        nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+        bufcolumn[j] = newCol + columnDiff;
+        columnDiff = nextColDiff;
+        i++;
+     } 
+
+     if (i < len)
+     {
+        bufline[j] = newLine++;
+        bufcolumn[j] = newCol + columnDiff;
+
+        while (i++ < len)
+        {
+           if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+              bufline[j] = newLine++;
+           else
+              bufline[j] = newLine;
+        }
+     }
+
+     line = bufline[j];
+     column = bufcolumn[j];
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/Token.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/Token.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/Token.java
new file mode 100644
index 0000000..3e7018b
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/Token.java
@@ -0,0 +1,99 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.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.jute.compiler.generated;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token {
+
+  /**
+   * An integer that describes the kind of this token.  This numbering
+   * system is determined by JavaCCParser, and a table of these numbers is
+   * stored in the file ...Constants.java.
+   */
+  public int kind;
+
+  /**
+   * beginLine and beginColumn describe the position of the first character
+   * of this token; endLine and endColumn describe the position of the
+   * last character of this token.
+   */
+  public int beginLine, beginColumn, endLine, endColumn;
+
+  /**
+   * The string image of the token.
+   */
+  public String image;
+
+  /**
+   * A reference to the next regular (non-special) token from the input
+   * stream.  If this is the last token from the input stream, or if the
+   * token manager has not read tokens beyond this one, this field is
+   * set to null.  This is true only if this token is also a regular
+   * token.  Otherwise, see below for a description of the contents of
+   * this field.
+   */
+  public Token next;
+
+  /**
+   * This field is used to access special tokens that occur prior to this
+   * token, but after the immediately preceding regular (non-special) token.
+   * If there are no such special tokens, this field is set to null.
+   * When there are more than one such special token, this field refers
+   * to the last of these special tokens, which in turn refers to the next
+   * previous special token through its specialToken field, and so on
+   * until the first special token (whose specialToken field is null).
+   * The next fields of special tokens refer to other special tokens that
+   * immediately follow it (without an intervening regular token).  If there
+   * is no such token, this field is null.
+   */
+  public Token specialToken;
+
+  /**
+   * Returns the image.
+   */
+  public String toString()
+  {
+     return image;
+  }
+
+  /**
+   * Returns a new Token object, by default. However, if you want, you
+   * can create and return subclass objects based on the value of ofKind.
+   * Simply add the cases to the switch for all those special cases.
+   * For example, if you have a subclass of Token called IDToken that
+   * you want to create if ofKind is ID, simlpy add something like :
+   *
+   *    case MyParserConstants.ID : return new IDToken();
+   *
+   * to the following switch statement. Then you can cast matchedToken
+   * variable to the appropriate type and use it in your lexical actions.
+   */
+  public static final Token newToken(int ofKind)
+  {
+     switch(ofKind)
+     {
+       default : return new Token();
+     }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/TokenMgrError.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/TokenMgrError.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/TokenMgrError.java
new file mode 100644
index 0000000..e246962
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/TokenMgrError.java
@@ -0,0 +1,151 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.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.jute.compiler.generated;
+
+public class TokenMgrError extends Error
+{
+   /*
+    * Ordinals for various reasons why an Error of this type can be thrown.
+    */
+
+   /**
+    * Lexical error occured.
+    */
+   static final int LEXICAL_ERROR = 0;
+
+   /**
+    * An attempt wass made to create a second instance of a static token manager.
+    */
+   static final int STATIC_LEXER_ERROR = 1;
+
+   /**
+    * Tried to change to an invalid lexical state.
+    */
+   static final int INVALID_LEXICAL_STATE = 2;
+
+   /**
+    * Detected (and bailed out of) an infinite loop in the token manager.
+    */
+   static final int LOOP_DETECTED = 3;
+
+   /**
+    * Indicates the reason why the exception is thrown. It will have
+    * one of the above 4 values.
+    */
+   int errorCode;
+
+   /**
+    * Replaces unprintable characters by their espaced (or unicode escaped)
+    * equivalents in the given string
+    */
+   protected static final String addEscapes(String str) {
+      StringBuffer retval = new StringBuffer();
+      char ch;
+      for (int i = 0; i < str.length(); i++) {
+        switch (str.charAt(i))
+        {
+           case 0 :
+              continue;
+           case '\b':
+              retval.append("\\b");
+              continue;
+           case '\t':
+              retval.append("\\t");
+              continue;
+           case '\n':
+              retval.append("\\n");
+              continue;
+           case '\f':
+              retval.append("\\f");
+              continue;
+           case '\r':
+              retval.append("\\r");
+              continue;
+           case '\"':
+              retval.append("\\\"");
+              continue;
+           case '\'':
+              retval.append("\\\'");
+              continue;
+           case '\\':
+              retval.append("\\\\");
+              continue;
+           default:
+              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+                 String s = "0000" + Integer.toString(ch, 16);
+                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+              } else {
+                 retval.append(ch);
+              }
+              continue;
+        }
+      }
+      return retval.toString();
+   }
+
+   /**
+    * Returns a detailed message for the Error when it is thrown by the
+    * token manager to indicate a lexical error.
+    * Parameters : 
+    *    EOFSeen     : indicates if EOF caused the lexicl error
+    *    curLexState : lexical state in which this error occured
+    *    errorLine   : line number when the error occured
+    *    errorColumn : column number when the error occured
+    *    errorAfter  : prefix that was seen before this error occured
+    *    curchar     : the offending character
+    * Note: You can customize the lexical error message by modifying this method.
+    */
+   protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+      return("Lexical error at line " +
+           errorLine + ", column " +
+           errorColumn + ".  Encountered: " +
+           (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+           "after : \"" + addEscapes(errorAfter) + "\"");
+   }
+
+   /**
+    * You can also modify the body of this method to customize your error messages.
+    * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+    * of end-users concern, so you can return something like : 
+    *
+    *     "Internal Error : Please file a bug report .... "
+    *
+    * from this method for such cases in the release version of your parser.
+    */
+   public String getMessage() {
+      return super.getMessage();
+   }
+
+   /*
+    * Constructors of various flavors follow.
+    */
+
+   public TokenMgrError() {
+   }
+
+   public TokenMgrError(String message, int reason) {
+      super(message);
+      errorCode = reason;
+   }
+
+   public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+      this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+   }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/package.html
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/package.html b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/package.html
new file mode 100644
index 0000000..8ef8a8c
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/package.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+   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.
+-->
+
+<html>
+  <head>
+    <title>Hadoop Record Compiler: Parser</title>
+  </head>
+  <body>
+  This package contains code generated by JavaCC from the
+  Hadoop record syntax file rcc.jj. For details about the
+  record file syntax please @see org.apache.hadoop.record.
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/rcc.jj
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/rcc.jj b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/rcc.jj
new file mode 100644
index 0000000..94d4f42
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/rcc.jj
@@ -0,0 +1,374 @@
+options {
+STATIC=false;
+}
+
+PARSER_BEGIN(Rcc)
+/**
+ * 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.jute.compiler.generated;
+
+import org.apache.jute.compiler.*;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+@SuppressWarnings("unused")
+public class Rcc {
+    private static Hashtable<String, JRecord> recTab = new Hashtable<String, JRecord>();
+    private static String curDir = System.getProperty("user.dir");
+    private static String curFileName;
+    private static String curModuleName;
+
+    public static void main(String args[]) {
+        String language = "java";
+        ArrayList<String> recFiles = new ArrayList<String>();
+        JFile curFile=null;
+        
+        for (int i=0; i<args.length; i++) {
+            if ("-l".equalsIgnoreCase(args[i]) ||
+                "--language".equalsIgnoreCase(args[i])) {
+                language = args[i+1].toLowerCase();
+                i++;
+            } else {
+                recFiles.add(args[i]);
+            }
+        }
+        if (!"c++".equals(language) && !"java".equals(language) && !"c".equals(language)) {
+            System.out.println("Cannot recognize language:" + language);
+            System.exit(1);
+        }
+        if (recFiles.size() == 0) {
+            System.out.println("No record files specified. Exiting.");
+            System.exit(1);
+        }
+        for (int i=0; i<recFiles.size(); i++) {
+            curFileName = recFiles.get(i);
+            File file = new File(curFileName);
+            try {
+                curFile = parseFile(file);
+            } catch (FileNotFoundException e) {
+                System.out.println("File " + recFiles.get(i) + " Not found.");
+                System.exit(1);
+            } catch (ParseException e) {
+                System.out.println(e.toString());
+                System.exit(1);
+            }
+            System.out.println(recFiles.get(i) + " Parsed Successfully");
+            try {
+                curFile.genCode(language, new File("."));
+            } catch (IOException e) {
+                System.out.println(e.toString());
+                System.exit(1);
+            }
+        }
+    }
+
+    public static JFile parseFile(File file) throws FileNotFoundException, ParseException {
+        curDir = file.getParent();
+        curFileName = file.getName();
+        FileReader reader = new FileReader(file);
+        try {
+            Rcc parser = new Rcc(reader);
+            recTab = new Hashtable<String, JRecord>();
+            return parser.Input();
+        } finally {
+            try {
+                reader.close();
+            } catch (IOException e) {
+            }
+        }
+    }
+}
+
+PARSER_END(Rcc)
+
+SKIP :
+{
+  " "
+| "\t"
+| "\n"
+| "\r"
+}
+
+SPECIAL_TOKEN :
+{
+  "//" : WithinOneLineComment
+}
+
+<WithinOneLineComment> SPECIAL_TOKEN :
+{
+  <("\n" | "\r" | "\r\n" )> : DEFAULT
+}
+
+<WithinOneLineComment> MORE :
+{
+  <~[]>
+}
+
+SPECIAL_TOKEN :
+{
+  "/*" : WithinMultiLineComment
+}
+
+<WithinMultiLineComment> SPECIAL_TOKEN :
+{
+  "*/" : DEFAULT
+}
+
+<WithinMultiLineComment> MORE :
+{
+  <~[]>
+}
+
+TOKEN :
+{
+    <MODULE_TKN: "module">
+|   <RECORD_TKN: "class">
+|   <INCLUDE_TKN: "include">
+|   <BYTE_TKN: "byte">
+|   <BOOLEAN_TKN: "boolean">
+|   <INT_TKN: "int">
+|   <LONG_TKN: "long">
+|   <FLOAT_TKN: "float">
+|   <DOUBLE_TKN: "double">
+|   <USTRING_TKN: "ustring">
+|   <BUFFER_TKN: "buffer">
+|   <VECTOR_TKN: "vector">
+|   <MAP_TKN: "map">
+|   <LBRACE_TKN: "{">
+|   <RBRACE_TKN: "}">
+|   <LT_TKN: "<">
+|   <GT_TKN: ">">
+|   <SEMICOLON_TKN: ";">
+|   <COMMA_TKN: ",">
+|   <DOT_TKN: ".">
+|   <CSTRING_TKN: "\"" ( ~["\""] )+ "\"">
+|   <IDENT_TKN: ["A"-"Z","a"-"z"] (["a"-"z","A"-"Z","0"-"9","_"])*>
+}
+
+JFile Input() :
+{
+    ArrayList<JFile> ilist = new ArrayList<JFile>();
+    ArrayList<JRecord> rlist = new ArrayList<JRecord>();
+    JFile i;
+    ArrayList <JRecord>l;
+}
+{
+    (
+        i = Include()
+        { ilist.add(i); }
+    |   l = Module()
+        { rlist.addAll(l); }
+    )+
+    <EOF>
+    { return new JFile(curFileName, ilist, rlist); }
+}
+
+JFile Include() :
+{
+    String fname;
+    Token t;
+}
+{
+    <INCLUDE_TKN>
+    t = <CSTRING_TKN>
+    {
+        JFile ret = null;
+        fname = t.image.replaceAll("^\"", "").replaceAll("\"$","");
+        File file = new File(curDir, fname);
+        String tmpDir = curDir;
+        String tmpFile = curFileName;
+        curDir = file.getParent();
+        curFileName = file.getName();
+        try {
+            FileReader reader = new FileReader(file);
+            Rcc parser = new Rcc(reader);
+            try {
+                ret = parser.Input();
+                System.out.println(fname + " Parsed Successfully");
+            } catch (ParseException e) {
+                System.out.println(e.toString());
+                System.exit(1);
+            }
+            try {
+                reader.close();
+            } catch (IOException e) {
+            }
+        } catch (FileNotFoundException e) {
+            System.out.println("File " + fname +
+                " Not found.");
+            System.exit(1);
+        }
+        curDir = tmpDir;
+        curFileName = tmpFile;
+        return ret;
+    }
+}
+
+ArrayList<JRecord> Module() :
+{
+    String mName;
+    ArrayList<JRecord> rlist;
+}
+{
+    <MODULE_TKN>
+    mName = ModuleName()
+    { curModuleName = mName; }
+    <LBRACE_TKN>
+    rlist = RecordList()
+    <RBRACE_TKN>
+    { return rlist; }
+}
+
+String ModuleName() :
+{
+    String name = "";
+    Token t;
+}
+{
+    t = <IDENT_TKN>
+    { name += t.image; }
+    (
+        <DOT_TKN>
+        t = <IDENT_TKN>
+        { name += "." + t.image; }
+    )*
+    { return name; }
+}
+
+ArrayList<JRecord> RecordList() :
+{
+    ArrayList<JRecord> rlist = new ArrayList<JRecord>();
+    JRecord r;
+}
+{
+    (
+        r = Record()
+        { rlist.add(r); }
+    )+
+    { return rlist; }
+}
+
+JRecord Record() :
+{
+    String rname;
+    ArrayList<JField> flist = new ArrayList<JField>();
+    Token t;
+    JField f;
+}
+{
+    <RECORD_TKN>
+    t = <IDENT_TKN>
+    { rname = t.image; }
+    <LBRACE_TKN>
+    (
+        f = Field()
+        { flist.add(f); }
+        <SEMICOLON_TKN>
+    )+
+    <RBRACE_TKN>
+    {
+        String fqn = curModuleName + "." + rname;
+        JRecord r = new JRecord(fqn, flist);
+        recTab.put(fqn, r);
+        return r;
+    }
+}
+
+JField Field() :
+{
+    JType jt;
+    Token t;
+}
+{
+    jt = Type()
+    t = <IDENT_TKN>
+    { return new JField(jt, t.image); }
+}
+
+JType Type() :
+{
+    JType jt;
+    Token t;
+    String rname;
+}
+{
+    jt = Map()
+    { return jt; }
+|   jt = Vector()
+    { return jt; }
+|   <BYTE_TKN>
+    { return new JByte(); }
+|   <BOOLEAN_TKN>
+    { return new JBoolean(); }
+|   <INT_TKN>
+    { return new JInt(); }
+|   <LONG_TKN>
+    { return new JLong(); }
+|   <FLOAT_TKN>
+    { return new JFloat(); }
+|   <DOUBLE_TKN>
+    { return new JDouble(); }
+|   <USTRING_TKN>
+    { return new JString(); }
+|   <BUFFER_TKN>
+    { return new JBuffer(); }
+|   rname = ModuleName()
+    {
+        if (rname.indexOf('.', 0) < 0) {
+            rname = curModuleName + "." + rname;
+        }
+        JRecord r = recTab.get(rname);
+        if (r == null) {
+            System.out.println("Type " + rname + " not known. Exiting.");
+            System.exit(1);
+        }
+        return r;
+    }
+}
+
+JMap Map() :
+{
+    JType jt1;
+    JType jt2;
+}
+{
+    <MAP_TKN>
+    <LT_TKN>
+    jt1 = Type()
+    <COMMA_TKN>
+    jt2 = Type()
+    <GT_TKN>
+    { return new JMap(jt1, jt2); }
+}
+
+JVector Vector() :
+{
+    JType jt;
+}
+{
+    <VECTOR_TKN>
+    <LT_TKN>
+    jt = Type()
+    <GT_TKN>
+    { return new JVector(jt); }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/package.html
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/package.html b/zookeeper-jute/src/main/java/org/apache/jute/compiler/package.html
new file mode 100644
index 0000000..03bdb1b
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/package.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+   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.
+-->
+
+<html>
+  <head>
+    <title>Hadoop Record Compiler</title>
+  </head>
+  <body>
+  This package contains classes needed for code generation
+  from the hadoop record compiler. CppGenerator and JavaGenerator
+  are the main entry points from the parser. There are classes
+  corrsponding to every primitive type and compound type
+  included in Hadoop record I/O syntax.
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/package.html
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/package.html b/zookeeper-jute/src/main/java/org/apache/jute/package.html
new file mode 100644
index 0000000..531a6e3
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/package.html
@@ -0,0 +1,801 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+   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.
+-->
+
+<html>
+  <head>
+    <title>Hadoop Record I/O</title>
+  </head>
+  <body>
+  Hadoop record I/O contains classes and a record description language
+  translator for simplifying serialization and deserialization of records in a
+  language-neutral manner.
+  
+  <h2>Introduction</h2>
+  
+  Software systems of any significant complexity require mechanisms for data 
+interchange with the outside world. These interchanges typically involve the
+marshaling and unmarshaling of logical units of data to and from data streams
+(files, network connections, memory buffers etc.). Applications usually have
+some code for serializing and deserializing the data types that they manipulate
+embedded in them. The work of serialization has several features that make
+automatic code generation for it worthwhile. Given a particular output encoding
+(binary, XML, etc.), serialization of primitive types and simple compositions
+of primitives (structs, vectors etc.) is a very mechanical task. Manually
+written serialization code can be susceptible to bugs especially when records
+have a large number of fields or a record definition changes between software
+versions. Lastly, it can be very useful for applications written in different
+programming languages to be able to share and interchange data. This can be 
+made a lot easier by describing the data records manipulated by these
+applications in a language agnostic manner and using the descriptions to derive
+implementations of serialization in multiple target languages. 
+
+This document describes Hadoop Record I/O, a mechanism that is aimed 
+at
+<ul> 
+<li> enabling the specification of simple serializable data types (records) 
+<li> enabling the generation of code in multiple target languages for
+marshaling and unmarshaling such types
+<li> providing target language specific support that will enable application 
+programmers to incorporate generated code into their applications
+</ul>
+
+The goals of Hadoop Record I/O are similar to those of mechanisms such as XDR,
+ASN.1, PADS and ICE. While these systems all include a DDL that enables
+the specification of most record types, they differ widely in what else they
+focus on. The focus in Hadoop Record I/O is on data marshaling and
+multi-lingual support.  We take a translator-based approach to serialization.
+Hadoop users have to describe their data in a simple data description
+language. The Hadoop DDL translator rcc generates code that users
+can invoke in order to read/write their data from/to simple stream 
+abstractions. Next we list explicitly some of the goals and non-goals of
+Hadoop Record I/O.
+
+
+<h3>Goals</h3>
+
+<ul>
+<li> Support for commonly used primitive types. Hadoop should include as
+primitives commonly used builtin types from programming languages we intend to
+support.
+
+<li> Support for common data compositions (including recursive compositions).
+Hadoop should support widely used composite types such as structs and
+vectors.
+
+<li> Code generation in multiple target languages. Hadoop should be capable of
+generating serialization code in multiple target languages and should be
+easily extensible to new target languages. The initial target languages are
+C++ and Java.
+
+<li> Support for generated target languages. Hadooop should include support
+in the form of headers, libraries, packages for supported target languages 
+that enable easy inclusion and use of generated code in applications.
+
+<li> Support for multiple output encodings. Candidates include
+packed binary, comma-separated text, XML etc.
+
+<li> Support for specifying record types in a backwards/forwards compatible
+manner. This will probably be in the form of support for optional fields in
+records. This version of the document does not include a description of the
+planned mechanism, we intend to include it in the next iteration.
+
+</ul>
+
+<h3>Non-Goals</h3>
+
+<ul>
+  <li> Serializing existing arbitrary C++ classes.
+  <li> Serializing complex data structures such as trees, linked lists etc.
+  <li> Built-in indexing schemes, compression, or check-sums.
+  <li> Dynamic construction of objects from an XML schema.
+</ul>
+
+The remainder of this document describes the features of Hadoop record I/O
+in more detail. Section 2 describes the data types supported by the system.
+Section 3 lays out the DDL syntax with some examples of simple records. 
+Section 4 describes the process of code generation with rcc. Section 5
+describes target language mappings and support for Hadoop types. We include a
+fairly complete description of C++ mappings with intent to include Java and
+others in upcoming iterations of this document. The last section talks about
+supported output encodings.
+
+
+<h2>Data Types and Streams</h2>
+
+This section describes the primitive and composite types supported by Hadoop.
+We aim to support a set of types that can be used to simply and efficiently
+express a wide range of record types in different programming languages.
+
+<h3>Primitive Types</h3>
+
+For the most part, the primitive types of Hadoop map directly to primitive
+types in high level programming languages. Special cases are the
+ustring (a Unicode string) and buffer types, which we believe
+find wide use and which are usually implemented in library code and not
+available as language built-ins. Hadoop also supplies these via library code
+when a target language built-in is not present and there is no widely
+adopted "standard" implementation. The complete list of primitive types is:
+
+<ul>
+  <li> byte: An 8-bit unsigned integer.
+  <li> boolean: A boolean value.
+  <li> int: A 32-bit signed integer.
+  <li> long: A 64-bit signed integer.
+  <li> float: A single precision floating point number as described by
+    IEEE-754.
+  <li> double: A double precision floating point number as described by
+    IEEE-754.
+  <li> ustring: A string consisting of Unicode characters.
+  <li> buffer: An arbitrary sequence of bytes. 
+</ul>
+
+
+<h3>Composite Types</h3>
+Hadoop supports a small set of composite types that enable the description
+of simple aggregate types and containers. A composite type is serialized
+by sequentially serializing it constituent elements. The supported
+composite types are:
+
+<ul>
+
+  <li> record: An aggregate type like a C-struct. This is a list of
+typed fields that are together considered a single unit of data. A record
+is serialized by sequentially serializing its constituent fields. In addition
+to serialization a record has comparison operations (equality and less-than)
+implemented for it, these are defined as memberwise comparisons.
+
+  <li>vector: A sequence of entries of the same data type, primitive
+or composite.
+
+  <li> map: An associative container mapping instances of a key type to
+instances of a value type. The key and value types may themselves be primitive
+or composite types. 
+
+</ul>
+
+<h3>Streams</h3>
+
+Hadoop generates code for serializing and deserializing record types to
+abstract streams. For each target language Hadoop defines very simple input
+and output stream interfaces. Application writers can usually develop
+concrete implementations of these by putting a one method wrapper around
+an existing stream implementation.
+
+
+<h2>DDL Syntax and Examples</h2>
+
+We now describe the syntax of the Hadoop data description language. This is
+followed by a few examples of DDL usage.
+ 
+<h3>Hadoop DDL Syntax</h3>
+
+<pre><code>
+recfile = *include module *record
+include = "include" path
+path = (relative-path / absolute-path)
+module = "module" module-name
+module-name = name *("." name)
+record := "class" name "{" 1*(field) "}"
+field := type name ";"
+name :=  ALPHA (ALPHA / DIGIT / "_" )*
+type := (ptype / ctype)
+ptype := ("byte" / "boolean" / "int" |
+          "long" / "float" / "double"
+          "ustring" / "buffer")
+ctype := (("vector" "<" type ">") /
+          ("map" "<" type "," type ">" ) ) / name)
+</code></pre>
+
+A DDL file describes one or more record types. It begins with zero or
+more include declarations, a single mandatory module declaration
+followed by zero or more class declarations. The semantics of each of
+these declarations are described below:
+
+<ul>
+
+<li>include: An include declaration specifies a DDL file to be
+referenced when generating code for types in the current DDL file. Record types
+in the current compilation unit may refer to types in all included files.
+File inclusion is recursive. An include does not trigger code
+generation for the referenced file.
+
+<li> module: Every Hadoop DDL file must have a single module
+declaration that follows the list of includes and precedes all record
+declarations. A module declaration identifies a scope within which
+the names of all types in the current file are visible. Module names are
+mapped to C++ namespaces, Java packages etc. in generated code.
+
+<li> class: Records types are specified through class
+declarations. A class declaration is like a Java class declaration.
+It specifies a named record type and a list of fields that constitute records
+of the type. Usage is illustrated in the following examples.
+
+</ul>
+
+<h3>Examples</h3>
+
+<ul>
+<li>A simple DDL file links.jr with just one record declaration. 
+<pre><code>
+module links {
+    class Link {
+        ustring URL;
+        boolean isRelative;
+        ustring anchorText;
+    };
+}
+</code></pre>
+
+<li> A DDL file outlinks.jr which includes another
+<pre><code>
+include "links.jr"
+
+module outlinks {
+    class OutLinks {
+        ustring baseURL;
+        vector<links.Link> outLinks;
+    };
+}
+</code></pre>
+</ul>
+
+<h2>Code Generation</h2>
+
+The Hadoop translator is written in Java. Invocation is done by executing a 
+wrapper shell script named named rcc. It takes a list of
+record description files as a mandatory argument and an
+optional language argument (the default is Java) --language or
+-l. Thus a typical invocation would look like:
+<pre><code>
+$ rcc -l C++ <filename> ...
+</code></pre>
+
+
+<h2>Target Language Mappings and Support</h2>
+
+For all target languages, the unit of code generation is a record type. 
+For each record type, Hadoop generates code for serialization and
+deserialization, record comparison and access to record members.
+
+<h3>C++</h3>
+
+Support for including Hadoop generated C++ code in applications comes in the
+form of a header file recordio.hh which needs to be included in source
+that uses Hadoop types and a library librecordio.a which applications need
+to be linked with. The header declares the Hadoop C++ namespace which defines
+appropriate types for the various primitives, the basic interfaces for
+records and streams and enumerates the supported serialization encodings.
+Declarations of these interfaces and a description of their semantics follow:
+
+<pre><code>
+namespace hadoop {
+
+  enum RecFormat { kBinary, kXML, kCSV };
+
+  class InStream {
+  public:
+    virtual ssize_t read(void *buf, size_t n) = 0;
+  };
+
+  class OutStream {
+  public:
+    virtual ssize_t write(const void *buf, size_t n) = 0;
+  };
+
+  class IOError : public runtime_error {
+  public:
+    explicit IOError(const std::string& msg);
+  };
+
+  class IArchive;
+  class OArchive;
+
+  class RecordReader {
+  public:
+    RecordReader(InStream& in, RecFormat fmt);
+    virtual ~RecordReader(void);
+
+    virtual void read(Record& rec);
+  };
+
+  class RecordWriter {
+  public:
+    RecordWriter(OutStream& out, RecFormat fmt);
+    virtual ~RecordWriter(void);
+
+    virtual void write(Record& rec);
+  };
+
+
+  class Record {
+  public:
+    virtual std::string type(void) const = 0;
+    virtual std::string signature(void) const = 0;
+  protected:
+    virtual bool validate(void) const = 0;
+
+    virtual void
+    serialize(OArchive& oa, const std::string& tag) const = 0;
+
+    virtual void
+    deserialize(IArchive& ia, const std::string& tag) = 0;
+  };
+}
+</code></pre>
+
+<ul>
+
+<li> RecFormat: An enumeration of the serialization encodings supported
+by this implementation of Hadoop.
+
+<li> InStream: A simple abstraction for an input stream. This has a 
+single public read method that reads n bytes from the stream into
+the buffer buf. Has the same semantics as a blocking read system
+call. Returns the number of bytes read or -1 if an error occurs.
+
+<li> OutStream: A simple abstraction for an output stream. This has a 
+single write method that writes n bytes to the stream from the
+buffer buf. Has the same semantics as a blocking write system
+call. Returns the number of bytes written or -1 if an error occurs.
+
+<li> RecordReader: A RecordReader reads records one at a time from
+an underlying stream in a specified record format. The reader is instantiated
+with a stream and a serialization format. It has a read method that
+takes an instance of a record and deserializes the record from the stream.
+
+<li> RecordWriter: A RecordWriter writes records one at a
+time to an underlying stream in a specified record format. The writer is
+instantiated with a stream and a serialization format. It has a
+write method that takes an instance of a record and serializes the
+record to the stream.
+
+<li> Record: The base class for all generated record types. This has two
+public methods type and signature that return the typename and the
+type signature of the record.
+
+</ul>
+
+Two files are generated for each record file (note: not for each record). If a
+record file is named "name.jr", the generated files are 
+"name.jr.cc" and "name.jr.hh" containing serialization 
+implementations and record type declarations respectively.
+
+For each record in the DDL file, the generated header file will contain a
+class definition corresponding to the record type, method definitions for the
+generated type will be present in the '.cc' file.  The generated class will
+inherit from the abstract class hadoop::Record. The DDL files
+module declaration determines the namespace the record belongs to.
+Each '.' delimited token in the module declaration results in the
+creation of a namespace. For instance, the declaration module docs.links
+results in the creation of a docs namespace and a nested 
+docs::links namespace. In the preceding examples, the Link class
+is placed in the links namespace. The header file corresponding to
+the links.jr file will contain:
+
+<pre><code>
+namespace links {
+  class Link : public hadoop::Record {
+    // ....
+  };
+};
+</code></pre>
+
+Each field within the record will cause the generation of a private member
+declaration of the appropriate type in the class declaration, and one or more
+acccessor methods. The generated class will implement the serialize and
+deserialize methods defined in hadoop::Record+. It will also 
+implement the inspection methods type and signature from
+hadoop::Record. A default constructor and virtual destructor will also
+be generated. Serialization code will read/write records into streams that
+implement the hadoop::InStream and the hadoop::OutStream interfaces.
+
+For each member of a record an accessor method is generated that returns 
+either the member or a reference to the member. For members that are returned 
+by value, a setter method is also generated. This is true for primitive 
+data members of the types byte, int, long, boolean, float and 
+double. For example, for a int field called MyField the folowing
+code is generated.
+
+<pre><code>
+...
+private:
+  int32_t mMyField;
+  ...
+public:
+  int32_t getMyField(void) const {
+    return mMyField;
+  };
+
+  void setMyField(int32_t m) {
+    mMyField = m;
+  };
+  ...
+</code></pre>
+
+For a ustring or buffer or composite field. The generated code
+only contains accessors that return a reference to the field. A const
+and a non-const accessor are generated. For example:
+
+<pre><code>
+...
+private:
+  std::string mMyBuf;
+  ...
+public:
+
+  std::string& getMyBuf() {
+    return mMyBuf;
+  };
+
+  const std::string& getMyBuf() const {
+    return mMyBuf;
+  };
+  ...
+</code></pre>
+
+<h4>Examples</h4>
+
+Suppose the inclrec.jr file contains:
+<pre><code>
+module inclrec {
+    class RI {
+        int      I32;
+        double   D;
+        ustring  S;
+    };
+}
+</code></pre>
+
+and the testrec.jr file contains:
+
+<pre><code>
+include "inclrec.jr"
+module testrec {
+    class R {
+        vector<float> VF;
+        RI            Rec;
+        buffer        Buf;
+    };
+}
+</code></pre>
+
+Then the invocation of rcc such as:
+<pre><code>
+$ rcc -l c++ inclrec.jr testrec.jr
+</code></pre>
+will result in generation of four files:
+inclrec.jr.{cc,hh} and testrec.jr.{cc,hh}.
+
+The inclrec.jr.hh will contain:
+
+<pre><code>
+#ifndef _INCLREC_JR_HH_
+#define _INCLREC_JR_HH_
+
+#include "recordio.hh"
+
+namespace inclrec {
+  
+  class RI : public hadoop::Record {
+
+  private:
+
+    int32_t      mI32;
+    double       mD;
+    std::string  mS;
+
+  public:
+
+    RI(void);
+    virtual ~RI(void);
+
+    virtual bool operator==(const RI& peer) const;
+    virtual bool operator<(const RI& peer) const;
+
+    virtual int32_t getI32(void) const { return mI32; }
+    virtual void setI32(int32_t v) { mI32 = v; }
+
+    virtual double getD(void) const { return mD; }
+    virtual void setD(double v) { mD = v; }
+
+    virtual std::string& getS(void) const { return mS; }
+    virtual const std::string& getS(void) const { return mS; }
+
+    virtual std::string type(void) const;
+    virtual std::string signature(void) const;
+
+  protected:
+
+    virtual void serialize(hadoop::OArchive& a) const;
+    virtual void deserialize(hadoop::IArchive& a);
+
+    virtual bool validate(void);
+  };
+} // end namespace inclrec
+
+#endif /* _INCLREC_JR_HH_ */
+
+</code></pre>
+
+The testrec.jr.hh file will contain:
+
+
+<pre><code>
+
+#ifndef _TESTREC_JR_HH_
+#define _TESTREC_JR_HH_
+
+#include "inclrec.jr.hh"
+
+namespace testrec {
+  class R : public hadoop::Record {
+
+  private:
+
+    std::vector<float> mVF;
+    inclrec::RI        mRec;
+    std::string        mBuf;
+
+  public:
+
+    R(void);
+    virtual ~R(void);
+
+    virtual bool operator==(const R& peer) const;
+    virtual bool operator<(const R& peer) const;
+
+    virtual std::vector<float>& getVF(void) const;
+    virtual const std::vector<float>& getVF(void) const;
+
+    virtual std::string& getBuf(void) const ;
+    virtual const std::string& getBuf(void) const;
+
+    virtual inclrec::RI& getRec(void) const;
+    virtual const inclrec::RI& getRec(void) const;
+    
+    virtual bool serialize(hadoop::OutArchive& a) const;
+    virtual bool deserialize(hadoop::InArchive& a);
+    
+    virtual std::string type(void) const;
+    virtual std::string signature(void) const;
+  };
+}; // end namespace testrec
+#endif /* _TESTREC_JR_HH_ */
+
+</code></pre>
+
+<h3>Java</h3>
+
+Code generation for Java is similar to that for C++. A Java class is generated
+for each record type with private members corresponding to the fields. Getters
+and setters for fields are also generated. Some differences arise in the
+way comparison is expressed and in the mapping of modules to packages and
+classes to files. For equality testing, an equals method is generated
+for each record type. As per Java requirements a hashCode method is also
+generated. For comparison a compareTo method is generated for each
+record type. This has the semantics as defined by the Java Comparable
+interface, that is, the method returns a negative integer, zero, or a positive
+integer as the invoked object is less than, equal to, or greater than the
+comparison parameter.
+
+A .java file is generated per record type as opposed to per DDL
+file as in C++. The module declaration translates to a Java
+package declaration. The module name maps to an identical Java package
+name. In addition to this mapping, the DDL compiler creates the appropriate
+directory hierarchy for the package and places the generated .java
+files in the correct directories.
+
+<h2>Mapping Summary</h2>
+
+<pre><code>
+DDL Type        C++ Type            Java Type 
+
+boolean         bool                boolean
+byte            int8_t              byte
+int             int32_t             int
+long            int64_t             long
+float           float               float
+double          double              double
+ustring         std::string         Text
+buffer          std::string         java.io.ByteArrayOutputStream
+class type      class type          class type
+vector<type>    std::vector<type>   java.util.ArrayList
+map<type,type>  std::map<type,type> java.util.TreeMap
+</code></pre>
+
+<h2>Data encodings</h2>
+
+This section describes the format of the data encodings supported by Hadoop.
+Currently, three data encodings are supported, namely binary, CSV and XML.
+
+<h3>Binary Serialization Format</h3>
+
+The binary data encoding format is fairly dense. Serialization of composite
+types is simply defined as a concatenation of serializations of the constituent
+elements (lengths are included in vectors and maps).
+
+Composite types are serialized as follows:
+<ul>
+<li> class: Sequence of serialized members.
+<li> vector: The number of elements serialized as an int. Followed by a
+sequence of serialized elements.
+<li> map: The number of key value pairs serialized as an int. Followed
+by a sequence of serialized (key,value) pairs.
+</ul>
+
+Serialization of primitives is more interesting, with a zero compression
+optimization for integral types and normalization to UTF-8 for strings. 
+Primitive types are serialized as follows:
+
+<ul>
+<li> byte: Represented by 1 byte, as is.
+<li> boolean: Represented by 1-byte (0 or 1)
+<li> int/long: Integers and longs are serialized zero compressed.
+Represented as 1-byte if -120 <= value < 128. Otherwise, serialized as a
+sequence of 2-5 bytes for ints, 2-9 bytes for longs. The first byte represents
+the number of trailing bytes, N, as the negative number (-120-N). For example,
+the number 1024 (0x400) is represented by the byte sequence 'x86 x04 x00'.
+This doesn't help much for 4-byte integers but does a reasonably good job with
+longs without bit twiddling.
+<li> float/double: Serialized in IEEE 754 single and double precision
+format in network byte order. This is the format used by Java.
+<li> ustring: Serialized as 4-byte zero compressed length followed by
+data encoded as UTF-8. Strings are normalized to UTF-8 regardless of native
+language representation.
+<li> buffer: Serialized as a 4-byte zero compressed length followed by the
+raw bytes in the buffer.
+</ul>
+
+
+<h3>CSV Serialization Format</h3>
+
+The CSV serialization format has a lot more structure than the "standard"
+Excel CSV format, but we believe the additional structure is useful because
+
+<ul>
+<li> it makes parsing a lot easier without detracting too much from legibility
+<li> the delimiters around composites make it obvious when one is reading a
+sequence of Hadoop records
+</ul>
+
+Serialization formats for the various types are detailed in the grammar that
+follows. The notable feature of the formats is the use of delimiters for 
+indicating the certain field types.
+
+<ul>
+<li> A string field begins with a single quote (').
+<li> A buffer field begins with a sharp (#).
+<li> A class, vector or map begins with 's{', 'v{' or 'm{' respectively and
+ends with '}'.
+</ul>
+
+The CSV format can be described by the following grammar:
+
+<pre><code>
+record = primitive / struct / vector / map
+primitive = boolean / int / long / float / double / ustring / buffer
+
+boolean = "T" / "F"
+int = ["-"] 1*DIGIT
+long = ";" ["-"] 1*DIGIT
+float = ["-"] 1*DIGIT "." 1*DIGIT ["E" / "e" ["-"] 1*DIGIT]
+double = ";" ["-"] 1*DIGIT "." 1*DIGIT ["E" / "e" ["-"] 1*DIGIT]
+
+ustring = "'" *(UTF8 char except NULL, LF, % and , / "%00" / "%0a" / "%25" / "%2c" )
+
+buffer = "#" *(BYTE except NULL, LF, % and , / "%00" / "%0a" / "%25" / "%2c" )
+
+struct = "s{" record *("," record) "}"
+vector = "v{" [record *("," record)] "}"
+map = "m{" [*(record "," record)] "}"
+</code></pre>
+
+<h3>XML Serialization Format</h3>
+
+The XML serialization format is the same used by Apache XML-RPC
+(http://ws.apache.org/xmlrpc/types.html). This is an extension of the original
+XML-RPC format and adds some additional data types. All record I/O types are
+not directly expressible in this format, and access to a DDL is required in
+order to convert these to valid types. All types primitive or composite are
+represented by &lt;value&gt; elements. The particular XML-RPC type is
+indicated by a nested element in the &lt;value&gt; element. The encoding for
+records is always UTF-8. Primitive types are serialized as follows:
+
+<ul>
+<li> byte: XML tag &lt;ex:i1&gt;. Values: 1-byte unsigned 
+integers represented in US-ASCII
+<li> boolean: XML tag &lt;boolean&gt;. Values: "0" or "1"
+<li> int: XML tags &lt;i4&gt; or &lt;int&gt;. Values: 4-byte
+signed integers represented in US-ASCII.
+<li> long: XML tag &lt;ex:i8&gt;. Values: 8-byte signed integers
+represented in US-ASCII.
+<li> float: XML tag &lt;ex:float&gt;. Values: Single precision
+floating point numbers represented in US-ASCII.
+<li> double: XML tag &lt;double&gt;. Values: Double precision
+floating point numbers represented in US-ASCII.
+<li> ustring: XML tag &lt;;string&gt;. Values: String values
+represented as UTF-8. XML does not permit all Unicode characters in literal
+data. In particular, NULLs and control chars are not allowed. Additionally,
+XML processors are required to replace carriage returns with line feeds and to
+replace CRLF sequences with line feeds. Programming languages that we work
+with do not impose these restrictions on string types. To work around these
+restrictions, disallowed characters and CRs are percent escaped in strings.
+The '%' character is also percent escaped.
+<li> buffer: XML tag &lt;string&&gt;. Values: Arbitrary binary
+data. Represented as hexBinary, each byte is replaced by its 2-byte
+hexadecimal representation.
+</ul>
+
+Composite types are serialized as follows:
+
+<ul>
+<li> class: XML tag &lt;struct&gt;. A struct is a sequence of
+&lt;member&gt; elements. Each &lt;member&gt; element has a &lt;name&gt;
+element and a &lt;value&gt; element. The &lt;name&gt; is a string that must
+match /[a-zA-Z][a-zA-Z0-9_]*/. The value of the member is represented
+by a &lt;value&gt; element.
+
+<li> vector: XML tag &lt;array&lt;. An &lt;array&gt; contains a
+single &lt;data&gt; element. The &lt;data&gt; element is a sequence of
+&lt;value&gt; elements each of which represents an element of the vector.
+
+<li> map: XML tag &lt;array&gt;. Same as vector.
+
+</ul>
+
+For example:
+
+<pre><code>
+class {
+  int           MY_INT;            // value 5
+  vector<float> MY_VEC;            // values 0.1, -0.89, 2.45e4
+  buffer        MY_BUF;            // value '\00\n\tabc%'
+}
+</code></pre>
+
+is serialized as
+
+<pre><code class="XML">
+&lt;value&gt;
+  &lt;struct&gt;
+    &lt;member&gt;
+      &lt;name&gt;MY_INT&lt;/name&gt;
+      &lt;value&gt;&lt;i4&gt;5&lt;/i4&gt;&lt;/value&gt;
+    &lt;/member&gt;
+    &lt;member&gt;
+      &lt;name&gt;MY_VEC&lt;/name&gt;
+      &lt;value&gt;
+        &lt;array&gt;
+          &lt;data&gt;
+            &lt;value&gt;&lt;ex:float&gt;0.1&lt;/ex:float&gt;&lt;/value&gt;
+            &lt;value&gt;&lt;ex:float&gt;-0.89&lt;/ex:float&gt;&lt;/value&gt;
+            &lt;value&gt;&lt;ex:float&gt;2.45e4&lt;/ex:float&gt;&lt;/value&gt;
+          &lt;/data&gt;
+        &lt;/array&gt;
+      &lt;/value&gt;
+    &lt;/member&gt;
+    &lt;member&gt;
+      &lt;name&gt;MY_BUF&lt;/name&gt;
+      &lt;value&gt;&lt;string&gt;%00\n\tabc%25&lt;/string&gt;&lt;/value&gt;
+    &lt;/member&gt;
+  &lt;/struct&gt;
+&lt;/value&gt; 
+</code></pre>
+
+  </body>
+</html>


[5/8] zookeeper git commit: ZOOKEEPER-3080_3.4: MAVEN MIGRATION - Step 1.5 - move jute dir

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/generated/rcc.jj
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/generated/rcc.jj b/src/java/main/org/apache/jute/compiler/generated/rcc.jj
deleted file mode 100644
index 94d4f42..0000000
--- a/src/java/main/org/apache/jute/compiler/generated/rcc.jj
+++ /dev/null
@@ -1,374 +0,0 @@
-options {
-STATIC=false;
-}
-
-PARSER_BEGIN(Rcc)
-/**
- * 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.jute.compiler.generated;
-
-import org.apache.jute.compiler.*;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-@SuppressWarnings("unused")
-public class Rcc {
-    private static Hashtable<String, JRecord> recTab = new Hashtable<String, JRecord>();
-    private static String curDir = System.getProperty("user.dir");
-    private static String curFileName;
-    private static String curModuleName;
-
-    public static void main(String args[]) {
-        String language = "java";
-        ArrayList<String> recFiles = new ArrayList<String>();
-        JFile curFile=null;
-        
-        for (int i=0; i<args.length; i++) {
-            if ("-l".equalsIgnoreCase(args[i]) ||
-                "--language".equalsIgnoreCase(args[i])) {
-                language = args[i+1].toLowerCase();
-                i++;
-            } else {
-                recFiles.add(args[i]);
-            }
-        }
-        if (!"c++".equals(language) && !"java".equals(language) && !"c".equals(language)) {
-            System.out.println("Cannot recognize language:" + language);
-            System.exit(1);
-        }
-        if (recFiles.size() == 0) {
-            System.out.println("No record files specified. Exiting.");
-            System.exit(1);
-        }
-        for (int i=0; i<recFiles.size(); i++) {
-            curFileName = recFiles.get(i);
-            File file = new File(curFileName);
-            try {
-                curFile = parseFile(file);
-            } catch (FileNotFoundException e) {
-                System.out.println("File " + recFiles.get(i) + " Not found.");
-                System.exit(1);
-            } catch (ParseException e) {
-                System.out.println(e.toString());
-                System.exit(1);
-            }
-            System.out.println(recFiles.get(i) + " Parsed Successfully");
-            try {
-                curFile.genCode(language, new File("."));
-            } catch (IOException e) {
-                System.out.println(e.toString());
-                System.exit(1);
-            }
-        }
-    }
-
-    public static JFile parseFile(File file) throws FileNotFoundException, ParseException {
-        curDir = file.getParent();
-        curFileName = file.getName();
-        FileReader reader = new FileReader(file);
-        try {
-            Rcc parser = new Rcc(reader);
-            recTab = new Hashtable<String, JRecord>();
-            return parser.Input();
-        } finally {
-            try {
-                reader.close();
-            } catch (IOException e) {
-            }
-        }
-    }
-}
-
-PARSER_END(Rcc)
-
-SKIP :
-{
-  " "
-| "\t"
-| "\n"
-| "\r"
-}
-
-SPECIAL_TOKEN :
-{
-  "//" : WithinOneLineComment
-}
-
-<WithinOneLineComment> SPECIAL_TOKEN :
-{
-  <("\n" | "\r" | "\r\n" )> : DEFAULT
-}
-
-<WithinOneLineComment> MORE :
-{
-  <~[]>
-}
-
-SPECIAL_TOKEN :
-{
-  "/*" : WithinMultiLineComment
-}
-
-<WithinMultiLineComment> SPECIAL_TOKEN :
-{
-  "*/" : DEFAULT
-}
-
-<WithinMultiLineComment> MORE :
-{
-  <~[]>
-}
-
-TOKEN :
-{
-    <MODULE_TKN: "module">
-|   <RECORD_TKN: "class">
-|   <INCLUDE_TKN: "include">
-|   <BYTE_TKN: "byte">
-|   <BOOLEAN_TKN: "boolean">
-|   <INT_TKN: "int">
-|   <LONG_TKN: "long">
-|   <FLOAT_TKN: "float">
-|   <DOUBLE_TKN: "double">
-|   <USTRING_TKN: "ustring">
-|   <BUFFER_TKN: "buffer">
-|   <VECTOR_TKN: "vector">
-|   <MAP_TKN: "map">
-|   <LBRACE_TKN: "{">
-|   <RBRACE_TKN: "}">
-|   <LT_TKN: "<">
-|   <GT_TKN: ">">
-|   <SEMICOLON_TKN: ";">
-|   <COMMA_TKN: ",">
-|   <DOT_TKN: ".">
-|   <CSTRING_TKN: "\"" ( ~["\""] )+ "\"">
-|   <IDENT_TKN: ["A"-"Z","a"-"z"] (["a"-"z","A"-"Z","0"-"9","_"])*>
-}
-
-JFile Input() :
-{
-    ArrayList<JFile> ilist = new ArrayList<JFile>();
-    ArrayList<JRecord> rlist = new ArrayList<JRecord>();
-    JFile i;
-    ArrayList <JRecord>l;
-}
-{
-    (
-        i = Include()
-        { ilist.add(i); }
-    |   l = Module()
-        { rlist.addAll(l); }
-    )+
-    <EOF>
-    { return new JFile(curFileName, ilist, rlist); }
-}
-
-JFile Include() :
-{
-    String fname;
-    Token t;
-}
-{
-    <INCLUDE_TKN>
-    t = <CSTRING_TKN>
-    {
-        JFile ret = null;
-        fname = t.image.replaceAll("^\"", "").replaceAll("\"$","");
-        File file = new File(curDir, fname);
-        String tmpDir = curDir;
-        String tmpFile = curFileName;
-        curDir = file.getParent();
-        curFileName = file.getName();
-        try {
-            FileReader reader = new FileReader(file);
-            Rcc parser = new Rcc(reader);
-            try {
-                ret = parser.Input();
-                System.out.println(fname + " Parsed Successfully");
-            } catch (ParseException e) {
-                System.out.println(e.toString());
-                System.exit(1);
-            }
-            try {
-                reader.close();
-            } catch (IOException e) {
-            }
-        } catch (FileNotFoundException e) {
-            System.out.println("File " + fname +
-                " Not found.");
-            System.exit(1);
-        }
-        curDir = tmpDir;
-        curFileName = tmpFile;
-        return ret;
-    }
-}
-
-ArrayList<JRecord> Module() :
-{
-    String mName;
-    ArrayList<JRecord> rlist;
-}
-{
-    <MODULE_TKN>
-    mName = ModuleName()
-    { curModuleName = mName; }
-    <LBRACE_TKN>
-    rlist = RecordList()
-    <RBRACE_TKN>
-    { return rlist; }
-}
-
-String ModuleName() :
-{
-    String name = "";
-    Token t;
-}
-{
-    t = <IDENT_TKN>
-    { name += t.image; }
-    (
-        <DOT_TKN>
-        t = <IDENT_TKN>
-        { name += "." + t.image; }
-    )*
-    { return name; }
-}
-
-ArrayList<JRecord> RecordList() :
-{
-    ArrayList<JRecord> rlist = new ArrayList<JRecord>();
-    JRecord r;
-}
-{
-    (
-        r = Record()
-        { rlist.add(r); }
-    )+
-    { return rlist; }
-}
-
-JRecord Record() :
-{
-    String rname;
-    ArrayList<JField> flist = new ArrayList<JField>();
-    Token t;
-    JField f;
-}
-{
-    <RECORD_TKN>
-    t = <IDENT_TKN>
-    { rname = t.image; }
-    <LBRACE_TKN>
-    (
-        f = Field()
-        { flist.add(f); }
-        <SEMICOLON_TKN>
-    )+
-    <RBRACE_TKN>
-    {
-        String fqn = curModuleName + "." + rname;
-        JRecord r = new JRecord(fqn, flist);
-        recTab.put(fqn, r);
-        return r;
-    }
-}
-
-JField Field() :
-{
-    JType jt;
-    Token t;
-}
-{
-    jt = Type()
-    t = <IDENT_TKN>
-    { return new JField(jt, t.image); }
-}
-
-JType Type() :
-{
-    JType jt;
-    Token t;
-    String rname;
-}
-{
-    jt = Map()
-    { return jt; }
-|   jt = Vector()
-    { return jt; }
-|   <BYTE_TKN>
-    { return new JByte(); }
-|   <BOOLEAN_TKN>
-    { return new JBoolean(); }
-|   <INT_TKN>
-    { return new JInt(); }
-|   <LONG_TKN>
-    { return new JLong(); }
-|   <FLOAT_TKN>
-    { return new JFloat(); }
-|   <DOUBLE_TKN>
-    { return new JDouble(); }
-|   <USTRING_TKN>
-    { return new JString(); }
-|   <BUFFER_TKN>
-    { return new JBuffer(); }
-|   rname = ModuleName()
-    {
-        if (rname.indexOf('.', 0) < 0) {
-            rname = curModuleName + "." + rname;
-        }
-        JRecord r = recTab.get(rname);
-        if (r == null) {
-            System.out.println("Type " + rname + " not known. Exiting.");
-            System.exit(1);
-        }
-        return r;
-    }
-}
-
-JMap Map() :
-{
-    JType jt1;
-    JType jt2;
-}
-{
-    <MAP_TKN>
-    <LT_TKN>
-    jt1 = Type()
-    <COMMA_TKN>
-    jt2 = Type()
-    <GT_TKN>
-    { return new JMap(jt1, jt2); }
-}
-
-JVector Vector() :
-{
-    JType jt;
-}
-{
-    <VECTOR_TKN>
-    <LT_TKN>
-    jt = Type()
-    <GT_TKN>
-    { return new JVector(jt); }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/package.html
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/package.html b/src/java/main/org/apache/jute/compiler/package.html
deleted file mode 100644
index 03bdb1b..0000000
--- a/src/java/main/org/apache/jute/compiler/package.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<!--
-   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.
--->
-
-<html>
-  <head>
-    <title>Hadoop Record Compiler</title>
-  </head>
-  <body>
-  This package contains classes needed for code generation
-  from the hadoop record compiler. CppGenerator and JavaGenerator
-  are the main entry points from the parser. There are classes
-  corrsponding to every primitive type and compound type
-  included in Hadoop record I/O syntax.
-  </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/package.html
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/package.html b/src/java/main/org/apache/jute/package.html
deleted file mode 100644
index 531a6e3..0000000
--- a/src/java/main/org/apache/jute/package.html
+++ /dev/null
@@ -1,801 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<!--
-   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.
--->
-
-<html>
-  <head>
-    <title>Hadoop Record I/O</title>
-  </head>
-  <body>
-  Hadoop record I/O contains classes and a record description language
-  translator for simplifying serialization and deserialization of records in a
-  language-neutral manner.
-  
-  <h2>Introduction</h2>
-  
-  Software systems of any significant complexity require mechanisms for data 
-interchange with the outside world. These interchanges typically involve the
-marshaling and unmarshaling of logical units of data to and from data streams
-(files, network connections, memory buffers etc.). Applications usually have
-some code for serializing and deserializing the data types that they manipulate
-embedded in them. The work of serialization has several features that make
-automatic code generation for it worthwhile. Given a particular output encoding
-(binary, XML, etc.), serialization of primitive types and simple compositions
-of primitives (structs, vectors etc.) is a very mechanical task. Manually
-written serialization code can be susceptible to bugs especially when records
-have a large number of fields or a record definition changes between software
-versions. Lastly, it can be very useful for applications written in different
-programming languages to be able to share and interchange data. This can be 
-made a lot easier by describing the data records manipulated by these
-applications in a language agnostic manner and using the descriptions to derive
-implementations of serialization in multiple target languages. 
-
-This document describes Hadoop Record I/O, a mechanism that is aimed 
-at
-<ul> 
-<li> enabling the specification of simple serializable data types (records) 
-<li> enabling the generation of code in multiple target languages for
-marshaling and unmarshaling such types
-<li> providing target language specific support that will enable application 
-programmers to incorporate generated code into their applications
-</ul>
-
-The goals of Hadoop Record I/O are similar to those of mechanisms such as XDR,
-ASN.1, PADS and ICE. While these systems all include a DDL that enables
-the specification of most record types, they differ widely in what else they
-focus on. The focus in Hadoop Record I/O is on data marshaling and
-multi-lingual support.  We take a translator-based approach to serialization.
-Hadoop users have to describe their data in a simple data description
-language. The Hadoop DDL translator rcc generates code that users
-can invoke in order to read/write their data from/to simple stream 
-abstractions. Next we list explicitly some of the goals and non-goals of
-Hadoop Record I/O.
-
-
-<h3>Goals</h3>
-
-<ul>
-<li> Support for commonly used primitive types. Hadoop should include as
-primitives commonly used builtin types from programming languages we intend to
-support.
-
-<li> Support for common data compositions (including recursive compositions).
-Hadoop should support widely used composite types such as structs and
-vectors.
-
-<li> Code generation in multiple target languages. Hadoop should be capable of
-generating serialization code in multiple target languages and should be
-easily extensible to new target languages. The initial target languages are
-C++ and Java.
-
-<li> Support for generated target languages. Hadooop should include support
-in the form of headers, libraries, packages for supported target languages 
-that enable easy inclusion and use of generated code in applications.
-
-<li> Support for multiple output encodings. Candidates include
-packed binary, comma-separated text, XML etc.
-
-<li> Support for specifying record types in a backwards/forwards compatible
-manner. This will probably be in the form of support for optional fields in
-records. This version of the document does not include a description of the
-planned mechanism, we intend to include it in the next iteration.
-
-</ul>
-
-<h3>Non-Goals</h3>
-
-<ul>
-  <li> Serializing existing arbitrary C++ classes.
-  <li> Serializing complex data structures such as trees, linked lists etc.
-  <li> Built-in indexing schemes, compression, or check-sums.
-  <li> Dynamic construction of objects from an XML schema.
-</ul>
-
-The remainder of this document describes the features of Hadoop record I/O
-in more detail. Section 2 describes the data types supported by the system.
-Section 3 lays out the DDL syntax with some examples of simple records. 
-Section 4 describes the process of code generation with rcc. Section 5
-describes target language mappings and support for Hadoop types. We include a
-fairly complete description of C++ mappings with intent to include Java and
-others in upcoming iterations of this document. The last section talks about
-supported output encodings.
-
-
-<h2>Data Types and Streams</h2>
-
-This section describes the primitive and composite types supported by Hadoop.
-We aim to support a set of types that can be used to simply and efficiently
-express a wide range of record types in different programming languages.
-
-<h3>Primitive Types</h3>
-
-For the most part, the primitive types of Hadoop map directly to primitive
-types in high level programming languages. Special cases are the
-ustring (a Unicode string) and buffer types, which we believe
-find wide use and which are usually implemented in library code and not
-available as language built-ins. Hadoop also supplies these via library code
-when a target language built-in is not present and there is no widely
-adopted "standard" implementation. The complete list of primitive types is:
-
-<ul>
-  <li> byte: An 8-bit unsigned integer.
-  <li> boolean: A boolean value.
-  <li> int: A 32-bit signed integer.
-  <li> long: A 64-bit signed integer.
-  <li> float: A single precision floating point number as described by
-    IEEE-754.
-  <li> double: A double precision floating point number as described by
-    IEEE-754.
-  <li> ustring: A string consisting of Unicode characters.
-  <li> buffer: An arbitrary sequence of bytes. 
-</ul>
-
-
-<h3>Composite Types</h3>
-Hadoop supports a small set of composite types that enable the description
-of simple aggregate types and containers. A composite type is serialized
-by sequentially serializing it constituent elements. The supported
-composite types are:
-
-<ul>
-
-  <li> record: An aggregate type like a C-struct. This is a list of
-typed fields that are together considered a single unit of data. A record
-is serialized by sequentially serializing its constituent fields. In addition
-to serialization a record has comparison operations (equality and less-than)
-implemented for it, these are defined as memberwise comparisons.
-
-  <li>vector: A sequence of entries of the same data type, primitive
-or composite.
-
-  <li> map: An associative container mapping instances of a key type to
-instances of a value type. The key and value types may themselves be primitive
-or composite types. 
-
-</ul>
-
-<h3>Streams</h3>
-
-Hadoop generates code for serializing and deserializing record types to
-abstract streams. For each target language Hadoop defines very simple input
-and output stream interfaces. Application writers can usually develop
-concrete implementations of these by putting a one method wrapper around
-an existing stream implementation.
-
-
-<h2>DDL Syntax and Examples</h2>
-
-We now describe the syntax of the Hadoop data description language. This is
-followed by a few examples of DDL usage.
- 
-<h3>Hadoop DDL Syntax</h3>
-
-<pre><code>
-recfile = *include module *record
-include = "include" path
-path = (relative-path / absolute-path)
-module = "module" module-name
-module-name = name *("." name)
-record := "class" name "{" 1*(field) "}"
-field := type name ";"
-name :=  ALPHA (ALPHA / DIGIT / "_" )*
-type := (ptype / ctype)
-ptype := ("byte" / "boolean" / "int" |
-          "long" / "float" / "double"
-          "ustring" / "buffer")
-ctype := (("vector" "<" type ">") /
-          ("map" "<" type "," type ">" ) ) / name)
-</code></pre>
-
-A DDL file describes one or more record types. It begins with zero or
-more include declarations, a single mandatory module declaration
-followed by zero or more class declarations. The semantics of each of
-these declarations are described below:
-
-<ul>
-
-<li>include: An include declaration specifies a DDL file to be
-referenced when generating code for types in the current DDL file. Record types
-in the current compilation unit may refer to types in all included files.
-File inclusion is recursive. An include does not trigger code
-generation for the referenced file.
-
-<li> module: Every Hadoop DDL file must have a single module
-declaration that follows the list of includes and precedes all record
-declarations. A module declaration identifies a scope within which
-the names of all types in the current file are visible. Module names are
-mapped to C++ namespaces, Java packages etc. in generated code.
-
-<li> class: Records types are specified through class
-declarations. A class declaration is like a Java class declaration.
-It specifies a named record type and a list of fields that constitute records
-of the type. Usage is illustrated in the following examples.
-
-</ul>
-
-<h3>Examples</h3>
-
-<ul>
-<li>A simple DDL file links.jr with just one record declaration. 
-<pre><code>
-module links {
-    class Link {
-        ustring URL;
-        boolean isRelative;
-        ustring anchorText;
-    };
-}
-</code></pre>
-
-<li> A DDL file outlinks.jr which includes another
-<pre><code>
-include "links.jr"
-
-module outlinks {
-    class OutLinks {
-        ustring baseURL;
-        vector<links.Link> outLinks;
-    };
-}
-</code></pre>
-</ul>
-
-<h2>Code Generation</h2>
-
-The Hadoop translator is written in Java. Invocation is done by executing a 
-wrapper shell script named named rcc. It takes a list of
-record description files as a mandatory argument and an
-optional language argument (the default is Java) --language or
--l. Thus a typical invocation would look like:
-<pre><code>
-$ rcc -l C++ <filename> ...
-</code></pre>
-
-
-<h2>Target Language Mappings and Support</h2>
-
-For all target languages, the unit of code generation is a record type. 
-For each record type, Hadoop generates code for serialization and
-deserialization, record comparison and access to record members.
-
-<h3>C++</h3>
-
-Support for including Hadoop generated C++ code in applications comes in the
-form of a header file recordio.hh which needs to be included in source
-that uses Hadoop types and a library librecordio.a which applications need
-to be linked with. The header declares the Hadoop C++ namespace which defines
-appropriate types for the various primitives, the basic interfaces for
-records and streams and enumerates the supported serialization encodings.
-Declarations of these interfaces and a description of their semantics follow:
-
-<pre><code>
-namespace hadoop {
-
-  enum RecFormat { kBinary, kXML, kCSV };
-
-  class InStream {
-  public:
-    virtual ssize_t read(void *buf, size_t n) = 0;
-  };
-
-  class OutStream {
-  public:
-    virtual ssize_t write(const void *buf, size_t n) = 0;
-  };
-
-  class IOError : public runtime_error {
-  public:
-    explicit IOError(const std::string& msg);
-  };
-
-  class IArchive;
-  class OArchive;
-
-  class RecordReader {
-  public:
-    RecordReader(InStream& in, RecFormat fmt);
-    virtual ~RecordReader(void);
-
-    virtual void read(Record& rec);
-  };
-
-  class RecordWriter {
-  public:
-    RecordWriter(OutStream& out, RecFormat fmt);
-    virtual ~RecordWriter(void);
-
-    virtual void write(Record& rec);
-  };
-
-
-  class Record {
-  public:
-    virtual std::string type(void) const = 0;
-    virtual std::string signature(void) const = 0;
-  protected:
-    virtual bool validate(void) const = 0;
-
-    virtual void
-    serialize(OArchive& oa, const std::string& tag) const = 0;
-
-    virtual void
-    deserialize(IArchive& ia, const std::string& tag) = 0;
-  };
-}
-</code></pre>
-
-<ul>
-
-<li> RecFormat: An enumeration of the serialization encodings supported
-by this implementation of Hadoop.
-
-<li> InStream: A simple abstraction for an input stream. This has a 
-single public read method that reads n bytes from the stream into
-the buffer buf. Has the same semantics as a blocking read system
-call. Returns the number of bytes read or -1 if an error occurs.
-
-<li> OutStream: A simple abstraction for an output stream. This has a 
-single write method that writes n bytes to the stream from the
-buffer buf. Has the same semantics as a blocking write system
-call. Returns the number of bytes written or -1 if an error occurs.
-
-<li> RecordReader: A RecordReader reads records one at a time from
-an underlying stream in a specified record format. The reader is instantiated
-with a stream and a serialization format. It has a read method that
-takes an instance of a record and deserializes the record from the stream.
-
-<li> RecordWriter: A RecordWriter writes records one at a
-time to an underlying stream in a specified record format. The writer is
-instantiated with a stream and a serialization format. It has a
-write method that takes an instance of a record and serializes the
-record to the stream.
-
-<li> Record: The base class for all generated record types. This has two
-public methods type and signature that return the typename and the
-type signature of the record.
-
-</ul>
-
-Two files are generated for each record file (note: not for each record). If a
-record file is named "name.jr", the generated files are 
-"name.jr.cc" and "name.jr.hh" containing serialization 
-implementations and record type declarations respectively.
-
-For each record in the DDL file, the generated header file will contain a
-class definition corresponding to the record type, method definitions for the
-generated type will be present in the '.cc' file.  The generated class will
-inherit from the abstract class hadoop::Record. The DDL files
-module declaration determines the namespace the record belongs to.
-Each '.' delimited token in the module declaration results in the
-creation of a namespace. For instance, the declaration module docs.links
-results in the creation of a docs namespace and a nested 
-docs::links namespace. In the preceding examples, the Link class
-is placed in the links namespace. The header file corresponding to
-the links.jr file will contain:
-
-<pre><code>
-namespace links {
-  class Link : public hadoop::Record {
-    // ....
-  };
-};
-</code></pre>
-
-Each field within the record will cause the generation of a private member
-declaration of the appropriate type in the class declaration, and one or more
-acccessor methods. The generated class will implement the serialize and
-deserialize methods defined in hadoop::Record+. It will also 
-implement the inspection methods type and signature from
-hadoop::Record. A default constructor and virtual destructor will also
-be generated. Serialization code will read/write records into streams that
-implement the hadoop::InStream and the hadoop::OutStream interfaces.
-
-For each member of a record an accessor method is generated that returns 
-either the member or a reference to the member. For members that are returned 
-by value, a setter method is also generated. This is true for primitive 
-data members of the types byte, int, long, boolean, float and 
-double. For example, for a int field called MyField the folowing
-code is generated.
-
-<pre><code>
-...
-private:
-  int32_t mMyField;
-  ...
-public:
-  int32_t getMyField(void) const {
-    return mMyField;
-  };
-
-  void setMyField(int32_t m) {
-    mMyField = m;
-  };
-  ...
-</code></pre>
-
-For a ustring or buffer or composite field. The generated code
-only contains accessors that return a reference to the field. A const
-and a non-const accessor are generated. For example:
-
-<pre><code>
-...
-private:
-  std::string mMyBuf;
-  ...
-public:
-
-  std::string& getMyBuf() {
-    return mMyBuf;
-  };
-
-  const std::string& getMyBuf() const {
-    return mMyBuf;
-  };
-  ...
-</code></pre>
-
-<h4>Examples</h4>
-
-Suppose the inclrec.jr file contains:
-<pre><code>
-module inclrec {
-    class RI {
-        int      I32;
-        double   D;
-        ustring  S;
-    };
-}
-</code></pre>
-
-and the testrec.jr file contains:
-
-<pre><code>
-include "inclrec.jr"
-module testrec {
-    class R {
-        vector<float> VF;
-        RI            Rec;
-        buffer        Buf;
-    };
-}
-</code></pre>
-
-Then the invocation of rcc such as:
-<pre><code>
-$ rcc -l c++ inclrec.jr testrec.jr
-</code></pre>
-will result in generation of four files:
-inclrec.jr.{cc,hh} and testrec.jr.{cc,hh}.
-
-The inclrec.jr.hh will contain:
-
-<pre><code>
-#ifndef _INCLREC_JR_HH_
-#define _INCLREC_JR_HH_
-
-#include "recordio.hh"
-
-namespace inclrec {
-  
-  class RI : public hadoop::Record {
-
-  private:
-
-    int32_t      mI32;
-    double       mD;
-    std::string  mS;
-
-  public:
-
-    RI(void);
-    virtual ~RI(void);
-
-    virtual bool operator==(const RI& peer) const;
-    virtual bool operator<(const RI& peer) const;
-
-    virtual int32_t getI32(void) const { return mI32; }
-    virtual void setI32(int32_t v) { mI32 = v; }
-
-    virtual double getD(void) const { return mD; }
-    virtual void setD(double v) { mD = v; }
-
-    virtual std::string& getS(void) const { return mS; }
-    virtual const std::string& getS(void) const { return mS; }
-
-    virtual std::string type(void) const;
-    virtual std::string signature(void) const;
-
-  protected:
-
-    virtual void serialize(hadoop::OArchive& a) const;
-    virtual void deserialize(hadoop::IArchive& a);
-
-    virtual bool validate(void);
-  };
-} // end namespace inclrec
-
-#endif /* _INCLREC_JR_HH_ */
-
-</code></pre>
-
-The testrec.jr.hh file will contain:
-
-
-<pre><code>
-
-#ifndef _TESTREC_JR_HH_
-#define _TESTREC_JR_HH_
-
-#include "inclrec.jr.hh"
-
-namespace testrec {
-  class R : public hadoop::Record {
-
-  private:
-
-    std::vector<float> mVF;
-    inclrec::RI        mRec;
-    std::string        mBuf;
-
-  public:
-
-    R(void);
-    virtual ~R(void);
-
-    virtual bool operator==(const R& peer) const;
-    virtual bool operator<(const R& peer) const;
-
-    virtual std::vector<float>& getVF(void) const;
-    virtual const std::vector<float>& getVF(void) const;
-
-    virtual std::string& getBuf(void) const ;
-    virtual const std::string& getBuf(void) const;
-
-    virtual inclrec::RI& getRec(void) const;
-    virtual const inclrec::RI& getRec(void) const;
-    
-    virtual bool serialize(hadoop::OutArchive& a) const;
-    virtual bool deserialize(hadoop::InArchive& a);
-    
-    virtual std::string type(void) const;
-    virtual std::string signature(void) const;
-  };
-}; // end namespace testrec
-#endif /* _TESTREC_JR_HH_ */
-
-</code></pre>
-
-<h3>Java</h3>
-
-Code generation for Java is similar to that for C++. A Java class is generated
-for each record type with private members corresponding to the fields. Getters
-and setters for fields are also generated. Some differences arise in the
-way comparison is expressed and in the mapping of modules to packages and
-classes to files. For equality testing, an equals method is generated
-for each record type. As per Java requirements a hashCode method is also
-generated. For comparison a compareTo method is generated for each
-record type. This has the semantics as defined by the Java Comparable
-interface, that is, the method returns a negative integer, zero, or a positive
-integer as the invoked object is less than, equal to, or greater than the
-comparison parameter.
-
-A .java file is generated per record type as opposed to per DDL
-file as in C++. The module declaration translates to a Java
-package declaration. The module name maps to an identical Java package
-name. In addition to this mapping, the DDL compiler creates the appropriate
-directory hierarchy for the package and places the generated .java
-files in the correct directories.
-
-<h2>Mapping Summary</h2>
-
-<pre><code>
-DDL Type        C++ Type            Java Type 
-
-boolean         bool                boolean
-byte            int8_t              byte
-int             int32_t             int
-long            int64_t             long
-float           float               float
-double          double              double
-ustring         std::string         Text
-buffer          std::string         java.io.ByteArrayOutputStream
-class type      class type          class type
-vector<type>    std::vector<type>   java.util.ArrayList
-map<type,type>  std::map<type,type> java.util.TreeMap
-</code></pre>
-
-<h2>Data encodings</h2>
-
-This section describes the format of the data encodings supported by Hadoop.
-Currently, three data encodings are supported, namely binary, CSV and XML.
-
-<h3>Binary Serialization Format</h3>
-
-The binary data encoding format is fairly dense. Serialization of composite
-types is simply defined as a concatenation of serializations of the constituent
-elements (lengths are included in vectors and maps).
-
-Composite types are serialized as follows:
-<ul>
-<li> class: Sequence of serialized members.
-<li> vector: The number of elements serialized as an int. Followed by a
-sequence of serialized elements.
-<li> map: The number of key value pairs serialized as an int. Followed
-by a sequence of serialized (key,value) pairs.
-</ul>
-
-Serialization of primitives is more interesting, with a zero compression
-optimization for integral types and normalization to UTF-8 for strings. 
-Primitive types are serialized as follows:
-
-<ul>
-<li> byte: Represented by 1 byte, as is.
-<li> boolean: Represented by 1-byte (0 or 1)
-<li> int/long: Integers and longs are serialized zero compressed.
-Represented as 1-byte if -120 <= value < 128. Otherwise, serialized as a
-sequence of 2-5 bytes for ints, 2-9 bytes for longs. The first byte represents
-the number of trailing bytes, N, as the negative number (-120-N). For example,
-the number 1024 (0x400) is represented by the byte sequence 'x86 x04 x00'.
-This doesn't help much for 4-byte integers but does a reasonably good job with
-longs without bit twiddling.
-<li> float/double: Serialized in IEEE 754 single and double precision
-format in network byte order. This is the format used by Java.
-<li> ustring: Serialized as 4-byte zero compressed length followed by
-data encoded as UTF-8. Strings are normalized to UTF-8 regardless of native
-language representation.
-<li> buffer: Serialized as a 4-byte zero compressed length followed by the
-raw bytes in the buffer.
-</ul>
-
-
-<h3>CSV Serialization Format</h3>
-
-The CSV serialization format has a lot more structure than the "standard"
-Excel CSV format, but we believe the additional structure is useful because
-
-<ul>
-<li> it makes parsing a lot easier without detracting too much from legibility
-<li> the delimiters around composites make it obvious when one is reading a
-sequence of Hadoop records
-</ul>
-
-Serialization formats for the various types are detailed in the grammar that
-follows. The notable feature of the formats is the use of delimiters for 
-indicating the certain field types.
-
-<ul>
-<li> A string field begins with a single quote (').
-<li> A buffer field begins with a sharp (#).
-<li> A class, vector or map begins with 's{', 'v{' or 'm{' respectively and
-ends with '}'.
-</ul>
-
-The CSV format can be described by the following grammar:
-
-<pre><code>
-record = primitive / struct / vector / map
-primitive = boolean / int / long / float / double / ustring / buffer
-
-boolean = "T" / "F"
-int = ["-"] 1*DIGIT
-long = ";" ["-"] 1*DIGIT
-float = ["-"] 1*DIGIT "." 1*DIGIT ["E" / "e" ["-"] 1*DIGIT]
-double = ";" ["-"] 1*DIGIT "." 1*DIGIT ["E" / "e" ["-"] 1*DIGIT]
-
-ustring = "'" *(UTF8 char except NULL, LF, % and , / "%00" / "%0a" / "%25" / "%2c" )
-
-buffer = "#" *(BYTE except NULL, LF, % and , / "%00" / "%0a" / "%25" / "%2c" )
-
-struct = "s{" record *("," record) "}"
-vector = "v{" [record *("," record)] "}"
-map = "m{" [*(record "," record)] "}"
-</code></pre>
-
-<h3>XML Serialization Format</h3>
-
-The XML serialization format is the same used by Apache XML-RPC
-(http://ws.apache.org/xmlrpc/types.html). This is an extension of the original
-XML-RPC format and adds some additional data types. All record I/O types are
-not directly expressible in this format, and access to a DDL is required in
-order to convert these to valid types. All types primitive or composite are
-represented by &lt;value&gt; elements. The particular XML-RPC type is
-indicated by a nested element in the &lt;value&gt; element. The encoding for
-records is always UTF-8. Primitive types are serialized as follows:
-
-<ul>
-<li> byte: XML tag &lt;ex:i1&gt;. Values: 1-byte unsigned 
-integers represented in US-ASCII
-<li> boolean: XML tag &lt;boolean&gt;. Values: "0" or "1"
-<li> int: XML tags &lt;i4&gt; or &lt;int&gt;. Values: 4-byte
-signed integers represented in US-ASCII.
-<li> long: XML tag &lt;ex:i8&gt;. Values: 8-byte signed integers
-represented in US-ASCII.
-<li> float: XML tag &lt;ex:float&gt;. Values: Single precision
-floating point numbers represented in US-ASCII.
-<li> double: XML tag &lt;double&gt;. Values: Double precision
-floating point numbers represented in US-ASCII.
-<li> ustring: XML tag &lt;;string&gt;. Values: String values
-represented as UTF-8. XML does not permit all Unicode characters in literal
-data. In particular, NULLs and control chars are not allowed. Additionally,
-XML processors are required to replace carriage returns with line feeds and to
-replace CRLF sequences with line feeds. Programming languages that we work
-with do not impose these restrictions on string types. To work around these
-restrictions, disallowed characters and CRs are percent escaped in strings.
-The '%' character is also percent escaped.
-<li> buffer: XML tag &lt;string&&gt;. Values: Arbitrary binary
-data. Represented as hexBinary, each byte is replaced by its 2-byte
-hexadecimal representation.
-</ul>
-
-Composite types are serialized as follows:
-
-<ul>
-<li> class: XML tag &lt;struct&gt;. A struct is a sequence of
-&lt;member&gt; elements. Each &lt;member&gt; element has a &lt;name&gt;
-element and a &lt;value&gt; element. The &lt;name&gt; is a string that must
-match /[a-zA-Z][a-zA-Z0-9_]*/. The value of the member is represented
-by a &lt;value&gt; element.
-
-<li> vector: XML tag &lt;array&lt;. An &lt;array&gt; contains a
-single &lt;data&gt; element. The &lt;data&gt; element is a sequence of
-&lt;value&gt; elements each of which represents an element of the vector.
-
-<li> map: XML tag &lt;array&gt;. Same as vector.
-
-</ul>
-
-For example:
-
-<pre><code>
-class {
-  int           MY_INT;            // value 5
-  vector<float> MY_VEC;            // values 0.1, -0.89, 2.45e4
-  buffer        MY_BUF;            // value '\00\n\tabc%'
-}
-</code></pre>
-
-is serialized as
-
-<pre><code class="XML">
-&lt;value&gt;
-  &lt;struct&gt;
-    &lt;member&gt;
-      &lt;name&gt;MY_INT&lt;/name&gt;
-      &lt;value&gt;&lt;i4&gt;5&lt;/i4&gt;&lt;/value&gt;
-    &lt;/member&gt;
-    &lt;member&gt;
-      &lt;name&gt;MY_VEC&lt;/name&gt;
-      &lt;value&gt;
-        &lt;array&gt;
-          &lt;data&gt;
-            &lt;value&gt;&lt;ex:float&gt;0.1&lt;/ex:float&gt;&lt;/value&gt;
-            &lt;value&gt;&lt;ex:float&gt;-0.89&lt;/ex:float&gt;&lt;/value&gt;
-            &lt;value&gt;&lt;ex:float&gt;2.45e4&lt;/ex:float&gt;&lt;/value&gt;
-          &lt;/data&gt;
-        &lt;/array&gt;
-      &lt;/value&gt;
-    &lt;/member&gt;
-    &lt;member&gt;
-      &lt;name&gt;MY_BUF&lt;/name&gt;
-      &lt;value&gt;&lt;string&gt;%00\n\tabc%25&lt;/string&gt;&lt;/value&gt;
-    &lt;/member&gt;
-  &lt;/struct&gt;
-&lt;/value&gt; 
-</code></pre>
-
-  </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/test/org/apache/jute/BinaryInputArchiveTest.java
----------------------------------------------------------------------
diff --git a/src/java/test/org/apache/jute/BinaryInputArchiveTest.java b/src/java/test/org/apache/jute/BinaryInputArchiveTest.java
deleted file mode 100644
index a8d067d..0000000
--- a/src/java/test/org/apache/jute/BinaryInputArchiveTest.java
+++ /dev/null
@@ -1,43 +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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.jute;
-
-import junit.framework.Assert;
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-
-public class BinaryInputArchiveTest {
-
-    @Test
-    public void testReadStringCheckLength() {
-        byte[] buf = new byte[]{
-                Byte.MAX_VALUE, Byte.MAX_VALUE, Byte.MAX_VALUE, Byte.MAX_VALUE};
-        ByteArrayInputStream is = new ByteArrayInputStream(buf);
-        BinaryInputArchive ia = BinaryInputArchive.getArchive(is);
-        try {
-            ia.readString("");
-            Assert.fail("Should have thrown an IOException");
-        } catch (IOException e) {
-            Assert.assertTrue("Not 'Unreasonable length' exception: " + e,
-                    e.getMessage().startsWith(BinaryInputArchive.UNREASONBLE_LENGTH));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/zookeeper.jute
----------------------------------------------------------------------
diff --git a/src/zookeeper.jute b/src/zookeeper.jute
deleted file mode 100644
index 27a5a7e..0000000
--- a/src/zookeeper.jute
+++ /dev/null
@@ -1,293 +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.
- */
-
-module org.apache.zookeeper.data {
-    class Id {
-        ustring scheme;
-        ustring id;
-    }
-    class ACL {
-        int perms;
-        Id id;
-    }
-    // information shared with the client
-    class Stat {
-        long czxid;      // created zxid
-        long mzxid;      // last modified zxid
-        long ctime;      // created
-        long mtime;      // last modified
-        int version;     // version
-        int cversion;    // child version
-        int aversion;    // acl version
-        long ephemeralOwner; // owner id if ephemeral, 0 otw
-        int dataLength;  //length of the data in the node
-        int numChildren; //number of children of this node
-        long pzxid;      // last modified children
-    }
-    // information explicitly stored by the server persistently
-    class StatPersisted {
-        long czxid;      // created zxid
-        long mzxid;      // last modified zxid
-        long ctime;      // created
-        long mtime;      // last modified
-        int version;     // version
-        int cversion;    // child version
-        int aversion;    // acl version
-        long ephemeralOwner; // owner id if ephemeral, 0 otw
-        long pzxid;      // last modified children
-    }
-
-   // information explicitly stored by the version 1 database of servers 
-   class StatPersistedV1 {
-       long czxid; //created zxid
-       long mzxid; //last modified zxid
-       long ctime; //created
-       long mtime; //last modified
-       int version; //version
-       int cversion; //child version
-       int aversion; //acl version
-       long ephemeralOwner; //owner id if ephemeral. 0 otw
-    }
-}
-
-module org.apache.zookeeper.proto {
-    class ConnectRequest {
-        int protocolVersion;
-        long lastZxidSeen;
-        int timeOut;
-        long sessionId;
-        buffer passwd;
-    }
-    class ConnectResponse {
-        int protocolVersion;
-        int timeOut;
-        long sessionId;
-        buffer passwd;
-    }
-    class SetWatches {
-        long relativeZxid;
-        vector<ustring>dataWatches;
-        vector<ustring>existWatches;
-        vector<ustring>childWatches;
-    }        
-    class RequestHeader {
-        int xid;
-        int type;
-    }
-    class MultiHeader {
-        int type;
-        boolean done;
-        int err;
-    }
-    class AuthPacket {
-        int type;
-        ustring scheme;
-        buffer auth;
-    }
-    class ReplyHeader {
-        int xid;
-        long zxid;
-        int err;
-    }
-    class GetDataRequest {
-        ustring path;
-        boolean watch;
-    }
-    class SetDataRequest {
-        ustring path;
-        buffer data;
-        int version;
-    }
-    class SetDataResponse {
-        org.apache.zookeeper.data.Stat stat;
-    }
-    class GetSASLRequest {
-        buffer token;
-    }
-    class SetSASLRequest {
-        buffer token;
-    }
-    class SetSASLResponse {
-        buffer token;
-    }
-    class CreateRequest {
-        ustring path;
-        buffer data;
-        vector<org.apache.zookeeper.data.ACL> acl;
-        int flags;
-    }
-    class DeleteRequest {
-        ustring path;
-        int version;
-    }
-    class GetChildrenRequest {
-        ustring path;
-        boolean watch;
-    }
-    class GetChildren2Request {
-        ustring path;
-        boolean watch;
-    }
-    class CheckVersionRequest {
-        ustring path;
-        int version;
-    }
-    class GetMaxChildrenRequest {
-        ustring path;
-    }
-    class GetMaxChildrenResponse {
-        int max;
-    }
-    class SetMaxChildrenRequest {
-        ustring path;
-        int max;
-    }
-    class SyncRequest {
-        ustring path;
-    }
-    class SyncResponse {
-        ustring path;
-    }
-    class GetACLRequest {
-        ustring path;
-    }
-    class SetACLRequest {
-        ustring path;
-        vector<org.apache.zookeeper.data.ACL> acl;
-        int version;
-    }
-    class SetACLResponse {
-        org.apache.zookeeper.data.Stat stat;
-    }
-    class WatcherEvent {
-        int type;  // event type
-        int state; // state of the Keeper client runtime
-        ustring path;
-    }
-    class ErrorResponse {
-        int err;
-    }
-    class CreateResponse {
-        ustring path;
-    }
-    class ExistsRequest {
-        ustring path;
-        boolean watch;
-    }
-    class ExistsResponse {
-        org.apache.zookeeper.data.Stat stat;
-    }
-    class GetDataResponse {
-        buffer data;
-        org.apache.zookeeper.data.Stat stat;
-    }
-    class GetChildrenResponse {
-        vector<ustring> children;
-    }
-    class GetChildren2Response {
-        vector<ustring> children;
-        org.apache.zookeeper.data.Stat stat;
-    }
-    class GetACLResponse {
-        vector<org.apache.zookeeper.data.ACL> acl;
-        org.apache.zookeeper.data.Stat stat;
-    }
-}
-
-module org.apache.zookeeper.server.quorum {
-    class LearnerInfo {
-        long serverid;
-        int protocolVersion;
-    }
-    class QuorumPacket {
-        int type; // Request, Ack, Commit, Ping
-        long zxid;
-        buffer data; // Only significant when type is request
-        vector<org.apache.zookeeper.data.Id> authinfo;
-    }
-    class QuorumAuthPacket {
-        long magic;
-        int status;
-        buffer token;
-    }
-}
-
-module org.apache.zookeeper.server.persistence {
-    class FileHeader {
-        int magic;
-        int version;
-        long dbid;
-    }
-}
-
-module org.apache.zookeeper.txn {
-    class TxnHeader {
-        long clientId;
-        int cxid;
-        long zxid;
-        long time;
-        int type;
-    }
-    class CreateTxnV0 {
-        ustring path;
-        buffer data;
-        vector<org.apache.zookeeper.data.ACL> acl;
-        boolean ephemeral;
-    }
-    class CreateTxn {
-        ustring path;
-        buffer data;
-        vector<org.apache.zookeeper.data.ACL> acl;
-        boolean ephemeral;
-        int parentCVersion;
-    }
-    class DeleteTxn {
-        ustring path;
-    }
-    class SetDataTxn {
-        ustring path;
-        buffer data;
-        int version;
-    }
-    class CheckVersionTxn {
-        ustring path;
-        int version;
-    }
-    class SetACLTxn {
-        ustring path;
-        vector<org.apache.zookeeper.data.ACL> acl;
-        int version;
-    }
-    class SetMaxChildrenTxn {
-        ustring path;
-        int max;
-    }
-    class CreateSessionTxn {
-        int timeOut;
-    }
-    class ErrorTxn {
-        int err;
-    }
-    class Txn {
-        int type;
-        buffer data;
-    }
-    class MultiTxn {
-        vector<org.apache.zookeeper.txn.Txn> txns;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/BinaryInputArchive.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/BinaryInputArchive.java b/zookeeper-jute/src/main/java/org/apache/jute/BinaryInputArchive.java
new file mode 100644
index 0000000..7722bff
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/BinaryInputArchive.java
@@ -0,0 +1,130 @@
+/**
+ * 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.jute;
+
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ *
+ */
+public class BinaryInputArchive implements InputArchive {
+    static public final String UNREASONBLE_LENGTH= "Unreasonable length = ";
+    private DataInput in;
+    
+    static public BinaryInputArchive getArchive(InputStream strm) {
+        return new BinaryInputArchive(new DataInputStream(strm));
+    }
+    
+    static private class BinaryIndex implements Index {
+        private int nelems;
+        BinaryIndex(int nelems) {
+            this.nelems = nelems;
+        }
+        public boolean done() {
+            return (nelems <= 0);
+        }
+        public void incr() {
+            nelems--;
+        }
+    }
+    /** Creates a new instance of BinaryInputArchive */
+    public BinaryInputArchive(DataInput in) {
+        this.in = in;
+    }
+    
+    public byte readByte(String tag) throws IOException {
+        return in.readByte();
+    }
+    
+    public boolean readBool(String tag) throws IOException {
+        return in.readBoolean();
+    }
+    
+    public int readInt(String tag) throws IOException {
+        return in.readInt();
+    }
+    
+    public long readLong(String tag) throws IOException {
+        return in.readLong();
+    }
+    
+    public float readFloat(String tag) throws IOException {
+        return in.readFloat();
+    }
+    
+    public double readDouble(String tag) throws IOException {
+        return in.readDouble();
+    }
+    
+    public String readString(String tag) throws IOException {
+    	int len = in.readInt();
+    	if (len == -1) return null;
+        checkLength(len);
+    	byte b[] = new byte[len];
+    	in.readFully(b);
+    	return new String(b, "UTF8");
+    }
+    
+    static public final int maxBuffer = Integer.getInteger("jute.maxbuffer", 0xfffff);
+
+    public byte[] readBuffer(String tag) throws IOException {
+        int len = readInt(tag);
+        if (len == -1) return null;
+        checkLength(len);
+        byte[] arr = new byte[len];
+        in.readFully(arr);
+        return arr;
+    }
+    
+    public void readRecord(Record r, String tag) throws IOException {
+        r.deserialize(this, tag);
+    }
+    
+    public void startRecord(String tag) throws IOException {}
+    
+    public void endRecord(String tag) throws IOException {}
+    
+    public Index startVector(String tag) throws IOException {
+        int len = readInt(tag);
+        if (len == -1) {
+        	return null;
+        }
+		return new BinaryIndex(len);
+    }
+    
+    public void endVector(String tag) throws IOException {}
+    
+    public Index startMap(String tag) throws IOException {
+        return new BinaryIndex(readInt(tag));
+    }
+    
+    public void endMap(String tag) throws IOException {}
+
+    // Since this is a rough sanity check, add some padding to maxBuffer to
+    // make up for extra fields, etc. (otherwise e.g. clients may be able to
+    // write buffers larger than we can read from disk!)
+    private void checkLength(int len) throws IOException {
+        if (len < 0 || len > maxBuffer + 1024) {
+            throw new IOException(UNREASONBLE_LENGTH + len);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/BinaryOutputArchive.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/BinaryOutputArchive.java b/zookeeper-jute/src/main/java/org/apache/jute/BinaryOutputArchive.java
new file mode 100644
index 0000000..213e203
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/BinaryOutputArchive.java
@@ -0,0 +1,146 @@
+/**
+ * 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.jute;
+
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.TreeMap;
+
+/**
+ *
+ */
+public class BinaryOutputArchive implements OutputArchive {
+    private ByteBuffer bb = ByteBuffer.allocate(1024);
+
+    private DataOutput out;
+    
+    public static BinaryOutputArchive getArchive(OutputStream strm) {
+        return new BinaryOutputArchive(new DataOutputStream(strm));
+    }
+    
+    /** Creates a new instance of BinaryOutputArchive */
+    public BinaryOutputArchive(DataOutput out) {
+        this.out = out;
+    }
+    
+    public void writeByte(byte b, String tag) throws IOException {
+        out.writeByte(b);
+    }
+    
+    public void writeBool(boolean b, String tag) throws IOException {
+        out.writeBoolean(b);
+    }
+    
+    public void writeInt(int i, String tag) throws IOException {
+        out.writeInt(i);
+    }
+    
+    public void writeLong(long l, String tag) throws IOException {
+        out.writeLong(l);
+    }
+    
+    public void writeFloat(float f, String tag) throws IOException {
+        out.writeFloat(f);
+    }
+    
+    public void writeDouble(double d, String tag) throws IOException {
+        out.writeDouble(d);
+    }
+    
+    /**
+     * create our own char encoder to utf8. This is faster 
+     * then string.getbytes(UTF8).
+     * @param s the string to encode into utf8
+     * @return utf8 byte sequence.
+     */
+    final private ByteBuffer stringToByteBuffer(CharSequence s) {
+        bb.clear();
+        final int len = s.length();
+        for (int i = 0; i < len; i++) {
+            if (bb.remaining() < 3) {
+                ByteBuffer n = ByteBuffer.allocate(bb.capacity() << 1);
+                bb.flip();
+                n.put(bb);
+                bb = n;
+            }
+            char c = s.charAt(i);
+            if (c < 0x80) {
+                bb.put((byte) c);
+            } else if (c < 0x800) {
+                bb.put((byte) (0xc0 | (c >> 6)));
+                bb.put((byte) (0x80 | (c & 0x3f)));
+            } else {
+                bb.put((byte) (0xe0 | (c >> 12)));
+                bb.put((byte) (0x80 | ((c >> 6) & 0x3f)));
+                bb.put((byte) (0x80 | (c & 0x3f)));
+            }
+        }
+        bb.flip();
+        return bb;
+    }
+
+    public void writeString(String s, String tag) throws IOException {
+        if (s == null) {
+            writeInt(-1, "len");
+            return;
+        }
+        ByteBuffer bb = stringToByteBuffer(s);
+        writeInt(bb.remaining(), "len");
+        out.write(bb.array(), bb.position(), bb.limit());
+    }
+
+    public void writeBuffer(byte barr[], String tag)
+    throws IOException {
+    	if (barr == null) {
+    		out.writeInt(-1);
+    		return;
+    	}
+    	out.writeInt(barr.length);
+        out.write(barr);
+    }
+    
+    public void writeRecord(Record r, String tag) throws IOException {
+        r.serialize(this, tag);
+    }
+    
+    public void startRecord(Record r, String tag) throws IOException {}
+    
+    public void endRecord(Record r, String tag) throws IOException {}
+    
+    public void startVector(List v, String tag) throws IOException {
+    	if (v == null) {
+    		writeInt(-1, tag);
+    		return;
+    	}
+        writeInt(v.size(), tag);
+    }
+    
+    public void endVector(List v, String tag) throws IOException {}
+    
+    public void startMap(TreeMap v, String tag) throws IOException {
+        writeInt(v.size(), tag);
+    }
+    
+    public void endMap(TreeMap v, String tag) throws IOException {}
+    
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/CsvInputArchive.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/CsvInputArchive.java b/zookeeper-jute/src/main/java/org/apache/jute/CsvInputArchive.java
new file mode 100644
index 0000000..3eb40ec
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/CsvInputArchive.java
@@ -0,0 +1,208 @@
+/**
+ * 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.jute;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PushbackReader;
+import java.io.UnsupportedEncodingException;
+
+/**
+ *
+ */
+class CsvInputArchive implements InputArchive {
+    
+    private PushbackReader stream;
+    
+    private class CsvIndex implements Index {
+        public boolean done() {
+            char c = '\0';
+            try {
+                c = (char) stream.read();
+                stream.unread(c);
+            } catch (IOException ex) {
+            }
+            return (c == '}') ? true : false;
+        }
+        public void incr() {}
+    }
+    
+    private void throwExceptionOnError(String tag) throws IOException {
+        throw new IOException("Error deserializing "+tag);
+    }
+    
+    private String readField(String tag) throws IOException {
+        try {
+            StringBuilder buf = new StringBuilder();
+            while (true) {
+                char c = (char) stream.read();
+                switch (c) {
+                    case ',':
+                        return buf.toString();
+                    case '}':
+                    case '\n':
+                    case '\r':
+                        stream.unread(c);
+                        return buf.toString();
+                    default:
+                        buf.append(c);
+                }
+            }
+        } catch (IOException ex) {
+            throw new IOException("Error reading "+tag);
+        }
+    }
+    
+    static CsvInputArchive getArchive(InputStream strm)
+    throws UnsupportedEncodingException {
+        return new CsvInputArchive(strm);
+    }
+    
+    /** Creates a new instance of CsvInputArchive */
+    public CsvInputArchive(InputStream in)
+    throws UnsupportedEncodingException {
+        stream = new PushbackReader(new InputStreamReader(in, "UTF-8"));
+    }
+    
+    public byte readByte(String tag) throws IOException {
+        return (byte) readLong(tag);
+    }
+    
+    public boolean readBool(String tag) throws IOException {
+        String sval = readField(tag);
+        return "T".equals(sval) ? true : false;
+    }
+    
+    public int readInt(String tag) throws IOException {
+        return (int) readLong(tag);
+    }
+    
+    public long readLong(String tag) throws IOException {
+        String sval = readField(tag);
+        try {
+            long lval = Long.parseLong(sval);
+            return lval;
+        } catch (NumberFormatException ex) {
+            throw new IOException("Error deserializing "+tag);
+        }
+    }
+    
+    public float readFloat(String tag) throws IOException {
+        return (float) readDouble(tag);
+    }
+    
+    public double readDouble(String tag) throws IOException {
+        String sval = readField(tag);
+        try {
+            double dval = Double.parseDouble(sval);
+            return dval;
+        } catch (NumberFormatException ex) {
+            throw new IOException("Error deserializing "+tag);
+        }
+    }
+    
+    public String readString(String tag) throws IOException {
+        String sval = readField(tag);
+        return Utils.fromCSVString(sval);
+        
+    }
+    
+    public byte[] readBuffer(String tag) throws IOException {
+        String sval = readField(tag);
+        return Utils.fromCSVBuffer(sval);
+    }
+    
+    public void readRecord(Record r, String tag) throws IOException {
+        r.deserialize(this, tag);
+    }
+    
+    public void startRecord(String tag) throws IOException {
+        if (tag != null && !"".equals(tag)) {
+            char c1 = (char) stream.read();
+            char c2 = (char) stream.read();
+            if (c1 != 's' || c2 != '{') {
+                throw new IOException("Error deserializing "+tag);
+            }
+        }
+    }
+    
+    public void endRecord(String tag) throws IOException {
+        char c = (char) stream.read();
+        if (tag == null || "".equals(tag)) {
+            if (c != '\n' && c != '\r') {
+                throw new IOException("Error deserializing record.");
+            } else {
+                return;
+            }
+        }
+        
+        if (c != '}') {
+            throw new IOException("Error deserializing "+tag);
+        }
+        c = (char) stream.read();
+        if (c != ',') {
+            stream.unread(c);
+        }
+        
+        return;
+    }
+    
+    public Index startVector(String tag) throws IOException {
+        char c1 = (char) stream.read();
+        char c2 = (char) stream.read();
+        if (c1 != 'v' || c2 != '{') {
+            throw new IOException("Error deserializing "+tag);
+        }
+        return new CsvIndex();
+    }
+    
+    public void endVector(String tag) throws IOException {
+        char c = (char) stream.read();
+        if (c != '}') {
+            throw new IOException("Error deserializing "+tag);
+        }
+        c = (char) stream.read();
+        if (c != ',') {
+            stream.unread(c);
+        }
+        return;
+    }
+    
+    public Index startMap(String tag) throws IOException {
+        char c1 = (char) stream.read();
+        char c2 = (char) stream.read();
+        if (c1 != 'm' || c2 != '{') {
+            throw new IOException("Error deserializing "+tag);
+        }
+        return new CsvIndex();
+    }
+    
+    public void endMap(String tag) throws IOException {
+        char c = (char) stream.read();
+        if (c != '}') {
+            throw new IOException("Error deserializing "+tag);
+        }
+        c = (char) stream.read();
+        if (c != ',') {
+            stream.unread(c);
+        }
+        return;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/CsvOutputArchive.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/CsvOutputArchive.java b/zookeeper-jute/src/main/java/org/apache/jute/CsvOutputArchive.java
new file mode 100644
index 0000000..f6d60d8
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/CsvOutputArchive.java
@@ -0,0 +1,150 @@
+/**
+ * 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.jute;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+import java.util.TreeMap;
+
+/**
+ *
+ */
+public class CsvOutputArchive implements OutputArchive {
+
+    private PrintStream stream;
+    private boolean isFirst = true;
+    
+    static CsvOutputArchive getArchive(OutputStream strm)
+    throws UnsupportedEncodingException {
+        return new CsvOutputArchive(strm);
+    }
+    
+    private void throwExceptionOnError(String tag) throws IOException {
+        if (stream.checkError()) {
+            throw new IOException("Error serializing "+tag);
+        }
+    }
+ 
+    private void printCommaUnlessFirst() {
+        if (!isFirst) {
+            stream.print(",");
+        }
+        isFirst = false;
+    }
+    
+    /** Creates a new instance of CsvOutputArchive */
+    public CsvOutputArchive(OutputStream out)
+    throws UnsupportedEncodingException {
+        stream = new PrintStream(out, true, "UTF-8");
+    }
+    
+    public void writeByte(byte b, String tag) throws IOException {
+        writeLong((long)b, tag);
+    }
+    
+    public void writeBool(boolean b, String tag) throws IOException {
+        printCommaUnlessFirst();
+        String val = b ? "T" : "F";
+        stream.print(val);
+        throwExceptionOnError(tag);
+    }
+    
+    public void writeInt(int i, String tag) throws IOException {
+        writeLong((long)i, tag);
+    }
+    
+    public void writeLong(long l, String tag) throws IOException {
+        printCommaUnlessFirst();
+        stream.print(l);
+        throwExceptionOnError(tag);
+    }
+    
+    public void writeFloat(float f, String tag) throws IOException {
+        writeDouble((double)f, tag);
+    }
+    
+    public void writeDouble(double d, String tag) throws IOException {
+        printCommaUnlessFirst();
+        stream.print(d);
+        throwExceptionOnError(tag);
+    }
+    
+    public void writeString(String s, String tag) throws IOException {
+        printCommaUnlessFirst();
+        stream.print(Utils.toCSVString(s));
+        throwExceptionOnError(tag);
+    }
+    
+    public void writeBuffer(byte buf[], String tag)
+    throws IOException {
+        printCommaUnlessFirst();
+        stream.print(Utils.toCSVBuffer(buf));
+        throwExceptionOnError(tag);
+    }
+    
+    public void writeRecord(Record r, String tag) throws IOException {
+        if (r == null) {
+            return;
+        }
+        r.serialize(this, tag);
+    }
+    
+    public void startRecord(Record r, String tag) throws IOException {
+        if (tag != null && !"".equals(tag)) {
+            printCommaUnlessFirst();
+            stream.print("s{");
+            isFirst = true;
+        }
+    }
+    
+    public void endRecord(Record r, String tag) throws IOException {
+        if (tag == null || "".equals(tag)) {
+            stream.print("\n");
+            isFirst = true;
+        } else {
+            stream.print("}");
+            isFirst = false;
+        }
+    }
+    
+    public void startVector(List v, String tag) throws IOException {
+        printCommaUnlessFirst();
+        stream.print("v{");
+        isFirst = true;
+    }
+    
+    public void endVector(List v, String tag) throws IOException {
+        stream.print("}");
+        isFirst = false;
+    }
+    
+    public void startMap(TreeMap v, String tag) throws IOException {
+        printCommaUnlessFirst();
+        stream.print("m{");
+        isFirst = true;
+    }
+    
+    public void endMap(TreeMap v, String tag) throws IOException {
+        stream.print("}");
+        isFirst = false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/Index.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/Index.java b/zookeeper-jute/src/main/java/org/apache/jute/Index.java
new file mode 100644
index 0000000..258c6b5
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/Index.java
@@ -0,0 +1,38 @@
+/**
+ * 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.jute;
+
+/**
+ * Interface that acts as an iterator for deserializing maps.
+ * The deserializer returns an instance that the record uses to
+ * read vectors and maps. An example of usage is as follows:
+ *
+ * <code>
+ * Index idx = startVector(...);
+ * while (!idx.done()) {
+ *   .... // read element of a vector
+ *   idx.incr();
+ * }
+ * </code>
+ *
+ */
+public interface Index {
+    public boolean done();
+    public void incr();
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/InputArchive.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/InputArchive.java b/zookeeper-jute/src/main/java/org/apache/jute/InputArchive.java
new file mode 100644
index 0000000..b19ab3d
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/InputArchive.java
@@ -0,0 +1,43 @@
+/**
+ * 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.jute;
+
+import java.io.IOException;
+
+/**
+ * Interface that all the Deserializers have to implement.
+ *
+ */
+public interface InputArchive {
+    public byte readByte(String tag) throws IOException;
+    public boolean readBool(String tag) throws IOException;
+    public int readInt(String tag) throws IOException;
+    public long readLong(String tag) throws IOException;
+    public float readFloat(String tag) throws IOException;
+    public double readDouble(String tag) throws IOException;
+    public String readString(String tag) throws IOException;
+    public byte[] readBuffer(String tag) throws IOException;
+    public void readRecord(Record r, String tag) throws IOException;
+    public void startRecord(String tag) throws IOException;
+    public void endRecord(String tag) throws IOException;
+    public Index startVector(String tag) throws IOException;
+    public void endVector(String tag) throws IOException;
+    public Index startMap(String tag) throws IOException;
+    public void endMap(String tag) throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/OutputArchive.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/OutputArchive.java b/zookeeper-jute/src/main/java/org/apache/jute/OutputArchive.java
new file mode 100644
index 0000000..4e084e8
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/OutputArchive.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.jute;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.TreeMap;
+
+/**
+ * Interface that alll the serializers have to implement.
+ *
+ */
+public interface OutputArchive {
+    public void writeByte(byte b, String tag) throws IOException;
+    public void writeBool(boolean b, String tag) throws IOException;
+    public void writeInt(int i, String tag) throws IOException;
+    public void writeLong(long l, String tag) throws IOException;
+    public void writeFloat(float f, String tag) throws IOException;
+    public void writeDouble(double d, String tag) throws IOException;
+    public void writeString(String s, String tag) throws IOException;
+    public void writeBuffer(byte buf[], String tag)
+        throws IOException;
+    public void writeRecord(Record r, String tag) throws IOException;
+    public void startRecord(Record r, String tag) throws IOException;
+    public void endRecord(Record r, String tag) throws IOException;
+    public void startVector(List v, String tag) throws IOException;
+    public void endVector(List v, String tag) throws IOException;
+    public void startMap(TreeMap v, String tag) throws IOException;
+    public void endMap(TreeMap v, String tag) throws IOException;
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/Record.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/Record.java b/zookeeper-jute/src/main/java/org/apache/jute/Record.java
new file mode 100644
index 0000000..d955280
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/Record.java
@@ -0,0 +1,35 @@
+/**
+ * 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.jute;
+
+import org.apache.yetus.audience.InterfaceAudience;
+
+import java.io.IOException;
+
+/**
+ * Interface that is implemented by generated classes.
+ * 
+ */
+@InterfaceAudience.Public
+public interface Record {
+    public void serialize(OutputArchive archive, String tag)
+        throws IOException;
+    public void deserialize(InputArchive archive, String tag)
+        throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/RecordReader.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/RecordReader.java b/zookeeper-jute/src/main/java/org/apache/jute/RecordReader.java
new file mode 100644
index 0000000..2977d3f
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/RecordReader.java
@@ -0,0 +1,93 @@
+/**
+ * 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.jute;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
+/**
+ * Front-end interface to deserializers. Also acts as a factory
+ * for deserializers.
+ *
+ */
+public class RecordReader {
+    
+    private InputArchive archive;
+
+    static private HashMap archiveFactory;
+    
+    static {
+        archiveFactory = new HashMap();
+        Class[] params = { InputStream.class };
+        try {
+            archiveFactory.put("binary",
+                    BinaryInputArchive.class.getDeclaredMethod(
+                        "getArchive", params));
+            archiveFactory.put("csv",
+                    CsvInputArchive.class.getDeclaredMethod(
+                        "getArchive", params));
+            archiveFactory.put("xml",
+                    XmlInputArchive.class.getDeclaredMethod(
+                        "getArchive", params));
+        } catch (SecurityException ex) {
+            ex.printStackTrace();
+        } catch (NoSuchMethodException ex) {
+            ex.printStackTrace();
+        }
+    }
+    
+    static private InputArchive createArchive(InputStream in, String format)
+    throws IOException {
+        Method factory = (Method) archiveFactory.get(format);
+        if (factory != null) {
+            Object[] params = { in };
+            try {
+                return (InputArchive) factory.invoke(null, params);
+            } catch (IllegalArgumentException ex) {
+                ex.printStackTrace();
+            } catch (InvocationTargetException ex) {
+                ex.printStackTrace();
+            } catch (IllegalAccessException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return null;
+    }
+    /**
+     * Creates a new instance of RecordReader.
+     * @param in Stream from which to deserialize a record
+     * @param format Deserialization format ("binary", "xml", or "csv")
+     */
+    public RecordReader(InputStream in, String format)
+    throws IOException {
+        archive = createArchive(in, format);
+    }
+    
+    /**
+     * Deserialize a record
+     * @param r Record to be deserialized
+     */
+    public void read(Record r) throws IOException {
+        r.deserialize(archive, "");
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/RecordWriter.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/RecordWriter.java b/zookeeper-jute/src/main/java/org/apache/jute/RecordWriter.java
new file mode 100644
index 0000000..0adbd56
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/RecordWriter.java
@@ -0,0 +1,113 @@
+/**
+ * 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.jute;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
+/**
+ * Front-end for serializers. Also serves as a factory for serializers.
+ *
+ */
+public class RecordWriter {
+    
+    private OutputArchive archive;
+    
+    static private OutputArchive getBinaryArchive(OutputStream out) {
+        return new BinaryOutputArchive(new DataOutputStream(out));
+    }
+    
+    static private OutputArchive getCsvArchive(OutputStream out)
+    throws IOException {
+        try {
+            return new CsvOutputArchive(out);
+        } catch (UnsupportedEncodingException ex) {
+            throw new IOException("Unsupported encoding UTF-8");
+        }
+    }
+    
+    static private OutputArchive getXmlArchive(OutputStream out)
+    throws IOException {
+        return new XmlOutputArchive(out);
+    }
+
+    static HashMap constructFactory() {
+        HashMap factory = new HashMap();
+        Class[] params = { OutputStream.class };
+        try {
+            factory.put("binary",
+                    BinaryOutputArchive.class.getDeclaredMethod(
+                        "getArchive", params));
+            factory.put("csv",
+                    CsvOutputArchive.class.getDeclaredMethod(
+                        "getArchive", params));
+            factory.put("xml",
+                    XmlOutputArchive.class.getDeclaredMethod(
+                        "getArchive", params));
+        } catch (SecurityException ex) {
+            ex.printStackTrace();
+        } catch (NoSuchMethodException ex) {
+            ex.printStackTrace();
+        }
+        return factory;
+    }
+    
+    static private HashMap archiveFactory = constructFactory();
+    
+    static private OutputArchive createArchive(OutputStream out,
+            String format)
+            throws IOException {
+        Method factory = (Method) archiveFactory.get(format);
+        if (factory != null) {
+            Object[] params = { out };
+            try {
+                return (OutputArchive) factory.invoke(null, params);
+            } catch (IllegalArgumentException ex) {
+                ex.printStackTrace();
+            } catch (InvocationTargetException ex) {
+                ex.printStackTrace();
+            } catch (IllegalAccessException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return null;
+    }
+    /**
+     * Creates a new instance of RecordWriter
+     * @param out Output stream where the records will be serialized
+     * @param format Serialization format ("binary", "xml", or "csv")
+     */
+    public RecordWriter(OutputStream out, String format)
+    throws IOException {
+        archive = createArchive(out, format);
+    }
+    
+    /**
+     * Serialize a record
+     * @param r record to be serialized
+     */
+    public void write(Record r) throws IOException {
+        r.serialize(archive, "");
+    }
+}


[7/8] zookeeper git commit: ZOOKEEPER-3080_3.4: MAVEN MIGRATION - Step 1.5 - move jute dir

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/CppGenerator.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/CppGenerator.java b/src/java/main/org/apache/jute/compiler/CppGenerator.java
deleted file mode 100644
index 98892a3..0000000
--- a/src/java/main/org/apache/jute/compiler/CppGenerator.java
+++ /dev/null
@@ -1,136 +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.jute.compiler;
-
-import java.util.ArrayList;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Iterator;
-
-/**
- * C++ Code generator front-end for Hadoop record I/O.
- */
-class CppGenerator {
-    private String mName;
-    private ArrayList<JFile> mInclFiles;
-    private ArrayList<JRecord> mRecList;
-    private final File outputDirectory;
-
-    /** Creates a new instance of CppGenerator
-     *
-     * @param name possibly full pathname to the file
-     * @param ilist included files (as JFile)
-     * @param rlist List of records defined within this file
-     * @param outputDirectory
-     */
-    CppGenerator(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist,
-            File outputDirectory)
-     {
-        this.outputDirectory = outputDirectory;
-        mName = (new File(name)).getName();
-        mInclFiles = ilist;
-        mRecList = rlist;
-    }
-
-    /**
-     * Generate C++ code. This method only creates the requested file(s)
-     * and spits-out file-level elements (such as include statements etc.)
-     * record-level code is generated by JRecord.
-     */
-    void genCode() throws IOException {
-        if (!outputDirectory.exists()) {
-            if (!outputDirectory.mkdirs()) {
-                throw new IOException("unable to create output directory "
-                        + outputDirectory);
-            }
-        }
-        FileWriter cc = null;
-        FileWriter hh = null;
-
-        try {
-            cc = new FileWriter(new File(outputDirectory, mName+".cc"));
-            hh = new FileWriter(new File(outputDirectory, mName+".hh"));
-            hh.write("/**\n");
-            hh.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
-            hh.write("* or more contributor license agreements.  See the NOTICE file\n");
-            hh.write("* distributed with this work for additional information\n");
-            hh.write("* regarding copyright ownership.  The ASF licenses this file\n");
-            hh.write("* to you under the Apache License, Version 2.0 (the\n");
-            hh.write("* \"License\"); you may not use this file except in compliance\n");
-            hh.write("* with the License.  You may obtain a copy of the License at\n");
-            hh.write("*\n");
-            hh.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
-            hh.write("*\n");
-            hh.write("* Unless required by applicable law or agreed to in writing, software\n");
-            hh.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
-            hh.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
-            hh.write("* See the License for the specific language governing permissions and\n");
-            hh.write("* limitations under the License.\n");
-            hh.write("*/\n");
-            hh.write("\n");
-
-            cc.write("/**\n");
-            cc.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
-            cc.write("* or more contributor license agreements.  See the NOTICE file\n");
-            cc.write("* distributed with this work for additional information\n");
-            cc.write("* regarding copyright ownership.  The ASF licenses this file\n");
-            cc.write("* to you under the Apache License, Version 2.0 (the\n");
-            cc.write("* \"License\"); you may not use this file except in compliance\n");
-            cc.write("* with the License.  You may obtain a copy of the License at\n");
-            cc.write("*\n");
-            cc.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
-            cc.write("*\n");
-            cc.write("* Unless required by applicable law or agreed to in writing, software\n");
-            cc.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
-            cc.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
-            cc.write("* See the License for the specific language governing permissions and\n");
-            cc.write("* limitations under the License.\n");
-            cc.write("*/\n");
-            cc.write("\n");
-
-            hh.write("#ifndef __"+mName.toUpperCase().replace('.','_')+"__\n");
-            hh.write("#define __"+mName.toUpperCase().replace('.','_')+"__\n");
-
-            hh.write("#include \"recordio.hh\"\n");
-            for (Iterator<JFile> i = mInclFiles.iterator(); i.hasNext();) {
-                JFile f = i.next();
-                hh.write("#include \""+f.getName()+".hh\"\n");
-            }
-            cc.write("#include \""+mName+".hh\"\n");
-
-            for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext();) {
-                JRecord jr = i.next();
-                jr.genCppCode(hh, cc);
-            }
-
-            hh.write("#endif //"+mName.toUpperCase().replace('.','_')+"__\n");
-        } finally {
-            try {
-                if (hh != null) {
-                    hh.close();
-                }
-            } finally {
-                if (cc != null) {
-                    cc.close();
-                }
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JBoolean.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JBoolean.java b/src/java/main/org/apache/jute/compiler/JBoolean.java
deleted file mode 100644
index b45b161..0000000
--- a/src/java/main/org/apache/jute/compiler/JBoolean.java
+++ /dev/null
@@ -1,50 +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.jute.compiler;
-
-/**
- *
- */
-public class JBoolean extends JType {
-    
-    /** Creates a new instance of JBoolean */
-    public JBoolean() {
-        super("int32_t", "bool", "bool", "boolean", "Bool", "Boolean", "bool", "toBoolean");
-    }
-    
-    public String getSignature() {
-        return "z";
-    }
-    
-    public String genJavaCompareTo(String fname) {
-        return "    ret = ("+fname+" == peer."+fname+")? 0 : ("+fname+"?1:-1);\n";
-    }
-    
-    public String genJavaHashCode(String fname) {
-        return "     ret = ("+fname+")?0:1;\n";
-    }
-
-    String genCsharpHashCode(String fname) {
-        return "     ret = ("+capitalize(fname)+")?0:1;\n";
-    }
-
-    String genCsharpCompareTo(String name) {
-        return "    ret = ("+capitalize(name)+" == peer."+capitalize(name)+")? 0 : ("+capitalize(name)+"?1:-1);\n";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JBuffer.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JBuffer.java b/src/java/main/org/apache/jute/compiler/JBuffer.java
deleted file mode 100644
index b2be5bd..0000000
--- a/src/java/main/org/apache/jute/compiler/JBuffer.java
+++ /dev/null
@@ -1,106 +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.jute.compiler;
-
-/**
- *
- */
-public class JBuffer extends JCompType {
-    
-    /** Creates a new instance of JBuffer */
-    public JBuffer() {
-        super("struct buffer", " ::std::string", "byte[]", "byte[]", "Buffer", "byte[]", "byte[]");
-    }
-    
-    public String genCppGetSet(String fname, int fIdx) {
-        String cgetFunc = "  virtual const "+getCppType()+"& get"+fname+"() const {\n";
-        cgetFunc += "    return m"+fname+";\n";
-        cgetFunc += "  }\n";
-        String getFunc = "  virtual "+getCppType()+"& get"+fname+"() {\n";
-        getFunc += "    bs_.set("+fIdx+");return m"+fname+";\n";
-        getFunc += "  }\n";
-        return cgetFunc + getFunc;
-    }
-    
-    public String getSignature() {
-        return "B";
-    }
-    
-    public String genJavaReadWrapper(String fname, String tag, boolean decl) {
-        String ret = "";
-        if (decl) {
-            ret = "    byte[] "+fname+";\n";
-        }
-        return ret + "        "+fname+"=a_.readBuffer(\""+tag+"\");\n";
-    }
-    
-    public String genJavaWriteWrapper(String fname, String tag) {
-        return "        a_.writeBuffer("+fname+",\""+tag+"\");\n";
-    }
-    
-    public String genJavaCompareTo(String fname, String other) {
-      StringBuilder sb = new StringBuilder();
-      sb.append("    {\n");
-      sb.append("      byte[] my = "+fname+";\n");
-      sb.append("      byte[] ur = "+other+";\n");
-      sb.append("      ret = org.apache.jute.Utils.compareBytes(my,0,my.length,ur,0,ur.length);\n");
-      sb.append("    }\n");
-      return sb.toString();
-    }
-    
-    public String genJavaCompareTo(String fname) {
-        return genJavaCompareTo(fname, "peer."+fname);
-    }
-    public String genJavaCompareToWrapper(String fname, String other) {
-      return "    "+genJavaCompareTo(fname, other);
-    }
-    
-    public String genJavaEquals(String fname, String peer) {
-        return "    ret = org.apache.jute.Utils.bufEquals("+fname+","+peer+");\n";
-    }
-    
-    public String genJavaHashCode(String fname) {
-        return "    ret = java.util.Arrays.toString("+fname+").hashCode();\n";
-    }
-    
-    public String genJavaSlurpBytes(String b, String s, String l) {
-      StringBuilder sb = new StringBuilder();
-      sb.append("        {\n");
-      sb.append("           int i = org.apache.jute.Utils.readVInt("+b+", "+s+");\n");
-      sb.append("           int z = WritableUtils.getVIntSize(i);\n");
-      sb.append("           "+s+" += z+i; "+l+" -= (z+i);\n");
-      sb.append("        }\n");
-      return sb.toString();
-    }
-    
-    public String genJavaCompareBytes() {
-      StringBuilder sb = new StringBuilder();
-      sb.append("        {\n");
-      sb.append("           int i1 = org.apache.jute.Utils.readVInt(b1, s1);\n");
-      sb.append("           int i2 = org.apache.jute.Utils.readVInt(b2, s2);\n");
-      sb.append("           int z1 = WritableUtils.getVIntSize(i1);\n");
-      sb.append("           int z2 = WritableUtils.getVIntSize(i2);\n");
-      sb.append("           s1+=z1; s2+=z2; l1-=z1; l2-=z2;\n");
-      sb.append("           int r1 = org.apache.jute.Utils.compareBytes(b1,s1,l1,b2,s2,l2);\n");
-      sb.append("           if (r1 != 0) { return (r1<0)?-1:0; }\n");
-      sb.append("           s1+=i1; s2+=i2; l1-=i1; l1-=i2;\n");
-      sb.append("        }\n");
-      return sb.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JByte.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JByte.java b/src/java/main/org/apache/jute/compiler/JByte.java
deleted file mode 100644
index 4b1cea4..0000000
--- a/src/java/main/org/apache/jute/compiler/JByte.java
+++ /dev/null
@@ -1,34 +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.jute.compiler;
-
-/**
- *
- */
-public class JByte extends JType {
-    
-    /** Creates a new instance of JByte */
-    public JByte() {
-        super("char", "int8_t", "byte", "byte", "Byte", "Byte", "byte", "toByte");
-    }
-    
-    public String getSignature() {
-        return "b";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JCompType.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JCompType.java b/src/java/main/org/apache/jute/compiler/JCompType.java
deleted file mode 100644
index d98658f..0000000
--- a/src/java/main/org/apache/jute/compiler/JCompType.java
+++ /dev/null
@@ -1,66 +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.jute.compiler;
-
-/**
- * Abstract base class for all the "compound" types such as ustring,
- * buffer, vector, map, and record.
- */
-abstract class JCompType extends JType {
-    
-    /** Creates a new instance of JCompType */
-    JCompType(String cType, String cppType, String csharpType, String javaType, String suffix, String wrapper, String csharpWrapper) {
-        super(cType, cppType, csharpType, javaType, suffix, wrapper, csharpWrapper, null);
-    }
-    
-    String genCppGetSet(String fname, int fIdx) {
-        String cgetFunc = "  virtual const "+getCppType()+"& get"+fname+"() const {\n";
-        cgetFunc += "    return m"+fname+";\n";
-        cgetFunc += "  }\n";
-        String getFunc = "  virtual "+getCppType()+"& get"+fname+"() {\n";
-        getFunc += "    bs_.set("+fIdx+");return m"+fname+";\n";
-        getFunc += "  }\n";
-        return cgetFunc + getFunc;
-    }
-    
-    String genJavaCompareTo(String fname) {
-        return "    ret = "+fname+".compareTo(peer."+fname+");\n";
-    }
-    
-    String genJavaEquals(String fname, String peer) {
-        return "    ret = "+fname+".equals("+peer+");\n";
-    }
-    
-    String genJavaHashCode(String fname) {
-        return "    ret = "+fname+".hashCode();\n";
-    }
-
-    String genCsharpHashCode(String fname) {
-        return "    ret = "+capitalize(fname)+".GetHashCode();\n";
-    }
-
-    String genCsharpEquals(String name, String peer) {
-        String[] peerSplit = peer.split("\\.");
-        return "    ret = "+capitalize(name)+".Equals("+peerSplit[0] + "." + capitalize(peerSplit[1]) + ");\n";
-    }
-
-    String genCsharpCompareTo(String name) {
-        return "    ret = "+capitalize(name)+".CompareTo(peer."+capitalize(name)+");\n";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JDouble.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JDouble.java b/src/java/main/org/apache/jute/compiler/JDouble.java
deleted file mode 100644
index 21f9cc8..0000000
--- a/src/java/main/org/apache/jute/compiler/JDouble.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.jute.compiler;
-
-/**
- *
- */
-public class JDouble extends JType {
-    
-    /** Creates a new instance of JDouble */
-    public JDouble() {
-        super("double", "double", "double", "double", "Double", "Double", "double", "toDouble");
-    }
-    
-    public String getSignature() {
-        return "d";
-    }
-    
-    public String genJavaHashCode(String fname) {
-        String tmp = "Double.doubleToLongBits("+fname+")";
-        return "    ret = (int)("+tmp+"^("+tmp+">>>32));\n";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JField.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JField.java b/src/java/main/org/apache/jute/compiler/JField.java
deleted file mode 100644
index 50f9fc9..0000000
--- a/src/java/main/org/apache/jute/compiler/JField.java
+++ /dev/null
@@ -1,140 +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.jute.compiler;
-
-/**
- *
- */
-public class JField {
-    private JType mType;
-    private String mName;
-    /**
-     * Creates a new instance of JField
-     */
-    public JField(JType type, String name) {
-        mType = type;
-        mName = name;
-    }
-    
-    public String getSignature() {
-        return mType.getSignature();
-    }
-    
-    public String genCppDecl() {
-        return mType.genCppDecl(mName);
-    }
-    
-	public String genCDecl() {
-		return mType.genCDecl(mName);
-	}
-
-    public String genCsharpDecl() {
-        return mType.genCsharpDecl(mName);
-    }
-
-    public String genCsharpConstructorParam(String fname) {
-        return mType.genCsharpConstructorParam(fname);
-    }
-	
-    public String genJavaDecl() {
-        return mType.genJavaDecl(mName);
-    }
-    
-    public String genJavaConstructorParam(String fname) {
-        return mType.genJavaConstructorParam(fname);
-    }
-    
-    public String getName() {
-        return mName;
-    }
-
-    public String getCsharpName() {
-        return "Id".equals(mName) ? "ZKId" : mName;
-    }
-    
-    public String getTag() {
-        return mName;
-    }
-    
-    public JType getType() {
-        return mType;
-    }
-    
-    public String genCppGetSet(int fIdx) {
-        return mType.genCppGetSet(mName, fIdx);
-    }
-
-    public String genCsharpConstructorSet(String fname) {
-        return mType.genCsharpConstructorSet(mName, fname);
-    }
-
-    public String genCsharpGetSet(int fIdx) {
-        return mType.genCsharpGetSet(getCsharpName(), fIdx);
-    }
-
-    public String genCsharpWriteMethodName() {
-        return mType.genCsharpWriteMethod(getCsharpName(), getTag());
-    }
-
-    public String genCsharpReadMethodName() {
-        return mType.genCsharpReadMethod(getCsharpName(), getTag());
-    }
-
-    public String genCsharpCompareTo() {
-        return mType.genCsharpCompareTo(getCsharpName());
-    }
-
-    public String genCsharpEquals() {
-        return mType.genCsharpEquals(getCsharpName(), "peer."+getCsharpName());
-    }
-
-    public String genCsharpHashCode() {
-        return mType.genCsharpHashCode(getCsharpName());
-    }
-
-    
-    public String genJavaGetSet(int fIdx) {
-        return mType.genJavaGetSet(mName, fIdx);
-    }
-    
-    public String genJavaWriteMethodName() {
-        return mType.genJavaWriteMethod(getName(), getTag());
-    }
-    
-    public String genJavaReadMethodName() {
-        return mType.genJavaReadMethod(getName(), getTag());
-    }
-    
-    public String genJavaCompareTo() {
-        return mType.genJavaCompareTo(getName());
-    }
-    
-    public String genJavaEquals() {
-        return mType.genJavaEquals(getName(), "peer."+getName());
-    }
-    
-    public String genJavaHashCode() {
-        return mType.genJavaHashCode(getName());
-    }
-
-    public String genJavaConstructorSet(String fname) {
-        return mType.genJavaConstructorSet(mName, fname);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JFile.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JFile.java b/src/java/main/org/apache/jute/compiler/JFile.java
deleted file mode 100644
index e5b0ba3..0000000
--- a/src/java/main/org/apache/jute/compiler/JFile.java
+++ /dev/null
@@ -1,84 +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.jute.compiler;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-
-/**
- * Container for the Hadoop Record DDL.
- * The main components of the file are filename, list of included files,
- * and records defined in that file.
- *
- */
-public class JFile {
-    
-    private String mName;
-    private ArrayList<JFile> mInclFiles;
-    private ArrayList<JRecord> mRecords;
-    
-    /** Creates a new instance of JFile
-     *
-     * @param name possibly full pathname to the file
-     * @param inclFiles included files (as JFile)
-     * @param recList List of records defined within this file
-     */
-    public JFile(String name, ArrayList<JFile> inclFiles,
-            ArrayList<JRecord> recList)
-    {
-        mName = name;
-        mInclFiles = inclFiles;
-        mRecords = recList;
-    }
-    
-    /** Strip the other pathname components and return the basename */
-    String getName() {
-        int idx = mName.lastIndexOf('/');
-        return (idx > 0) ? mName.substring(idx) : mName; 
-    }
-    
-    /** Generate record code in given language. Language should be all
-     *  lowercase.
-     * @param outputDirectory 
-     */
-    public void genCode(String language, File outputDirectory)
-        throws IOException
-    {
-        if ("c++".equals(language)) {
-            CppGenerator gen = new CppGenerator(mName, mInclFiles, mRecords,
-                    outputDirectory);
-            gen.genCode();
-        } else if ("java".equals(language)) {
-            JavaGenerator gen = new JavaGenerator(mName, mInclFiles, mRecords,
-                    outputDirectory);
-            gen.genCode();
-        } else if ("c".equals(language)) {
-        	CGenerator gen = new CGenerator(mName, mInclFiles, mRecords,
-        	        outputDirectory);
-        	gen.genCode();
-        } else if ("csharp".equals(language)) {
-        	CSharpGenerator gen = new CSharpGenerator(mName, mInclFiles, mRecords,
-        	        outputDirectory);
-        	gen.genCode();
-        } else {
-            throw new IOException("Cannnot recognize language:" + language);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JFloat.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JFloat.java b/src/java/main/org/apache/jute/compiler/JFloat.java
deleted file mode 100644
index a4be6ec..0000000
--- a/src/java/main/org/apache/jute/compiler/JFloat.java
+++ /dev/null
@@ -1,39 +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.jute.compiler;
-
-/**
- *
- */
-public class JFloat extends JType {
-    
-    /** Creates a new instance of JFloat */
-    public JFloat() {
-        super("float", "float", "float", "float", "Float", "Float", "float", "toFloat");
-    }
-    
-    public String getSignature() {
-        return "f";
-    }
-    
-    public String genJavaHashCode(String fname) {
-        return "    ret = Float.floatToIntBits("+fname+");\n";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JInt.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JInt.java b/src/java/main/org/apache/jute/compiler/JInt.java
deleted file mode 100644
index 23b902e..0000000
--- a/src/java/main/org/apache/jute/compiler/JInt.java
+++ /dev/null
@@ -1,34 +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.jute.compiler;
-
-/**
- *
- */
-public class JInt extends JType {
-    
-    /** Creates a new instance of JInt */
-    public JInt() {
-        super("int32_t", "int32_t", "int", "int", "Int", "Integer", "int", "toInt");
-    }
-    
-    public String getSignature() {
-        return "i";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JLong.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JLong.java b/src/java/main/org/apache/jute/compiler/JLong.java
deleted file mode 100644
index 342fd9a..0000000
--- a/src/java/main/org/apache/jute/compiler/JLong.java
+++ /dev/null
@@ -1,38 +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.jute.compiler;
-
-/**
- *
- */
-public class JLong extends JType {
-    
-    /** Creates a new instance of JLong */
-    public JLong() {
-        super("int64_t", "int64_t", "long", "long", "Long", "Long", "long", "toLong");
-    }
-    
-    public String getSignature() {
-        return "l";
-    }
-    
-    public String genJavaHashCode(String fname) {
-        return "    ret = (int) ("+fname+"^("+fname+">>>32));\n";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JMap.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JMap.java b/src/java/main/org/apache/jute/compiler/JMap.java
deleted file mode 100644
index cc503be..0000000
--- a/src/java/main/org/apache/jute/compiler/JMap.java
+++ /dev/null
@@ -1,149 +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.jute.compiler;
-
-/**
- *
- */
-public class JMap extends JCompType {
-   
-    static private int level = 0;
-    
-    static private String getLevel() { return Integer.toString(level); }
-    
-    static private void incrLevel() { level++; }
-    
-    static private void decrLevel() { level--; }
-    
-    static private String getId(String id) { return id+getLevel(); }
-    
-    private JType mKey;
-    private JType mValue;
-    
-    /** Creates a new instance of JMap */
-    public JMap(JType t1, JType t2) {
-        super("#error", " ::std::map<"+t1.getCppType()+","+t2.getCppType()+">",
-                "System.Collections.Generic.SortedDictionary<string, string>", "java.util.TreeMap", "Map", "System.Collections.Generic.SortedDictionary<string, string>", "java.util.TreeMap");
-        mKey = t1;
-        mValue = t2;
-    }
-    
-    public String getSignature() {
-        return "{" + mKey.getSignature() + mValue.getSignature() +"}";
-    }
-    
-    public String genJavaCompareTo(String fname) {
-        return "    throw new UnsupportedOperationException(\"comparing "
-            + fname + " is unimplemented\");\n";
-    }
-    
-    public String genJavaReadWrapper(String fname, String tag, boolean decl) {
-        StringBuilder ret = new StringBuilder("");
-        if (decl) {
-            ret.append("    java.util.TreeMap "+fname+";\n");
-        }
-        ret.append("    {\n");
-        incrLevel();
-        ret.append("      org.apache.jute.Index "+getId("midx")+" = a_.startMap(\""+tag+"\");\n");
-        ret.append("      "+fname+"=new java.util.TreeMap();\n");
-        ret.append("      for (; !"+getId("midx")+".done(); "+getId("midx")+".incr()) {\n");
-        ret.append(mKey.genJavaReadWrapper(getId("k"),getId("k"),true));
-        ret.append(mValue.genJavaReadWrapper(getId("v"),getId("v"),true));
-        ret.append("        "+fname+".put("+getId("k")+","+getId("v")+");\n");
-        ret.append("      }\n");
-        ret.append("    a_.endMap(\""+tag+"\");\n");
-        decrLevel();
-        ret.append("    }\n");
-        return ret.toString();
-    }
-    
-    public String genJavaReadMethod(String fname, String tag) {
-        return genJavaReadWrapper(fname, tag, false);
-    }
-    
-    public String genJavaWriteWrapper(String fname, String tag) {
-        StringBuilder ret = new StringBuilder("    {\n");
-        incrLevel();
-        ret.append("      a_.startMap("+fname+",\""+tag+"\");\n");
-        ret.append("      java.util.Set "+getId("es")+" = "+fname+".entrySet();\n");
-        ret.append("      for(java.util.Iterator "+getId("midx")+" = "+getId("es")+".iterator(); "+getId("midx")+".hasNext(); ) {\n");
-        ret.append("        java.util.Map.Entry "+getId("me")+" = (java.util.Map.Entry) "+getId("midx")+".next();\n");
-        ret.append("        "+mKey.getJavaWrapperType()+" "+getId("k")+" = ("+mKey.getJavaWrapperType()+") "+getId("me")+".getKey();\n");
-        ret.append("        "+mValue.getJavaWrapperType()+" "+getId("v")+" = ("+mValue.getJavaWrapperType()+") "+getId("me")+".getValue();\n");
-        ret.append(mKey.genJavaWriteWrapper(getId("k"),getId("k")));
-        ret.append(mValue.genJavaWriteWrapper(getId("v"),getId("v")));
-        ret.append("      }\n");
-        ret.append("      a_.endMap("+fname+",\""+tag+"\");\n");
-        ret.append("    }\n");
-        decrLevel();
-        return ret.toString();
-    }
-    
-    public String genJavaWriteMethod(String fname, String tag) {
-        return genJavaWriteWrapper(fname, tag);
-    }
-
-    public String genCsharpWriteWrapper(String fname, int tag) {
-        StringBuilder ret = new StringBuilder("    {\n");
-        incrLevel();
-        ret.append("      a_.StartMap("+fname+",\""+tag+"\");\n");
-        ret.append("      java.util.Set "+getId("es")+" = "+fname+".entrySet();\n");
-        ret.append("      for(java.util.Iterator "+getId("midx")+" = "+getId("es")+".iterator(); "+getId("midx")+".hasNext(); ) {\n");
-        ret.append("        java.util.Map.Entry "+getId("me")+" = (java.util.Map.Entry) "+getId("midx")+".next();\n");
-        ret.append("        "+mKey.getCsharpWrapperType()+" "+getId("k")+" = ("+mKey.getCsharpWrapperType()+") "+getId("me")+".getKey();\n");
-        ret.append("        "+mValue.getCsharpWrapperType()+" "+getId("v")+" = ("+mValue.getCsharpWrapperType()+") "+getId("me")+".getValue();\n");
-        ret.append(mKey.genCsharpWriteWrapper(getId("k"),getId("k")));
-        ret.append(mValue.genCsharpWriteWrapper(getId("v"),getId("v")));
-        ret.append("      }\n");
-        ret.append("      a_.EndMap("+fname+",\""+tag+"\");\n");
-        ret.append("    }\n");
-        decrLevel();
-        return ret.toString();
-    }
-
-    String genCsharpWriteMethod(String fname, int tag) {
-        return genCsharpWriteWrapper(fname, tag);
-    }
-
-    public String genCsharpReadWrapper(String fname, int tag, boolean decl) {
-        StringBuilder ret = new StringBuilder("");
-        if (decl) {
-            ret.append("    System.Collections.SortedDictionary<string,string> "+capitalize(fname)+";\n");
-        }
-        ret.append("    {\n");
-        incrLevel();
-        ret.append("      Org.Apache.Jute.IIndex "+getId("midx")+" = a_.StartMap(\""+tag+"\");\n");
-        ret.append("      "+fname+"= new System.Collections.SortedDictionary<string,string>();\n");
-        ret.append("      for (; !"+getId("midx")+".done(); "+getId("midx")+".incr()) {\n");
-        ret.append(mKey.genCsharpReadWrapper(getId("k"),getId("k"),true));
-        ret.append(mValue.genCsharpReadWrapper(getId("v"),getId("v"),true));
-        ret.append("        "+fname+".Add("+getId("k")+","+getId("v")+");\n");
-        ret.append("      }\n");
-        ret.append("    a_.EndMap(\""+tag+"\");\n");
-        decrLevel();
-        ret.append("    }\n");
-        return ret.toString();
-    }
-
-
-
-    String genCsharpReadMethod(String fname, int tag) {
-        return genCsharpReadWrapper(fname, tag, false);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JRecord.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JRecord.java b/src/java/main/org/apache/jute/compiler/JRecord.java
deleted file mode 100644
index 7322f21..0000000
--- a/src/java/main/org/apache/jute/compiler/JRecord.java
+++ /dev/null
@@ -1,776 +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.jute.compiler;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-/**
- *
- */
-public class JRecord extends JCompType {
-
-    private String mFQName;
-    private String mName;
-    private String mModule;
-    private ArrayList<JField> mFields;
-
-    /**
-     * Creates a new instance of JRecord
-     */
-    public JRecord(String name, ArrayList<JField> flist) {
-        super("struct " + name.substring(name.lastIndexOf('.')+1),
-                name.replaceAll("\\.","::"), getCsharpFQName(name), name, "Record", name, getCsharpFQName("IRecord"));
-        mFQName = name;
-        int idx = name.lastIndexOf('.');
-        mName = name.substring(idx+1);
-        mModule = name.substring(0, idx);
-        mFields = flist;
-    }
-
-    public String getName() {
-        return mName;
-    }
-
-    public String getCsharpName() {
-        return "Id".equals(mName) ? "ZKId" : mName;
-    }
-
-    public String getJavaFQName() {
-        return mFQName;
-    }
-
-    public String getCppFQName() {
-        return mFQName.replaceAll("\\.", "::");
-    }
-
-    public String getJavaPackage() {
-        return mModule;
-    }
-
-    public String getCppNameSpace() {
-        return mModule.replaceAll("\\.", "::");
-    }
-
-    public String getCsharpNameSpace() {
-        String[] parts = mModule.split("\\.");
-        StringBuffer namespace = new StringBuffer();
-        for (int i = 0; i < parts.length; i++) {
-            String capitalized = parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1).toLowerCase();
-            namespace.append(capitalized);
-            if (i != parts.length - 1) namespace.append(".");
-        }
-        return namespace.toString();
-    }
-
-    public ArrayList<JField> getFields() {
-        return mFields;
-    }
-
-    public String getSignature() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("L").append(mName).append("(");
-        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
-            String s = i.next().getSignature();
-            sb.append(s);
-        }
-        sb.append(")");
-        return sb.toString();
-    }
-
-    public String genCppDecl(String fname) {
-        return "  "+ getCppNameSpace() + "::" + mName+" m"+fname+";\n";
-    }
-
-    public String genJavaReadMethod(String fname, String tag) {
-        return genJavaReadWrapper(fname, tag, false);
-    }
-
-    public String genJavaReadWrapper(String fname, String tag, boolean decl) {
-        StringBuilder ret = new StringBuilder("");
-        if (decl) {
-            ret.append("    "+getJavaFQName()+" "+fname+";\n");
-        }
-        ret.append("    "+fname+"= new "+getJavaFQName()+"();\n");
-        ret.append("    a_.readRecord("+fname+",\""+tag+"\");\n");
-        return ret.toString();
-    }
-
-    public String genJavaWriteWrapper(String fname, String tag) {
-        return "    a_.writeRecord("+fname+",\""+tag+"\");\n";
-    }
-
-    String genCsharpReadMethod(String fname, String tag) {
-        //return "    "+capitalize(fname)+"=a_.Read"+mMethodSuffix+"(" + capitalize(fname) + ",\""+tag+"\");\n";
-        return genCsharpReadWrapper(capitalize(fname), tag, false);
-    }
-
-    public String genCsharpReadWrapper(String fname, String tag, boolean decl) {
-        StringBuilder ret = new StringBuilder("");
-        if (decl) {
-            ret.append("    "+getCsharpFQName(mFQName)+" "+fname+";\n");
-        }
-        ret.append("    "+fname+"= new "+getCsharpFQName(mFQName)+"();\n");
-        ret.append("    a_.ReadRecord("+fname+",\""+tag+"\");\n");
-        return ret.toString();
-    }
-
-    public String genCsharpWriteWrapper(String fname, String tag) {
-        return "    a_.WriteRecord("+fname+",\""+tag+"\");\n";
-    }
-
-    static HashMap<String, String> vectorStructs = new HashMap<String, String>();
-    public void genCCode(FileWriter h, FileWriter c) throws IOException {
-        for (JField f : mFields) {
-            if (f.getType() instanceof JVector) {
-                JVector jv = (JVector)f.getType();
-                JType jvType = jv.getElementType();
-                String struct_name = JVector.extractVectorName(jvType);
-                if (vectorStructs.get(struct_name) == null) {
-                    vectorStructs.put(struct_name, struct_name);
-                    h.write("struct " + struct_name + " {\n    int32_t count;\n" + jv.getElementType().genCDecl("*data") + "\n};\n");
-                    h.write("int serialize_" + struct_name + "(struct oarchive *out, const char *tag, struct " + struct_name + " *v);\n");
-                    h.write("int deserialize_" + struct_name + "(struct iarchive *in, const char *tag, struct " + struct_name + " *v);\n");
-                    h.write("int allocate_" + struct_name + "(struct " + struct_name + " *v, int32_t len);\n");
-                    h.write("int deallocate_" + struct_name + "(struct " + struct_name + " *v);\n");
-                    c.write("int allocate_" + struct_name + "(struct " + struct_name + " *v, int32_t len) {\n");
-                    c.write("    if (!len) {\n");
-                    c.write("        v->count = 0;\n");
-                    c.write("        v->data = 0;\n");
-                    c.write("    } else {\n");
-                    c.write("        v->count = len;\n");
-                    c.write("        v->data = calloc(sizeof(*v->data), len);\n");
-                    c.write("    }\n");
-                    c.write("    return 0;\n");
-                    c.write("}\n");
-                    c.write("int deallocate_" + struct_name + "(struct " + struct_name + " *v) {\n");
-                    c.write("    if (v->data) {\n");
-                    c.write("        int32_t i;\n");
-                    c.write("        for(i=0;i<v->count; i++) {\n");
-                    c.write("            deallocate_"+JRecord.extractMethodSuffix(jvType)+"(&v->data[i]);\n");
-                    c.write("        }\n");
-                    c.write("        free(v->data);\n");
-                    c.write("        v->data = 0;\n");
-                    c.write("    }\n");
-                    c.write("    return 0;\n");
-                    c.write("}\n");
-                    c.write("int serialize_" + struct_name + "(struct oarchive *out, const char *tag, struct " + struct_name + " *v)\n");
-                    c.write("{\n");
-                    c.write("    int32_t count = v->count;\n");
-                    c.write("    int rc = 0;\n");
-                    c.write("    int32_t i;\n");
-                    c.write("    rc = out->start_vector(out, tag, &count);\n");
-                    c.write("    for(i=0;i<v->count;i++) {\n");
-                    genSerialize(c, jvType, "data", "data[i]");
-                    c.write("    }\n");
-                    c.write("    rc = rc ? rc : out->end_vector(out, tag);\n");
-                    c.write("    return rc;\n");
-                    c.write("}\n");
-                    c.write("int deserialize_" + struct_name + "(struct iarchive *in, const char *tag, struct " + struct_name + " *v)\n");
-                    c.write("{\n");
-                    c.write("    int rc = 0;\n");
-                    c.write("    int32_t i;\n");
-                    c.write("    rc = in->start_vector(in, tag, &v->count);\n");
-                    c.write("    v->data = calloc(v->count, sizeof(*v->data));\n");
-                    c.write("    for(i=0;i<v->count;i++) {\n");
-                    genDeserialize(c, jvType, "value", "data[i]");
-                    c.write("    }\n");
-                    c.write("    rc = in->end_vector(in, tag);\n");
-                    c.write("    return rc;\n");
-                    c.write("}\n");
-
-                }
-            }
-        }
-        String rec_name = getName();
-        h.write("struct " + rec_name + " {\n");
-        for (JField f : mFields) {
-            h.write(f.genCDecl());
-        }
-        h.write("};\n");
-        h.write("int serialize_" + rec_name + "(struct oarchive *out, const char *tag, struct " + rec_name + " *v);\n");
-        h.write("int deserialize_" + rec_name + "(struct iarchive *in, const char *tag, struct " + rec_name + "*v);\n");
-        h.write("void deallocate_" + rec_name + "(struct " + rec_name + "*);\n");
-        c.write("int serialize_" + rec_name + "(struct oarchive *out, const char *tag, struct " + rec_name + " *v)");
-        c.write("{\n");
-        c.write("    int rc;\n");
-        c.write("    rc = out->start_record(out, tag);\n");
-        for(JField f : mFields) {
-            genSerialize(c, f.getType(), f.getTag(), f.getName());
-        }
-        c.write("    rc = rc ? rc : out->end_record(out, tag);\n");
-        c.write("    return rc;\n");
-        c.write("}\n");
-        c.write("int deserialize_" + rec_name + "(struct iarchive *in, const char *tag, struct " + rec_name + "*v)");
-        c.write("{\n");
-        c.write("    int rc;\n");
-        c.write("    rc = in->start_record(in, tag);\n");
-        for(JField f : mFields) {
-            genDeserialize(c, f.getType(), f.getTag(), f.getName());
-        }
-        c.write("    rc = rc ? rc : in->end_record(in, tag);\n");
-        c.write("    return rc;\n");
-        c.write("}\n");
-        c.write("void deallocate_" + rec_name + "(struct " + rec_name + "*v)");
-        c.write("{\n");
-        for(JField f : mFields) {
-            if (f.getType() instanceof JRecord) {
-                c.write("    deallocate_" + extractStructName(f.getType()) + "(&v->" + f.getName() + ");\n");
-            } else if (f.getType() instanceof JVector) {
-                JVector vt = (JVector)f.getType();
-                c.write("    deallocate_" + JVector.extractVectorName(vt.getElementType())+ "(&v->"+f.getName()+");\n");
-            } else if (f.getType() instanceof JCompType) {
-                c.write("    deallocate_" + extractMethodSuffix(f.getType()) + "(&v->"+f.getName()+");\n");
-            }
-        }
-        c.write("}\n");
-    }
-
-    private void genSerialize(FileWriter c, JType type, String tag, String name) throws IOException {
-        if (type instanceof JRecord) {
-            c.write("    rc = rc ? rc : serialize_" + extractStructName(type) + "(out, \"" + tag + "\", &v->" + name + ");\n");
-        } else if (type instanceof JVector) {
-            c.write("    rc = rc ? rc : serialize_" + JVector.extractVectorName(((JVector)type).getElementType()) + "(out, \"" + tag + "\", &v->" + name + ");\n");
-        } else {
-            c.write("    rc = rc ? rc : out->serialize_" + extractMethodSuffix(type) + "(out, \"" + tag + "\", &v->" + name + ");\n");
-        }
-    }
-
-    private void genDeserialize(FileWriter c, JType type, String tag, String name) throws IOException {
-        if (type instanceof JRecord) {
-            c.write("    rc = rc ? rc : deserialize_" + extractStructName(type) + "(in, \"" + tag + "\", &v->" + name + ");\n");
-        } else if (type instanceof JVector) {
-            c.write("    rc = rc ? rc : deserialize_" + JVector.extractVectorName(((JVector)type).getElementType()) + "(in, \"" + tag + "\", &v->" + name + ");\n");
-        } else {
-            c.write("    rc = rc ? rc : in->deserialize_" + extractMethodSuffix(type) + "(in, \"" + tag + "\", &v->" + name + ");\n");
-        }
-    }
-
-    static String extractMethodSuffix(JType t) {
-        if (t instanceof JRecord) {
-            return extractStructName(t);
-        }
-        return t.getMethodSuffix();
-    }
-
-    static private String extractStructName(JType t) {
-        String type = t.getCType();
-        if (!type.startsWith("struct ")) return type;
-        return type.substring("struct ".length());
-    }
-
-    public void genCppCode(FileWriter hh, FileWriter cc)
-        throws IOException {
-        String[] ns = getCppNameSpace().split("::");
-        for (int i = 0; i < ns.length; i++) {
-            hh.write("namespace "+ns[i]+" {\n");
-        }
-
-        hh.write("class "+getName()+" : public ::hadoop::Record {\n");
-        hh.write("private:\n");
-
-        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
-            JField jf = i.next();
-            hh.write(jf.genCppDecl());
-        }
-        hh.write("  mutable std::bitset<"+mFields.size()+"> bs_;\n");
-        hh.write("public:\n");
-        hh.write("  virtual void serialize(::hadoop::OArchive& a_, const char* tag) const;\n");
-        hh.write("  virtual void deserialize(::hadoop::IArchive& a_, const char* tag);\n");
-        hh.write("  virtual const ::std::string& type() const;\n");
-        hh.write("  virtual const ::std::string& signature() const;\n");
-        hh.write("  virtual bool validate() const;\n");
-        hh.write("  virtual bool operator<(const "+getName()+"& peer_) const;\n");
-        hh.write("  virtual bool operator==(const "+getName()+"& peer_) const;\n");
-        hh.write("  virtual ~"+getName()+"() {};\n");
-        int fIdx = 0;
-        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = i.next();
-            hh.write(jf.genCppGetSet(fIdx));
-        }
-        hh.write("}; // end record "+getName()+"\n");
-        for (int i=ns.length-1; i>=0; i--) {
-            hh.write("} // end namespace "+ns[i]+"\n");
-        }
-        cc.write("void "+getCppFQName()+"::serialize(::hadoop::OArchive& a_, const char* tag) const {\n");
-        cc.write("  if (!validate()) throw new ::hadoop::IOException(\"All fields not set.\");\n");
-        cc.write("  a_.startRecord(*this,tag);\n");
-        fIdx = 0;
-        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = i.next();
-            String name = jf.getName();
-            if (jf.getType() instanceof JBuffer) {
-                cc.write("  a_.serialize(m"+name+",m"+name+".length(),\""+jf.getTag()+"\");\n");
-            } else {
-                cc.write("  a_.serialize(m"+name+",\""+jf.getTag()+"\");\n");
-            }
-            cc.write("  bs_.reset("+fIdx+");\n");
-        }
-        cc.write("  a_.endRecord(*this,tag);\n");
-        cc.write("  return;\n");
-        cc.write("}\n");
-
-        cc.write("void "+getCppFQName()+"::deserialize(::hadoop::IArchive& a_, const char* tag) {\n");
-        cc.write("  a_.startRecord(*this,tag);\n");
-        fIdx = 0;
-        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = i.next();
-            String name = jf.getName();
-            if (jf.getType() instanceof JBuffer) {
-                cc.write("  { size_t len=0; a_.deserialize(m"+name+",len,\""+jf.getTag()+"\");}\n");
-            } else {
-                cc.write("  a_.deserialize(m"+name+",\""+jf.getTag()+"\");\n");
-            }
-            cc.write("  bs_.set("+fIdx+");\n");
-        }
-        cc.write("  a_.endRecord(*this,tag);\n");
-        cc.write("  return;\n");
-        cc.write("}\n");
-
-        cc.write("bool "+getCppFQName()+"::validate() const {\n");
-        cc.write("  if (bs_.size() != bs_.count()) return false;\n");
-        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
-            JType type = jf.getType();
-            if (type instanceof JRecord) {
-                cc.write("  if (!m"+jf.getName()+".validate()) return false;\n");
-            }
-        }
-        cc.write("  return true;\n");
-        cc.write("}\n");
-
-        cc.write("bool "+getCppFQName()+"::operator< (const "+getCppFQName()+"& peer_) const {\n");
-        cc.write("  return (1\n");
-        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
-            JField jf = i.next();
-            String name = jf.getName();
-            cc.write("    && (m"+name+" < peer_.m"+name+")\n");
-        }
-        cc.write("  );\n");
-        cc.write("}\n");
-
-        cc.write("bool "+getCppFQName()+"::operator== (const "+getCppFQName()+"& peer_) const {\n");
-        cc.write("  return (1\n");
-        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
-            JField jf = i.next();
-            String name = jf.getName();
-            cc.write("    && (m"+name+" == peer_.m"+name+")\n");
-        }
-        cc.write("  );\n");
-        cc.write("}\n");
-
-        cc.write("const ::std::string&"+getCppFQName()+"::type() const {\n");
-        cc.write("  static const ::std::string type_(\""+mName+"\");\n");
-        cc.write("  return type_;\n");
-        cc.write("}\n");
-
-        cc.write("const ::std::string&"+getCppFQName()+"::signature() const {\n");
-        cc.write("  static const ::std::string sig_(\""+getSignature()+"\");\n");
-        cc.write("  return sig_;\n");
-        cc.write("}\n");
-
-    }
-
-    public void genJavaCode(File outputDirectory) throws IOException {
-        String pkg = getJavaPackage();
-        String pkgpath = pkg.replaceAll("\\.", "/");
-        File pkgdir = new File(outputDirectory, pkgpath);
-        if (!pkgdir.exists()) {
-            // create the pkg directory
-            if (!pkgdir.mkdirs()) {
-                throw new IOException("Cannnot create directory: " + pkgpath);
-            }
-        } else if (!pkgdir.isDirectory()) {
-            throw new IOException(pkgpath + " is not a directory.");
-        }
-        File jfile = new File(pkgdir, getName()+".java");
-        FileWriter jj = null;
-        try{
-            jj = new FileWriter(jfile);
-            jj.write("// File generated by hadoop record compiler. Do not edit.\n");
-            jj.write("/**\n");
-            jj.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
-            jj.write("* or more contributor license agreements.  See the NOTICE file\n");
-            jj.write("* distributed with this work for additional information\n");
-            jj.write("* regarding copyright ownership.  The ASF licenses this file\n");
-            jj.write("* to you under the Apache License, Version 2.0 (the\n");
-            jj.write("* \"License\"); you may not use this file except in compliance\n");
-            jj.write("* with the License.  You may obtain a copy of the License at\n");
-            jj.write("*\n");
-            jj.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
-            jj.write("*\n");
-            jj.write("* Unless required by applicable law or agreed to in writing, software\n");
-            jj.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
-            jj.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
-            jj.write("* See the License for the specific language governing permissions and\n");
-            jj.write("* limitations under the License.\n");
-            jj.write("*/\n");
-            jj.write("\n");
-            jj.write("package "+getJavaPackage()+";\n\n");
-            jj.write("import org.apache.jute.*;\n");
-            jj.write("import org.apache.yetus.audience.InterfaceAudience;\n");
-            jj.write("@InterfaceAudience.Public\n");
-            jj.write("public class "+getName()+" implements Record {\n");
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
-                JField jf = i.next();
-                jj.write(jf.genJavaDecl());
-            }
-            jj.write("  public "+getName()+"() {\n");
-            jj.write("  }\n");
-
-            jj.write("  public "+getName()+"(\n");
-            int fIdx = 0;
-            int fLen = mFields.size();
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                jj.write(jf.genJavaConstructorParam(jf.getName()));
-                jj.write((fLen-1 == fIdx)?"":",\n");
-            }
-            jj.write(") {\n");
-            fIdx = 0;
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                jj.write(jf.genJavaConstructorSet(jf.getName()));
-            }
-            jj.write("  }\n");
-            fIdx = 0;
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                jj.write(jf.genJavaGetSet(fIdx));
-            }
-            jj.write("  public void serialize(OutputArchive a_, String tag) throws java.io.IOException {\n");
-            jj.write("    a_.startRecord(this,tag);\n");
-            fIdx = 0;
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                jj.write(jf.genJavaWriteMethodName());
-            }
-            jj.write("    a_.endRecord(this,tag);\n");
-            jj.write("  }\n");
-
-            jj.write("  public void deserialize(InputArchive a_, String tag) throws java.io.IOException {\n");
-            jj.write("    a_.startRecord(tag);\n");
-            fIdx = 0;
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                jj.write(jf.genJavaReadMethodName());
-            }
-            jj.write("    a_.endRecord(tag);\n");
-            jj.write("}\n");
-
-            jj.write("  public String toString() {\n");
-            jj.write("    try {\n");
-            jj.write("      java.io.ByteArrayOutputStream s =\n");
-            jj.write("        new java.io.ByteArrayOutputStream();\n");
-            jj.write("      CsvOutputArchive a_ = \n");
-            jj.write("        new CsvOutputArchive(s);\n");
-            jj.write("      a_.startRecord(this,\"\");\n");
-            fIdx = 0;
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                jj.write(jf.genJavaWriteMethodName());
-            }
-            jj.write("      a_.endRecord(this,\"\");\n");
-            jj.write("      return new String(s.toByteArray(), \"UTF-8\");\n");
-            jj.write("    } catch (Throwable ex) {\n");
-            jj.write("      ex.printStackTrace();\n");
-            jj.write("    }\n");
-            jj.write("    return \"ERROR\";\n");
-            jj.write("  }\n");
-
-            jj.write("  public void write(java.io.DataOutput out) throws java.io.IOException {\n");
-            jj.write("    BinaryOutputArchive archive = new BinaryOutputArchive(out);\n");
-            jj.write("    serialize(archive, \"\");\n");
-            jj.write("  }\n");
-
-            jj.write("  public void readFields(java.io.DataInput in) throws java.io.IOException {\n");
-            jj.write("    BinaryInputArchive archive = new BinaryInputArchive(in);\n");
-            jj.write("    deserialize(archive, \"\");\n");
-            jj.write("  }\n");
-
-            jj.write("  public int compareTo (Object peer_) throws ClassCastException {\n");
-            boolean unimplemented = false;
-            for (JField f : mFields) {
-                if ((f.getType() instanceof JMap)
-                        || (f.getType() instanceof JVector))
-                {
-                    unimplemented = true;
-                }
-            }
-            if (unimplemented) {
-                jj.write("    throw new UnsupportedOperationException(\"comparing "
-                        + getName() + " is unimplemented\");\n");
-            } else {
-                jj.write("    if (!(peer_ instanceof "+getName()+")) {\n");
-                jj.write("      throw new ClassCastException(\"Comparing different types of records.\");\n");
-                jj.write("    }\n");
-                jj.write("    "+getName()+" peer = ("+getName()+") peer_;\n");
-                jj.write("    int ret = 0;\n");
-                for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                    JField jf = i.next();
-                    jj.write(jf.genJavaCompareTo());
-                    jj.write("    if (ret != 0) return ret;\n");
-                }
-                jj.write("     return ret;\n");
-            }
-            jj.write("  }\n");
-
-            jj.write("  public boolean equals(Object peer_) {\n");
-            jj.write("    if (!(peer_ instanceof "+getName()+")) {\n");
-            jj.write("      return false;\n");
-            jj.write("    }\n");
-            jj.write("    if (peer_ == this) {\n");
-            jj.write("      return true;\n");
-            jj.write("    }\n");
-            jj.write("    "+getName()+" peer = ("+getName()+") peer_;\n");
-            jj.write("    boolean ret = false;\n");
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                jj.write(jf.genJavaEquals());
-                jj.write("    if (!ret) return ret;\n");
-            }
-            jj.write("     return ret;\n");
-            jj.write("  }\n");
-
-            jj.write("  public int hashCode() {\n");
-            jj.write("    int result = 17;\n");
-            jj.write("    int ret;\n");
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                jj.write(jf.genJavaHashCode());
-                jj.write("    result = 37*result + ret;\n");
-            }
-            jj.write("    return result;\n");
-            jj.write("  }\n");
-            jj.write("  public static String signature() {\n");
-            jj.write("    return \""+getSignature()+"\";\n");
-            jj.write("  }\n");
-
-            jj.write("}\n");
-        } finally {
-            if (jj != null) {
-                jj.close();
-            }
-        }
-
-    }
-
-    public void genCsharpCode(File outputDirectory) throws IOException {
-        if (!outputDirectory.exists()) {
-            // create the pkg directory
-            if (!outputDirectory.mkdirs()) {
-                throw new IOException("Cannnot create directory: " + outputDirectory);
-            }
-        } else if (!outputDirectory.isDirectory()) {
-            throw new IOException(outputDirectory + " is not a directory.");
-        }
-        File csharpFile = new File(outputDirectory, getName()+".cs");
-        FileWriter cs = null;
-
-        try {
-            cs = new FileWriter(csharpFile);
-
-            cs.write("// File generated by hadoop record compiler. Do not edit.\n");
-            cs.write("/**\n");
-            cs.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
-            cs.write("* or more contributor license agreements.  See the NOTICE file\n");
-            cs.write("* distributed with this work for additional information\n");
-            cs.write("* regarding copyright ownership.  The ASF licenses this file\n");
-            cs.write("* to you under the Apache License, Version 2.0 (the\n");
-            cs.write("* \"License\"); you may not use this file except in compliance\n");
-            cs.write("* with the License.  You may obtain a copy of the License at\n");
-            cs.write("*\n");
-            cs.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
-            cs.write("*\n");
-            cs.write("* Unless required by applicable law or agreed to in writing, software\n");
-            cs.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
-            cs.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
-            cs.write("* See the License for the specific language governing permissions and\n");
-            cs.write("* limitations under the License.\n");
-            cs.write("*/\n");
-            cs.write("\n");
-            cs.write("using System;\n");
-            cs.write("using Org.Apache.Jute;\n");
-            cs.write("\n");
-            cs.write("namespace "+getCsharpNameSpace()+"\n");
-            cs.write("{\n");
-
-            String className = getCsharpName();
-            cs.write("public class "+className+" : IRecord, IComparable \n");
-            cs.write("{\n");
-            cs.write("  public "+ className +"() {\n");
-            cs.write("  }\n");
-
-            cs.write("  public "+className+"(\n");
-            int fIdx = 0;
-            int fLen = mFields.size();
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                cs.write(jf.genCsharpConstructorParam(jf.getCsharpName()));
-                cs.write((fLen-1 == fIdx)?"":",\n");
-            }
-            cs.write(") {\n");
-            fIdx = 0;
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                cs.write(jf.genCsharpConstructorSet(jf.getCsharpName()));
-            }
-            cs.write("  }\n");
-            fIdx = 0;
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                cs.write(jf.genCsharpGetSet(fIdx));
-                cs.write("\n");
-            }
-            cs.write("  public void Serialize(IOutputArchive a_, String tag) {\n");
-            cs.write("    a_.StartRecord(this,tag);\n");
-            fIdx = 0;
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                cs.write(jf.genCsharpWriteMethodName());
-            }
-            cs.write("    a_.EndRecord(this,tag);\n");
-            cs.write("  }\n");
-
-            cs.write("  public void Deserialize(IInputArchive a_, String tag) {\n");
-            cs.write("    a_.StartRecord(tag);\n");
-            fIdx = 0;
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                cs.write(jf.genCsharpReadMethodName());
-            }
-            cs.write("    a_.EndRecord(tag);\n");
-            cs.write("}\n");
-
-            cs.write("  public override String ToString() {\n");
-            cs.write("    try {\n");
-            cs.write("      System.IO.MemoryStream ms = new System.IO.MemoryStream();\n");
-            cs.write("      MiscUtil.IO.EndianBinaryWriter writer =\n");
-            cs.write("        new MiscUtil.IO.EndianBinaryWriter(MiscUtil.Conversion.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8);\n");
-            cs.write("      BinaryOutputArchive a_ = \n");
-            cs.write("        new BinaryOutputArchive(writer);\n");
-            cs.write("      a_.StartRecord(this,\"\");\n");
-            fIdx = 0;
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                cs.write(jf.genCsharpWriteMethodName());
-            }
-            cs.write("      a_.EndRecord(this,\"\");\n");
-            cs.write("      ms.Position = 0;\n");
-            cs.write("      return System.Text.Encoding.UTF8.GetString(ms.ToArray());\n");
-            cs.write("    } catch (Exception ex) {\n");
-            cs.write("      Console.WriteLine(ex.StackTrace);\n");
-            cs.write("    }\n");
-            cs.write("    return \"ERROR\";\n");
-            cs.write("  }\n");
-
-            cs.write("  public void Write(MiscUtil.IO.EndianBinaryWriter writer) {\n");
-            cs.write("    BinaryOutputArchive archive = new BinaryOutputArchive(writer);\n");
-            cs.write("    Serialize(archive, \"\");\n");
-            cs.write("  }\n");
-
-            cs.write("  public void ReadFields(MiscUtil.IO.EndianBinaryReader reader) {\n");
-            cs.write("    BinaryInputArchive archive = new BinaryInputArchive(reader);\n");
-            cs.write("    Deserialize(archive, \"\");\n");
-            cs.write("  }\n");
-
-            cs.write("  public int CompareTo (object peer_) {\n");
-            boolean unimplemented = false;
-            for (JField f : mFields) {
-                if ((f.getType() instanceof JMap)
-                        || (f.getType() instanceof JVector))
-                {
-                    unimplemented = true;
-                }
-            }
-            if (unimplemented) {
-                cs.write("    throw new InvalidOperationException(\"comparing "
-                        + getCsharpName() + " is unimplemented\");\n");
-            } else {
-                cs.write("    if (!(peer_ is "+getCsharpName()+")) {\n");
-                cs.write("      throw new InvalidOperationException(\"Comparing different types of records.\");\n");
-                cs.write("    }\n");
-                cs.write("    "+getCsharpName()+" peer = ("+getCsharpName()+") peer_;\n");
-                cs.write("    int ret = 0;\n");
-                for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                    JField jf = i.next();
-                    cs.write(jf.genCsharpCompareTo());
-                    cs.write("    if (ret != 0) return ret;\n");
-                }
-                cs.write("     return ret;\n");
-            }
-            cs.write("  }\n");
-
-            cs.write("  public override bool Equals(object peer_) {\n");
-            cs.write("    if (!(peer_ is "+getCsharpName()+")) {\n");
-            cs.write("      return false;\n");
-            cs.write("    }\n");
-            cs.write("    if (peer_ == this) {\n");
-            cs.write("      return true;\n");
-            cs.write("    }\n");
-            cs.write("    bool ret = false;\n");
-            cs.write("    " + getCsharpName() + " peer = (" + getCsharpName() + ")peer_;\n");
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                cs.write(jf.genCsharpEquals());
-                cs.write("    if (!ret) return ret;\n");
-            }
-            cs.write("     return ret;\n");
-            cs.write("  }\n");
-
-            cs.write("  public override int GetHashCode() {\n");
-            cs.write("    int result = 17;\n");
-            cs.write("    int ret;\n");
-            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
-                JField jf = i.next();
-                cs.write(jf.genCsharpHashCode());
-                cs.write("    result = 37*result + ret;\n");
-            }
-            cs.write("    return result;\n");
-            cs.write("  }\n");
-            cs.write("  public static string Signature() {\n");
-            cs.write("    return \""+getSignature()+"\";\n");
-            cs.write("  }\n");
-
-            cs.write("}\n");
-            cs.write("}\n");
-        } finally {
-            if (cs != null) {
-                cs.close();
-            }
-        }
-    }
-
-    public static String getCsharpFQName(String name) {
-        String[] packages = name.split("\\.");
-        StringBuffer fQName = new StringBuffer();
-        for (int i = 0; i < packages.length; i++) {
-            String pack = packages[i];
-            pack = capitalize(pack);
-            pack = "Id".equals(pack) ? "ZKId" : pack;
-            fQName.append(capitalize(pack));
-            if (i != packages.length - 1) fQName.append(".");
-        }
-        return fQName.toString();
-    }    
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JString.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JString.java b/src/java/main/org/apache/jute/compiler/JString.java
deleted file mode 100644
index 7f246c3..0000000
--- a/src/java/main/org/apache/jute/compiler/JString.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.jute.compiler;
-
-/**
- *
- */
-public class JString extends JCompType {
-    
-    /** Creates a new instance of JString */
-    public JString() {
-        super("char *", " ::std::string", "string", "String", "String", "String", "string");
-    }
-    
-    public String getSignature() {
-        return "s";
-    }
-    
-    public String genJavaReadWrapper(String fname, String tag, boolean decl) {
-        String ret = "";
-        if (decl) {
-            ret = "    String "+fname+";\n";
-        }
-        return ret + "        "+fname+"=a_.readString(\""+tag+"\");\n";
-    }
-    
-    public String genJavaWriteWrapper(String fname, String tag) {
-        return "        a_.writeString("+fname+",\""+tag+"\");\n";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/src/java/main/org/apache/jute/compiler/JType.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/jute/compiler/JType.java b/src/java/main/org/apache/jute/compiler/JType.java
deleted file mode 100644
index ee1b9c0..0000000
--- a/src/java/main/org/apache/jute/compiler/JType.java
+++ /dev/null
@@ -1,204 +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.jute.compiler;
-
-/**
- * Abstract Base class for all types supported by Hadoop Record I/O.
- * 
- */
-abstract public class JType {
-    
-	private String mCName;
-    private String mCppName;
-    private String mCsharpName;
-    private String mJavaName;
-    protected String mMethodSuffix;
-    private String mWrapper;
-    private String mSharpWrapper;
-    private String mUnwrapMethod;
-
-    /**
-     * Creates a new instance of JType
-     */
-    JType(String cname, String cppname, String csharpName, String javaname, String suffix, String wrapper, String csharpWrapper, String unwrap) {
-    	mCName = cname;
-        mCppName = cppname;
-        mCsharpName = "Id".equals(csharpName) ? "ZKId" : csharpName;
-        mJavaName = javaname;
-        mMethodSuffix = suffix;
-        mWrapper = wrapper;
-        mSharpWrapper = csharpWrapper;
-        mUnwrapMethod = unwrap;
-    }
-    
-    abstract String getSignature();
-    
-    String genCppDecl(String fname) {
-        return "  "+mCppName+" m"+fname+";\n"; 
-    }
-    
-	String genCDecl(String name) {
-		return "    " + mCName + " "+name+";\n"; 
-	}
-
-    public String genCsharpDecl(String name) {
-        return "  private "+mCsharpName+" " +name+";\n";
-    }
-
-    String genJavaDecl (String fname) {
-        return "  private "+mJavaName+" " +fname+";\n";
-    }
-    
-    String genJavaConstructorParam (String fname) {
-        return "        "+mJavaName+" "+fname;
-    }
-    
-    String genCppGetSet(String fname, int fIdx) {
-        String getFunc = "  virtual "+mCppName+" get"+fname+"() const {\n";
-        getFunc += "    return m"+fname+";\n";
-        getFunc += "  }\n";
-        String setFunc = "  virtual void set"+fname+"("+mCppName+" m_) {\n";
-        setFunc += "    m"+fname+"=m_; bs_.set("+fIdx+");\n";
-        setFunc += "  }\n";
-        return getFunc+setFunc;
-    }
-
-    String genCsharpGetSet(String fname, int fIdx) {
-        String getFunc = "  public " + getCsharpType() + " " + capitalize(fname) + " { get; set; } ";
-        return getFunc;
-    }
-    
-    static String capitalize(String s) {
-        return s.substring(0,1).toUpperCase()+s.substring(1);
-    }
-    String genJavaGetSet(String fname, int fIdx) {
-        String getFunc = "  public "+mJavaName+" get"+capitalize(fname)+"() {\n";
-        getFunc += "    return "+fname+";\n";
-        getFunc += "  }\n";
-        String setFunc = "  public void set"+capitalize(fname)+"("+mJavaName+" m_) {\n";
-        setFunc += "    " + fname+"=m_;\n";
-        setFunc += "  }\n";
-        return getFunc+setFunc;
-    }
-    
-    String getCType() {
-    	return mCName;
-    }
-    String getCppType() {
-        return mCppName;
-    }
-    
-    String getCsharpType() {
-        return mCsharpName;
-    }
-
-    String getJavaType() {
-        return mJavaName;
-    }
-   
-    String getJavaWrapperType() {
-        return mWrapper;
-    }
-
-    String getCsharpWrapperType() {
-        return mSharpWrapper;
-    }
-    
-    String getMethodSuffix() {
-        return mMethodSuffix;
-    }
-    
-    String genJavaWriteMethod(String fname, String tag) {
-        return "    a_.write"+mMethodSuffix+"("+fname+",\""+tag+"\");\n";
-    }
-    
-    String genJavaReadMethod(String fname, String tag) {
-        return "    "+fname+"=a_.read"+mMethodSuffix+"(\""+tag+"\");\n";
-    }
-    
-    String genJavaReadWrapper(String fname, String tag, boolean decl) {
-        String ret = "";
-        if (decl) {
-            ret = "    "+mWrapper+" "+fname+";\n";
-        }
-        return ret + "    "+fname+"=new "+mWrapper+"(a_.read"+mMethodSuffix+"(\""+tag+"\"));\n";
-    }
-    
-    String genJavaWriteWrapper(String fname, String tag) {
-        return "        a_.write"+mMethodSuffix+"("+fname+"."+mUnwrapMethod+"(),\""+tag+"\");\n";
-    }
-    
-    String genJavaCompareTo(String fname) {
-        return "    ret = ("+fname+" == peer."+fname+")? 0 :(("+fname+"<peer."+fname+")?-1:1);\n";
-    }
-    
-    String genJavaEquals(String fname, String peer) {
-        return "    ret = ("+fname+"=="+peer+");\n";
-    }
-    
-    String genJavaHashCode(String fname) {
-        return "    ret = (int)"+fname+";\n";
-    }
-
-    String genJavaConstructorSet(String fname, String name) {
-        return "    this."+fname+"="+name+";\n";
-    }
-
-    String genCsharpWriteMethod(String fname, String tag) {
-        return "    a_.Write"+mMethodSuffix+"("+capitalize(fname)+",\""+tag+"\");\n";
-    }
-
-    String genCsharpReadMethod(String fname, String tag) {
-        return "    "+capitalize(fname)+"=a_.Read"+mMethodSuffix+"(\""+tag+"\");\n";
-    }
-
-    String genCsharpReadWrapper(String fname, String tag, boolean decl) {
-        String ret = "";
-        if (decl) {
-            ret = "    "+mWrapper+" "+fname+";\n";
-        }
-        return ret + "    "+fname+"=a_.Read"+mMethodSuffix+"(\""+tag+"\");\n";
-    }
-
-    String genCsharpWriteWrapper(String fname, String tag) {
-        if (mUnwrapMethod == null) return "        a_.Write"+mMethodSuffix+"("+fname+","+tag+");\n";
-        return "        a_.Write"+mMethodSuffix+"("+fname+"."+mUnwrapMethod+"(),\""+tag+"\");\n";
-    }
-
-    String genCsharpCompareTo(String name) {
-        return "    ret = ("+capitalize(name)+" == peer."+capitalize(name)+")? 0 :(("+capitalize(name)+"<peer."+capitalize(name)+")?-1:1);\n";
-    }
-
-    String genCsharpEquals(String name, String peer) {
-        String[] peerSplit = peer.split("\\.");
-        return "    ret = ("+capitalize(name)+"=="+peerSplit[0] + "." + capitalize(peerSplit[1]) + ");\n";
-    }
-
-    String genCsharpHashCode(String fname) {
-        return "    ret = (int)"+capitalize(fname)+";\n";
-    }
-
-    String genCsharpConstructorSet(String mName, String fname) {
-        return capitalize(fname)+"="+mName+";\n";
-    }
-
-    public String genCsharpConstructorParam(String fname) {
-        return "  "+mCsharpName+" " +fname+"\n";
-    }
-}


[3/8] zookeeper git commit: ZOOKEEPER-3080_3.4: MAVEN MIGRATION - Step 1.5 - move jute dir

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JRecord.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JRecord.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JRecord.java
new file mode 100644
index 0000000..7322f21
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JRecord.java
@@ -0,0 +1,776 @@
+/**
+ * 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.jute.compiler;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ *
+ */
+public class JRecord extends JCompType {
+
+    private String mFQName;
+    private String mName;
+    private String mModule;
+    private ArrayList<JField> mFields;
+
+    /**
+     * Creates a new instance of JRecord
+     */
+    public JRecord(String name, ArrayList<JField> flist) {
+        super("struct " + name.substring(name.lastIndexOf('.')+1),
+                name.replaceAll("\\.","::"), getCsharpFQName(name), name, "Record", name, getCsharpFQName("IRecord"));
+        mFQName = name;
+        int idx = name.lastIndexOf('.');
+        mName = name.substring(idx+1);
+        mModule = name.substring(0, idx);
+        mFields = flist;
+    }
+
+    public String getName() {
+        return mName;
+    }
+
+    public String getCsharpName() {
+        return "Id".equals(mName) ? "ZKId" : mName;
+    }
+
+    public String getJavaFQName() {
+        return mFQName;
+    }
+
+    public String getCppFQName() {
+        return mFQName.replaceAll("\\.", "::");
+    }
+
+    public String getJavaPackage() {
+        return mModule;
+    }
+
+    public String getCppNameSpace() {
+        return mModule.replaceAll("\\.", "::");
+    }
+
+    public String getCsharpNameSpace() {
+        String[] parts = mModule.split("\\.");
+        StringBuffer namespace = new StringBuffer();
+        for (int i = 0; i < parts.length; i++) {
+            String capitalized = parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1).toLowerCase();
+            namespace.append(capitalized);
+            if (i != parts.length - 1) namespace.append(".");
+        }
+        return namespace.toString();
+    }
+
+    public ArrayList<JField> getFields() {
+        return mFields;
+    }
+
+    public String getSignature() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("L").append(mName).append("(");
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
+            String s = i.next().getSignature();
+            sb.append(s);
+        }
+        sb.append(")");
+        return sb.toString();
+    }
+
+    public String genCppDecl(String fname) {
+        return "  "+ getCppNameSpace() + "::" + mName+" m"+fname+";\n";
+    }
+
+    public String genJavaReadMethod(String fname, String tag) {
+        return genJavaReadWrapper(fname, tag, false);
+    }
+
+    public String genJavaReadWrapper(String fname, String tag, boolean decl) {
+        StringBuilder ret = new StringBuilder("");
+        if (decl) {
+            ret.append("    "+getJavaFQName()+" "+fname+";\n");
+        }
+        ret.append("    "+fname+"= new "+getJavaFQName()+"();\n");
+        ret.append("    a_.readRecord("+fname+",\""+tag+"\");\n");
+        return ret.toString();
+    }
+
+    public String genJavaWriteWrapper(String fname, String tag) {
+        return "    a_.writeRecord("+fname+",\""+tag+"\");\n";
+    }
+
+    String genCsharpReadMethod(String fname, String tag) {
+        //return "    "+capitalize(fname)+"=a_.Read"+mMethodSuffix+"(" + capitalize(fname) + ",\""+tag+"\");\n";
+        return genCsharpReadWrapper(capitalize(fname), tag, false);
+    }
+
+    public String genCsharpReadWrapper(String fname, String tag, boolean decl) {
+        StringBuilder ret = new StringBuilder("");
+        if (decl) {
+            ret.append("    "+getCsharpFQName(mFQName)+" "+fname+";\n");
+        }
+        ret.append("    "+fname+"= new "+getCsharpFQName(mFQName)+"();\n");
+        ret.append("    a_.ReadRecord("+fname+",\""+tag+"\");\n");
+        return ret.toString();
+    }
+
+    public String genCsharpWriteWrapper(String fname, String tag) {
+        return "    a_.WriteRecord("+fname+",\""+tag+"\");\n";
+    }
+
+    static HashMap<String, String> vectorStructs = new HashMap<String, String>();
+    public void genCCode(FileWriter h, FileWriter c) throws IOException {
+        for (JField f : mFields) {
+            if (f.getType() instanceof JVector) {
+                JVector jv = (JVector)f.getType();
+                JType jvType = jv.getElementType();
+                String struct_name = JVector.extractVectorName(jvType);
+                if (vectorStructs.get(struct_name) == null) {
+                    vectorStructs.put(struct_name, struct_name);
+                    h.write("struct " + struct_name + " {\n    int32_t count;\n" + jv.getElementType().genCDecl("*data") + "\n};\n");
+                    h.write("int serialize_" + struct_name + "(struct oarchive *out, const char *tag, struct " + struct_name + " *v);\n");
+                    h.write("int deserialize_" + struct_name + "(struct iarchive *in, const char *tag, struct " + struct_name + " *v);\n");
+                    h.write("int allocate_" + struct_name + "(struct " + struct_name + " *v, int32_t len);\n");
+                    h.write("int deallocate_" + struct_name + "(struct " + struct_name + " *v);\n");
+                    c.write("int allocate_" + struct_name + "(struct " + struct_name + " *v, int32_t len) {\n");
+                    c.write("    if (!len) {\n");
+                    c.write("        v->count = 0;\n");
+                    c.write("        v->data = 0;\n");
+                    c.write("    } else {\n");
+                    c.write("        v->count = len;\n");
+                    c.write("        v->data = calloc(sizeof(*v->data), len);\n");
+                    c.write("    }\n");
+                    c.write("    return 0;\n");
+                    c.write("}\n");
+                    c.write("int deallocate_" + struct_name + "(struct " + struct_name + " *v) {\n");
+                    c.write("    if (v->data) {\n");
+                    c.write("        int32_t i;\n");
+                    c.write("        for(i=0;i<v->count; i++) {\n");
+                    c.write("            deallocate_"+JRecord.extractMethodSuffix(jvType)+"(&v->data[i]);\n");
+                    c.write("        }\n");
+                    c.write("        free(v->data);\n");
+                    c.write("        v->data = 0;\n");
+                    c.write("    }\n");
+                    c.write("    return 0;\n");
+                    c.write("}\n");
+                    c.write("int serialize_" + struct_name + "(struct oarchive *out, const char *tag, struct " + struct_name + " *v)\n");
+                    c.write("{\n");
+                    c.write("    int32_t count = v->count;\n");
+                    c.write("    int rc = 0;\n");
+                    c.write("    int32_t i;\n");
+                    c.write("    rc = out->start_vector(out, tag, &count);\n");
+                    c.write("    for(i=0;i<v->count;i++) {\n");
+                    genSerialize(c, jvType, "data", "data[i]");
+                    c.write("    }\n");
+                    c.write("    rc = rc ? rc : out->end_vector(out, tag);\n");
+                    c.write("    return rc;\n");
+                    c.write("}\n");
+                    c.write("int deserialize_" + struct_name + "(struct iarchive *in, const char *tag, struct " + struct_name + " *v)\n");
+                    c.write("{\n");
+                    c.write("    int rc = 0;\n");
+                    c.write("    int32_t i;\n");
+                    c.write("    rc = in->start_vector(in, tag, &v->count);\n");
+                    c.write("    v->data = calloc(v->count, sizeof(*v->data));\n");
+                    c.write("    for(i=0;i<v->count;i++) {\n");
+                    genDeserialize(c, jvType, "value", "data[i]");
+                    c.write("    }\n");
+                    c.write("    rc = in->end_vector(in, tag);\n");
+                    c.write("    return rc;\n");
+                    c.write("}\n");
+
+                }
+            }
+        }
+        String rec_name = getName();
+        h.write("struct " + rec_name + " {\n");
+        for (JField f : mFields) {
+            h.write(f.genCDecl());
+        }
+        h.write("};\n");
+        h.write("int serialize_" + rec_name + "(struct oarchive *out, const char *tag, struct " + rec_name + " *v);\n");
+        h.write("int deserialize_" + rec_name + "(struct iarchive *in, const char *tag, struct " + rec_name + "*v);\n");
+        h.write("void deallocate_" + rec_name + "(struct " + rec_name + "*);\n");
+        c.write("int serialize_" + rec_name + "(struct oarchive *out, const char *tag, struct " + rec_name + " *v)");
+        c.write("{\n");
+        c.write("    int rc;\n");
+        c.write("    rc = out->start_record(out, tag);\n");
+        for(JField f : mFields) {
+            genSerialize(c, f.getType(), f.getTag(), f.getName());
+        }
+        c.write("    rc = rc ? rc : out->end_record(out, tag);\n");
+        c.write("    return rc;\n");
+        c.write("}\n");
+        c.write("int deserialize_" + rec_name + "(struct iarchive *in, const char *tag, struct " + rec_name + "*v)");
+        c.write("{\n");
+        c.write("    int rc;\n");
+        c.write("    rc = in->start_record(in, tag);\n");
+        for(JField f : mFields) {
+            genDeserialize(c, f.getType(), f.getTag(), f.getName());
+        }
+        c.write("    rc = rc ? rc : in->end_record(in, tag);\n");
+        c.write("    return rc;\n");
+        c.write("}\n");
+        c.write("void deallocate_" + rec_name + "(struct " + rec_name + "*v)");
+        c.write("{\n");
+        for(JField f : mFields) {
+            if (f.getType() instanceof JRecord) {
+                c.write("    deallocate_" + extractStructName(f.getType()) + "(&v->" + f.getName() + ");\n");
+            } else if (f.getType() instanceof JVector) {
+                JVector vt = (JVector)f.getType();
+                c.write("    deallocate_" + JVector.extractVectorName(vt.getElementType())+ "(&v->"+f.getName()+");\n");
+            } else if (f.getType() instanceof JCompType) {
+                c.write("    deallocate_" + extractMethodSuffix(f.getType()) + "(&v->"+f.getName()+");\n");
+            }
+        }
+        c.write("}\n");
+    }
+
+    private void genSerialize(FileWriter c, JType type, String tag, String name) throws IOException {
+        if (type instanceof JRecord) {
+            c.write("    rc = rc ? rc : serialize_" + extractStructName(type) + "(out, \"" + tag + "\", &v->" + name + ");\n");
+        } else if (type instanceof JVector) {
+            c.write("    rc = rc ? rc : serialize_" + JVector.extractVectorName(((JVector)type).getElementType()) + "(out, \"" + tag + "\", &v->" + name + ");\n");
+        } else {
+            c.write("    rc = rc ? rc : out->serialize_" + extractMethodSuffix(type) + "(out, \"" + tag + "\", &v->" + name + ");\n");
+        }
+    }
+
+    private void genDeserialize(FileWriter c, JType type, String tag, String name) throws IOException {
+        if (type instanceof JRecord) {
+            c.write("    rc = rc ? rc : deserialize_" + extractStructName(type) + "(in, \"" + tag + "\", &v->" + name + ");\n");
+        } else if (type instanceof JVector) {
+            c.write("    rc = rc ? rc : deserialize_" + JVector.extractVectorName(((JVector)type).getElementType()) + "(in, \"" + tag + "\", &v->" + name + ");\n");
+        } else {
+            c.write("    rc = rc ? rc : in->deserialize_" + extractMethodSuffix(type) + "(in, \"" + tag + "\", &v->" + name + ");\n");
+        }
+    }
+
+    static String extractMethodSuffix(JType t) {
+        if (t instanceof JRecord) {
+            return extractStructName(t);
+        }
+        return t.getMethodSuffix();
+    }
+
+    static private String extractStructName(JType t) {
+        String type = t.getCType();
+        if (!type.startsWith("struct ")) return type;
+        return type.substring("struct ".length());
+    }
+
+    public void genCppCode(FileWriter hh, FileWriter cc)
+        throws IOException {
+        String[] ns = getCppNameSpace().split("::");
+        for (int i = 0; i < ns.length; i++) {
+            hh.write("namespace "+ns[i]+" {\n");
+        }
+
+        hh.write("class "+getName()+" : public ::hadoop::Record {\n");
+        hh.write("private:\n");
+
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
+            JField jf = i.next();
+            hh.write(jf.genCppDecl());
+        }
+        hh.write("  mutable std::bitset<"+mFields.size()+"> bs_;\n");
+        hh.write("public:\n");
+        hh.write("  virtual void serialize(::hadoop::OArchive& a_, const char* tag) const;\n");
+        hh.write("  virtual void deserialize(::hadoop::IArchive& a_, const char* tag);\n");
+        hh.write("  virtual const ::std::string& type() const;\n");
+        hh.write("  virtual const ::std::string& signature() const;\n");
+        hh.write("  virtual bool validate() const;\n");
+        hh.write("  virtual bool operator<(const "+getName()+"& peer_) const;\n");
+        hh.write("  virtual bool operator==(const "+getName()+"& peer_) const;\n");
+        hh.write("  virtual ~"+getName()+"() {};\n");
+        int fIdx = 0;
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
+            hh.write(jf.genCppGetSet(fIdx));
+        }
+        hh.write("}; // end record "+getName()+"\n");
+        for (int i=ns.length-1; i>=0; i--) {
+            hh.write("} // end namespace "+ns[i]+"\n");
+        }
+        cc.write("void "+getCppFQName()+"::serialize(::hadoop::OArchive& a_, const char* tag) const {\n");
+        cc.write("  if (!validate()) throw new ::hadoop::IOException(\"All fields not set.\");\n");
+        cc.write("  a_.startRecord(*this,tag);\n");
+        fIdx = 0;
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
+            String name = jf.getName();
+            if (jf.getType() instanceof JBuffer) {
+                cc.write("  a_.serialize(m"+name+",m"+name+".length(),\""+jf.getTag()+"\");\n");
+            } else {
+                cc.write("  a_.serialize(m"+name+",\""+jf.getTag()+"\");\n");
+            }
+            cc.write("  bs_.reset("+fIdx+");\n");
+        }
+        cc.write("  a_.endRecord(*this,tag);\n");
+        cc.write("  return;\n");
+        cc.write("}\n");
+
+        cc.write("void "+getCppFQName()+"::deserialize(::hadoop::IArchive& a_, const char* tag) {\n");
+        cc.write("  a_.startRecord(*this,tag);\n");
+        fIdx = 0;
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
+            String name = jf.getName();
+            if (jf.getType() instanceof JBuffer) {
+                cc.write("  { size_t len=0; a_.deserialize(m"+name+",len,\""+jf.getTag()+"\");}\n");
+            } else {
+                cc.write("  a_.deserialize(m"+name+",\""+jf.getTag()+"\");\n");
+            }
+            cc.write("  bs_.set("+fIdx+");\n");
+        }
+        cc.write("  a_.endRecord(*this,tag);\n");
+        cc.write("  return;\n");
+        cc.write("}\n");
+
+        cc.write("bool "+getCppFQName()+"::validate() const {\n");
+        cc.write("  if (bs_.size() != bs_.count()) return false;\n");
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = (JField) i.next();
+            JType type = jf.getType();
+            if (type instanceof JRecord) {
+                cc.write("  if (!m"+jf.getName()+".validate()) return false;\n");
+            }
+        }
+        cc.write("  return true;\n");
+        cc.write("}\n");
+
+        cc.write("bool "+getCppFQName()+"::operator< (const "+getCppFQName()+"& peer_) const {\n");
+        cc.write("  return (1\n");
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
+            JField jf = i.next();
+            String name = jf.getName();
+            cc.write("    && (m"+name+" < peer_.m"+name+")\n");
+        }
+        cc.write("  );\n");
+        cc.write("}\n");
+
+        cc.write("bool "+getCppFQName()+"::operator== (const "+getCppFQName()+"& peer_) const {\n");
+        cc.write("  return (1\n");
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
+            JField jf = i.next();
+            String name = jf.getName();
+            cc.write("    && (m"+name+" == peer_.m"+name+")\n");
+        }
+        cc.write("  );\n");
+        cc.write("}\n");
+
+        cc.write("const ::std::string&"+getCppFQName()+"::type() const {\n");
+        cc.write("  static const ::std::string type_(\""+mName+"\");\n");
+        cc.write("  return type_;\n");
+        cc.write("}\n");
+
+        cc.write("const ::std::string&"+getCppFQName()+"::signature() const {\n");
+        cc.write("  static const ::std::string sig_(\""+getSignature()+"\");\n");
+        cc.write("  return sig_;\n");
+        cc.write("}\n");
+
+    }
+
+    public void genJavaCode(File outputDirectory) throws IOException {
+        String pkg = getJavaPackage();
+        String pkgpath = pkg.replaceAll("\\.", "/");
+        File pkgdir = new File(outputDirectory, pkgpath);
+        if (!pkgdir.exists()) {
+            // create the pkg directory
+            if (!pkgdir.mkdirs()) {
+                throw new IOException("Cannnot create directory: " + pkgpath);
+            }
+        } else if (!pkgdir.isDirectory()) {
+            throw new IOException(pkgpath + " is not a directory.");
+        }
+        File jfile = new File(pkgdir, getName()+".java");
+        FileWriter jj = null;
+        try{
+            jj = new FileWriter(jfile);
+            jj.write("// File generated by hadoop record compiler. Do not edit.\n");
+            jj.write("/**\n");
+            jj.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
+            jj.write("* or more contributor license agreements.  See the NOTICE file\n");
+            jj.write("* distributed with this work for additional information\n");
+            jj.write("* regarding copyright ownership.  The ASF licenses this file\n");
+            jj.write("* to you under the Apache License, Version 2.0 (the\n");
+            jj.write("* \"License\"); you may not use this file except in compliance\n");
+            jj.write("* with the License.  You may obtain a copy of the License at\n");
+            jj.write("*\n");
+            jj.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
+            jj.write("*\n");
+            jj.write("* Unless required by applicable law or agreed to in writing, software\n");
+            jj.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
+            jj.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
+            jj.write("* See the License for the specific language governing permissions and\n");
+            jj.write("* limitations under the License.\n");
+            jj.write("*/\n");
+            jj.write("\n");
+            jj.write("package "+getJavaPackage()+";\n\n");
+            jj.write("import org.apache.jute.*;\n");
+            jj.write("import org.apache.yetus.audience.InterfaceAudience;\n");
+            jj.write("@InterfaceAudience.Public\n");
+            jj.write("public class "+getName()+" implements Record {\n");
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
+                JField jf = i.next();
+                jj.write(jf.genJavaDecl());
+            }
+            jj.write("  public "+getName()+"() {\n");
+            jj.write("  }\n");
+
+            jj.write("  public "+getName()+"(\n");
+            int fIdx = 0;
+            int fLen = mFields.size();
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                jj.write(jf.genJavaConstructorParam(jf.getName()));
+                jj.write((fLen-1 == fIdx)?"":",\n");
+            }
+            jj.write(") {\n");
+            fIdx = 0;
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                jj.write(jf.genJavaConstructorSet(jf.getName()));
+            }
+            jj.write("  }\n");
+            fIdx = 0;
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                jj.write(jf.genJavaGetSet(fIdx));
+            }
+            jj.write("  public void serialize(OutputArchive a_, String tag) throws java.io.IOException {\n");
+            jj.write("    a_.startRecord(this,tag);\n");
+            fIdx = 0;
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                jj.write(jf.genJavaWriteMethodName());
+            }
+            jj.write("    a_.endRecord(this,tag);\n");
+            jj.write("  }\n");
+
+            jj.write("  public void deserialize(InputArchive a_, String tag) throws java.io.IOException {\n");
+            jj.write("    a_.startRecord(tag);\n");
+            fIdx = 0;
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                jj.write(jf.genJavaReadMethodName());
+            }
+            jj.write("    a_.endRecord(tag);\n");
+            jj.write("}\n");
+
+            jj.write("  public String toString() {\n");
+            jj.write("    try {\n");
+            jj.write("      java.io.ByteArrayOutputStream s =\n");
+            jj.write("        new java.io.ByteArrayOutputStream();\n");
+            jj.write("      CsvOutputArchive a_ = \n");
+            jj.write("        new CsvOutputArchive(s);\n");
+            jj.write("      a_.startRecord(this,\"\");\n");
+            fIdx = 0;
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                jj.write(jf.genJavaWriteMethodName());
+            }
+            jj.write("      a_.endRecord(this,\"\");\n");
+            jj.write("      return new String(s.toByteArray(), \"UTF-8\");\n");
+            jj.write("    } catch (Throwable ex) {\n");
+            jj.write("      ex.printStackTrace();\n");
+            jj.write("    }\n");
+            jj.write("    return \"ERROR\";\n");
+            jj.write("  }\n");
+
+            jj.write("  public void write(java.io.DataOutput out) throws java.io.IOException {\n");
+            jj.write("    BinaryOutputArchive archive = new BinaryOutputArchive(out);\n");
+            jj.write("    serialize(archive, \"\");\n");
+            jj.write("  }\n");
+
+            jj.write("  public void readFields(java.io.DataInput in) throws java.io.IOException {\n");
+            jj.write("    BinaryInputArchive archive = new BinaryInputArchive(in);\n");
+            jj.write("    deserialize(archive, \"\");\n");
+            jj.write("  }\n");
+
+            jj.write("  public int compareTo (Object peer_) throws ClassCastException {\n");
+            boolean unimplemented = false;
+            for (JField f : mFields) {
+                if ((f.getType() instanceof JMap)
+                        || (f.getType() instanceof JVector))
+                {
+                    unimplemented = true;
+                }
+            }
+            if (unimplemented) {
+                jj.write("    throw new UnsupportedOperationException(\"comparing "
+                        + getName() + " is unimplemented\");\n");
+            } else {
+                jj.write("    if (!(peer_ instanceof "+getName()+")) {\n");
+                jj.write("      throw new ClassCastException(\"Comparing different types of records.\");\n");
+                jj.write("    }\n");
+                jj.write("    "+getName()+" peer = ("+getName()+") peer_;\n");
+                jj.write("    int ret = 0;\n");
+                for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                    JField jf = i.next();
+                    jj.write(jf.genJavaCompareTo());
+                    jj.write("    if (ret != 0) return ret;\n");
+                }
+                jj.write("     return ret;\n");
+            }
+            jj.write("  }\n");
+
+            jj.write("  public boolean equals(Object peer_) {\n");
+            jj.write("    if (!(peer_ instanceof "+getName()+")) {\n");
+            jj.write("      return false;\n");
+            jj.write("    }\n");
+            jj.write("    if (peer_ == this) {\n");
+            jj.write("      return true;\n");
+            jj.write("    }\n");
+            jj.write("    "+getName()+" peer = ("+getName()+") peer_;\n");
+            jj.write("    boolean ret = false;\n");
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                jj.write(jf.genJavaEquals());
+                jj.write("    if (!ret) return ret;\n");
+            }
+            jj.write("     return ret;\n");
+            jj.write("  }\n");
+
+            jj.write("  public int hashCode() {\n");
+            jj.write("    int result = 17;\n");
+            jj.write("    int ret;\n");
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                jj.write(jf.genJavaHashCode());
+                jj.write("    result = 37*result + ret;\n");
+            }
+            jj.write("    return result;\n");
+            jj.write("  }\n");
+            jj.write("  public static String signature() {\n");
+            jj.write("    return \""+getSignature()+"\";\n");
+            jj.write("  }\n");
+
+            jj.write("}\n");
+        } finally {
+            if (jj != null) {
+                jj.close();
+            }
+        }
+
+    }
+
+    public void genCsharpCode(File outputDirectory) throws IOException {
+        if (!outputDirectory.exists()) {
+            // create the pkg directory
+            if (!outputDirectory.mkdirs()) {
+                throw new IOException("Cannnot create directory: " + outputDirectory);
+            }
+        } else if (!outputDirectory.isDirectory()) {
+            throw new IOException(outputDirectory + " is not a directory.");
+        }
+        File csharpFile = new File(outputDirectory, getName()+".cs");
+        FileWriter cs = null;
+
+        try {
+            cs = new FileWriter(csharpFile);
+
+            cs.write("// File generated by hadoop record compiler. Do not edit.\n");
+            cs.write("/**\n");
+            cs.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
+            cs.write("* or more contributor license agreements.  See the NOTICE file\n");
+            cs.write("* distributed with this work for additional information\n");
+            cs.write("* regarding copyright ownership.  The ASF licenses this file\n");
+            cs.write("* to you under the Apache License, Version 2.0 (the\n");
+            cs.write("* \"License\"); you may not use this file except in compliance\n");
+            cs.write("* with the License.  You may obtain a copy of the License at\n");
+            cs.write("*\n");
+            cs.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
+            cs.write("*\n");
+            cs.write("* Unless required by applicable law or agreed to in writing, software\n");
+            cs.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
+            cs.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
+            cs.write("* See the License for the specific language governing permissions and\n");
+            cs.write("* limitations under the License.\n");
+            cs.write("*/\n");
+            cs.write("\n");
+            cs.write("using System;\n");
+            cs.write("using Org.Apache.Jute;\n");
+            cs.write("\n");
+            cs.write("namespace "+getCsharpNameSpace()+"\n");
+            cs.write("{\n");
+
+            String className = getCsharpName();
+            cs.write("public class "+className+" : IRecord, IComparable \n");
+            cs.write("{\n");
+            cs.write("  public "+ className +"() {\n");
+            cs.write("  }\n");
+
+            cs.write("  public "+className+"(\n");
+            int fIdx = 0;
+            int fLen = mFields.size();
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                cs.write(jf.genCsharpConstructorParam(jf.getCsharpName()));
+                cs.write((fLen-1 == fIdx)?"":",\n");
+            }
+            cs.write(") {\n");
+            fIdx = 0;
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                cs.write(jf.genCsharpConstructorSet(jf.getCsharpName()));
+            }
+            cs.write("  }\n");
+            fIdx = 0;
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                cs.write(jf.genCsharpGetSet(fIdx));
+                cs.write("\n");
+            }
+            cs.write("  public void Serialize(IOutputArchive a_, String tag) {\n");
+            cs.write("    a_.StartRecord(this,tag);\n");
+            fIdx = 0;
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                cs.write(jf.genCsharpWriteMethodName());
+            }
+            cs.write("    a_.EndRecord(this,tag);\n");
+            cs.write("  }\n");
+
+            cs.write("  public void Deserialize(IInputArchive a_, String tag) {\n");
+            cs.write("    a_.StartRecord(tag);\n");
+            fIdx = 0;
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                cs.write(jf.genCsharpReadMethodName());
+            }
+            cs.write("    a_.EndRecord(tag);\n");
+            cs.write("}\n");
+
+            cs.write("  public override String ToString() {\n");
+            cs.write("    try {\n");
+            cs.write("      System.IO.MemoryStream ms = new System.IO.MemoryStream();\n");
+            cs.write("      MiscUtil.IO.EndianBinaryWriter writer =\n");
+            cs.write("        new MiscUtil.IO.EndianBinaryWriter(MiscUtil.Conversion.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8);\n");
+            cs.write("      BinaryOutputArchive a_ = \n");
+            cs.write("        new BinaryOutputArchive(writer);\n");
+            cs.write("      a_.StartRecord(this,\"\");\n");
+            fIdx = 0;
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                cs.write(jf.genCsharpWriteMethodName());
+            }
+            cs.write("      a_.EndRecord(this,\"\");\n");
+            cs.write("      ms.Position = 0;\n");
+            cs.write("      return System.Text.Encoding.UTF8.GetString(ms.ToArray());\n");
+            cs.write("    } catch (Exception ex) {\n");
+            cs.write("      Console.WriteLine(ex.StackTrace);\n");
+            cs.write("    }\n");
+            cs.write("    return \"ERROR\";\n");
+            cs.write("  }\n");
+
+            cs.write("  public void Write(MiscUtil.IO.EndianBinaryWriter writer) {\n");
+            cs.write("    BinaryOutputArchive archive = new BinaryOutputArchive(writer);\n");
+            cs.write("    Serialize(archive, \"\");\n");
+            cs.write("  }\n");
+
+            cs.write("  public void ReadFields(MiscUtil.IO.EndianBinaryReader reader) {\n");
+            cs.write("    BinaryInputArchive archive = new BinaryInputArchive(reader);\n");
+            cs.write("    Deserialize(archive, \"\");\n");
+            cs.write("  }\n");
+
+            cs.write("  public int CompareTo (object peer_) {\n");
+            boolean unimplemented = false;
+            for (JField f : mFields) {
+                if ((f.getType() instanceof JMap)
+                        || (f.getType() instanceof JVector))
+                {
+                    unimplemented = true;
+                }
+            }
+            if (unimplemented) {
+                cs.write("    throw new InvalidOperationException(\"comparing "
+                        + getCsharpName() + " is unimplemented\");\n");
+            } else {
+                cs.write("    if (!(peer_ is "+getCsharpName()+")) {\n");
+                cs.write("      throw new InvalidOperationException(\"Comparing different types of records.\");\n");
+                cs.write("    }\n");
+                cs.write("    "+getCsharpName()+" peer = ("+getCsharpName()+") peer_;\n");
+                cs.write("    int ret = 0;\n");
+                for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                    JField jf = i.next();
+                    cs.write(jf.genCsharpCompareTo());
+                    cs.write("    if (ret != 0) return ret;\n");
+                }
+                cs.write("     return ret;\n");
+            }
+            cs.write("  }\n");
+
+            cs.write("  public override bool Equals(object peer_) {\n");
+            cs.write("    if (!(peer_ is "+getCsharpName()+")) {\n");
+            cs.write("      return false;\n");
+            cs.write("    }\n");
+            cs.write("    if (peer_ == this) {\n");
+            cs.write("      return true;\n");
+            cs.write("    }\n");
+            cs.write("    bool ret = false;\n");
+            cs.write("    " + getCsharpName() + " peer = (" + getCsharpName() + ")peer_;\n");
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                cs.write(jf.genCsharpEquals());
+                cs.write("    if (!ret) return ret;\n");
+            }
+            cs.write("     return ret;\n");
+            cs.write("  }\n");
+
+            cs.write("  public override int GetHashCode() {\n");
+            cs.write("    int result = 17;\n");
+            cs.write("    int ret;\n");
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                cs.write(jf.genCsharpHashCode());
+                cs.write("    result = 37*result + ret;\n");
+            }
+            cs.write("    return result;\n");
+            cs.write("  }\n");
+            cs.write("  public static string Signature() {\n");
+            cs.write("    return \""+getSignature()+"\";\n");
+            cs.write("  }\n");
+
+            cs.write("}\n");
+            cs.write("}\n");
+        } finally {
+            if (cs != null) {
+                cs.close();
+            }
+        }
+    }
+
+    public static String getCsharpFQName(String name) {
+        String[] packages = name.split("\\.");
+        StringBuffer fQName = new StringBuffer();
+        for (int i = 0; i < packages.length; i++) {
+            String pack = packages[i];
+            pack = capitalize(pack);
+            pack = "Id".equals(pack) ? "ZKId" : pack;
+            fQName.append(capitalize(pack));
+            if (i != packages.length - 1) fQName.append(".");
+        }
+        return fQName.toString();
+    }    
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JString.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JString.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JString.java
new file mode 100644
index 0000000..7f246c3
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JString.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.jute.compiler;
+
+/**
+ *
+ */
+public class JString extends JCompType {
+    
+    /** Creates a new instance of JString */
+    public JString() {
+        super("char *", " ::std::string", "string", "String", "String", "String", "string");
+    }
+    
+    public String getSignature() {
+        return "s";
+    }
+    
+    public String genJavaReadWrapper(String fname, String tag, boolean decl) {
+        String ret = "";
+        if (decl) {
+            ret = "    String "+fname+";\n";
+        }
+        return ret + "        "+fname+"=a_.readString(\""+tag+"\");\n";
+    }
+    
+    public String genJavaWriteWrapper(String fname, String tag) {
+        return "        a_.writeString("+fname+",\""+tag+"\");\n";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JType.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JType.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JType.java
new file mode 100644
index 0000000..ee1b9c0
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JType.java
@@ -0,0 +1,204 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ * Abstract Base class for all types supported by Hadoop Record I/O.
+ * 
+ */
+abstract public class JType {
+    
+	private String mCName;
+    private String mCppName;
+    private String mCsharpName;
+    private String mJavaName;
+    protected String mMethodSuffix;
+    private String mWrapper;
+    private String mSharpWrapper;
+    private String mUnwrapMethod;
+
+    /**
+     * Creates a new instance of JType
+     */
+    JType(String cname, String cppname, String csharpName, String javaname, String suffix, String wrapper, String csharpWrapper, String unwrap) {
+    	mCName = cname;
+        mCppName = cppname;
+        mCsharpName = "Id".equals(csharpName) ? "ZKId" : csharpName;
+        mJavaName = javaname;
+        mMethodSuffix = suffix;
+        mWrapper = wrapper;
+        mSharpWrapper = csharpWrapper;
+        mUnwrapMethod = unwrap;
+    }
+    
+    abstract String getSignature();
+    
+    String genCppDecl(String fname) {
+        return "  "+mCppName+" m"+fname+";\n"; 
+    }
+    
+	String genCDecl(String name) {
+		return "    " + mCName + " "+name+";\n"; 
+	}
+
+    public String genCsharpDecl(String name) {
+        return "  private "+mCsharpName+" " +name+";\n";
+    }
+
+    String genJavaDecl (String fname) {
+        return "  private "+mJavaName+" " +fname+";\n";
+    }
+    
+    String genJavaConstructorParam (String fname) {
+        return "        "+mJavaName+" "+fname;
+    }
+    
+    String genCppGetSet(String fname, int fIdx) {
+        String getFunc = "  virtual "+mCppName+" get"+fname+"() const {\n";
+        getFunc += "    return m"+fname+";\n";
+        getFunc += "  }\n";
+        String setFunc = "  virtual void set"+fname+"("+mCppName+" m_) {\n";
+        setFunc += "    m"+fname+"=m_; bs_.set("+fIdx+");\n";
+        setFunc += "  }\n";
+        return getFunc+setFunc;
+    }
+
+    String genCsharpGetSet(String fname, int fIdx) {
+        String getFunc = "  public " + getCsharpType() + " " + capitalize(fname) + " { get; set; } ";
+        return getFunc;
+    }
+    
+    static String capitalize(String s) {
+        return s.substring(0,1).toUpperCase()+s.substring(1);
+    }
+    String genJavaGetSet(String fname, int fIdx) {
+        String getFunc = "  public "+mJavaName+" get"+capitalize(fname)+"() {\n";
+        getFunc += "    return "+fname+";\n";
+        getFunc += "  }\n";
+        String setFunc = "  public void set"+capitalize(fname)+"("+mJavaName+" m_) {\n";
+        setFunc += "    " + fname+"=m_;\n";
+        setFunc += "  }\n";
+        return getFunc+setFunc;
+    }
+    
+    String getCType() {
+    	return mCName;
+    }
+    String getCppType() {
+        return mCppName;
+    }
+    
+    String getCsharpType() {
+        return mCsharpName;
+    }
+
+    String getJavaType() {
+        return mJavaName;
+    }
+   
+    String getJavaWrapperType() {
+        return mWrapper;
+    }
+
+    String getCsharpWrapperType() {
+        return mSharpWrapper;
+    }
+    
+    String getMethodSuffix() {
+        return mMethodSuffix;
+    }
+    
+    String genJavaWriteMethod(String fname, String tag) {
+        return "    a_.write"+mMethodSuffix+"("+fname+",\""+tag+"\");\n";
+    }
+    
+    String genJavaReadMethod(String fname, String tag) {
+        return "    "+fname+"=a_.read"+mMethodSuffix+"(\""+tag+"\");\n";
+    }
+    
+    String genJavaReadWrapper(String fname, String tag, boolean decl) {
+        String ret = "";
+        if (decl) {
+            ret = "    "+mWrapper+" "+fname+";\n";
+        }
+        return ret + "    "+fname+"=new "+mWrapper+"(a_.read"+mMethodSuffix+"(\""+tag+"\"));\n";
+    }
+    
+    String genJavaWriteWrapper(String fname, String tag) {
+        return "        a_.write"+mMethodSuffix+"("+fname+"."+mUnwrapMethod+"(),\""+tag+"\");\n";
+    }
+    
+    String genJavaCompareTo(String fname) {
+        return "    ret = ("+fname+" == peer."+fname+")? 0 :(("+fname+"<peer."+fname+")?-1:1);\n";
+    }
+    
+    String genJavaEquals(String fname, String peer) {
+        return "    ret = ("+fname+"=="+peer+");\n";
+    }
+    
+    String genJavaHashCode(String fname) {
+        return "    ret = (int)"+fname+";\n";
+    }
+
+    String genJavaConstructorSet(String fname, String name) {
+        return "    this."+fname+"="+name+";\n";
+    }
+
+    String genCsharpWriteMethod(String fname, String tag) {
+        return "    a_.Write"+mMethodSuffix+"("+capitalize(fname)+",\""+tag+"\");\n";
+    }
+
+    String genCsharpReadMethod(String fname, String tag) {
+        return "    "+capitalize(fname)+"=a_.Read"+mMethodSuffix+"(\""+tag+"\");\n";
+    }
+
+    String genCsharpReadWrapper(String fname, String tag, boolean decl) {
+        String ret = "";
+        if (decl) {
+            ret = "    "+mWrapper+" "+fname+";\n";
+        }
+        return ret + "    "+fname+"=a_.Read"+mMethodSuffix+"(\""+tag+"\");\n";
+    }
+
+    String genCsharpWriteWrapper(String fname, String tag) {
+        if (mUnwrapMethod == null) return "        a_.Write"+mMethodSuffix+"("+fname+","+tag+");\n";
+        return "        a_.Write"+mMethodSuffix+"("+fname+"."+mUnwrapMethod+"(),\""+tag+"\");\n";
+    }
+
+    String genCsharpCompareTo(String name) {
+        return "    ret = ("+capitalize(name)+" == peer."+capitalize(name)+")? 0 :(("+capitalize(name)+"<peer."+capitalize(name)+")?-1:1);\n";
+    }
+
+    String genCsharpEquals(String name, String peer) {
+        String[] peerSplit = peer.split("\\.");
+        return "    ret = ("+capitalize(name)+"=="+peerSplit[0] + "." + capitalize(peerSplit[1]) + ");\n";
+    }
+
+    String genCsharpHashCode(String fname) {
+        return "    ret = (int)"+capitalize(fname)+";\n";
+    }
+
+    String genCsharpConstructorSet(String mName, String fname) {
+        return capitalize(fname)+"="+mName+";\n";
+    }
+
+    public String genCsharpConstructorParam(String fname) {
+        return "  "+mCsharpName+" " +fname+"\n";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JVector.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JVector.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JVector.java
new file mode 100644
index 0000000..331970b
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JVector.java
@@ -0,0 +1,153 @@
+/**
+ * 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.jute.compiler;
+
+/**
+ *
+ */
+public class JVector extends JCompType {
+    
+    static private int level = 0;
+    
+    static private String getId(String id) { return id+getLevel(); }
+    
+    static private String getLevel() { return Integer.toString(level); }
+    
+    static private void incrLevel() { level++; }
+    
+    static private void decrLevel() { level--; }
+    
+    private JType mElement;
+    
+    /** Creates a new instance of JVector */
+    public JVector(JType t) {
+        super("struct " + extractVectorName(t), " ::std::vector<"+t.getCppType()+">", "System.Collections.Generic.List<" + t.getCsharpType() + ">", "java.util.List<" + t.getJavaType() + ">", "Vector",
+                "System.Collections.Generic.List<" + t.getCsharpType() + ">", "java.util.ArrayList<" + t.getJavaType() + ">");
+        mElement = t;
+    }
+    
+    public String getSignature() {
+        return "[" + mElement.getSignature() + "]";
+    }
+    
+    public String genJavaCompareTo(String fname) {
+        return "    throw new UnsupportedOperationException(\"comparing "
+            + fname + " is unimplemented\");\n";
+    }
+    
+    public String genJavaReadWrapper(String fname, String tag, boolean decl) {
+        StringBuilder ret = new StringBuilder("");
+        if (decl) {
+            ret.append("      java.util.List "+fname+";\n");
+        }
+        ret.append("    {\n");
+        incrLevel();
+        ret.append("      Index "+getId("vidx")+" = a_.startVector(\""+tag+"\");\n");
+        ret.append("      if ("+getId("vidx")+"!= null) {");
+        ret.append("          "+fname+"=new java.util.ArrayList<"+ mElement.getJavaType() + ">();\n");
+        ret.append("          for (; !"+getId("vidx")+".done(); "+getId("vidx")+".incr()) {\n");
+        ret.append(mElement.genJavaReadWrapper(getId("e"), getId("e"), true));
+        ret.append("            "+fname+".add("+getId("e")+");\n");
+        ret.append("          }\n");
+        ret.append("      }\n");
+        ret.append("    a_.endVector(\""+tag+"\");\n");
+        decrLevel();
+        ret.append("    }\n");
+        return ret.toString();
+    }
+    
+    public String genJavaReadMethod(String fname, String tag) {
+        return genJavaReadWrapper(fname, tag, false);
+    }
+    
+    public String genJavaWriteWrapper(String fname, String tag) {
+        StringBuilder ret = new StringBuilder("    {\n");
+        incrLevel();
+        ret.append("      a_.startVector("+fname+",\""+tag+"\");\n");
+        ret.append("      if ("+fname+"!= null) {");
+        ret.append("          int "+getId("len")+" = "+fname+".size();\n");
+        ret.append("          for(int "+getId("vidx")+" = 0; "+getId("vidx")+"<"+getId("len")+"; "+getId("vidx")+"++) {\n");
+        ret.append("            "+mElement.getJavaWrapperType()+" "+getId("e")+" = ("+mElement.getJavaWrapperType()+") "+fname+".get("+getId("vidx")+");\n");
+        ret.append(mElement.genJavaWriteWrapper(getId("e"), getId("e")));
+        ret.append("          }\n");
+        ret.append("      }\n");
+        ret.append("      a_.endVector("+fname+",\""+tag+"\");\n");
+        ret.append("    }\n");
+        decrLevel();
+        return ret.toString();
+    }
+    
+    public String genJavaWriteMethod(String fname, String tag) {
+        return genJavaWriteWrapper(fname, tag);
+    }
+    
+    public JType getElementType() {
+    	return mElement;
+    }
+
+    public String genCsharpWriteWrapper(String fname, String tag) {
+        StringBuilder ret = new StringBuilder("    {\n");
+        incrLevel();
+        ret.append("      a_.StartVector("+capitalize(fname)+",\""+tag+"\");\n");
+        ret.append("      if ("+capitalize(fname)+"!= null) {");
+        ret.append("          int "+getId("len")+" = "+capitalize(fname)+".Count;\n");
+        ret.append("          for(int "+getId("vidx")+" = 0; "+getId("vidx")+"<"+getId("len")+"; "+getId("vidx")+"++) {\n");
+        ret.append("            "+mElement.getCsharpWrapperType()+" "+getId("e")+" = ("+mElement.getCsharpWrapperType()+") "+capitalize(fname)+"["+getId("vidx")+"];\n");
+        ret.append(mElement.genCsharpWriteWrapper(getId("e"), getId("e")));
+        ret.append("          }\n");
+        ret.append("      }\n");
+        ret.append("      a_.EndVector("+capitalize(fname)+",\""+tag+"\");\n");
+        ret.append("    }\n");
+        decrLevel();
+        return ret.toString();
+    }
+
+    String genCsharpWriteMethod(String fname, String tag) {
+        return genCsharpWriteWrapper(fname, tag);
+    }
+
+    public String genCsharpReadWrapper(String fname, String tag, boolean decl) {
+        StringBuilder ret = new StringBuilder("");
+        if (decl) {
+            ret.append("      System.Collections.Generic.List<" + mElement.getCsharpType()+ "> "+capitalize(fname)+";\n");
+        }
+        ret.append("    {\n");
+        incrLevel();
+        ret.append("      IIndex "+getId("vidx")+" = a_.StartVector(\""+tag+"\");\n");
+        ret.append("      if ("+getId("vidx")+"!= null) {");
+        ret.append("          "+capitalize(fname)+"=new System.Collections.Generic.List<"+ mElement.getCsharpType() + ">();\n");
+        ret.append("          for (; !"+getId("vidx")+".Done(); "+getId("vidx")+".Incr()) {\n");
+        ret.append(mElement.genCsharpReadWrapper(getId("e"), getId("e"), true));
+        ret.append("            "+capitalize(fname)+".Add("+getId("e")+");\n");
+        ret.append("          }\n");
+        ret.append("      }\n");
+        ret.append("    a_.EndVector(\""+tag+"\");\n");
+        decrLevel();
+        ret.append("    }\n");
+        return ret.toString();
+    }
+    
+    String genCsharpReadMethod(String fname, String tag) {
+        return genCsharpReadWrapper(fname, tag, false);
+    }
+
+    static public String extractVectorName(JType jvType) {
+		return JRecord.extractMethodSuffix(jvType)+"_vector";
+	}
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JavaGenerator.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/JavaGenerator.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JavaGenerator.java
new file mode 100644
index 0000000..4078520
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JavaGenerator.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.jute.compiler;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Java Code generator front-end for Hadoop record I/O.
+ */
+class JavaGenerator {
+    private ArrayList<JRecord> mRecList;
+    private final File outputDirectory;
+    
+    /** Creates a new instance of JavaGenerator
+     *
+     * @param name possibly full pathname to the file
+     * @param incl included files (as JFile)
+     * @param records List of records defined within this file
+     * @param outputDirectory 
+     */
+    JavaGenerator(String name, ArrayList<JFile> incl,
+            ArrayList<JRecord> records, File outputDirectory)
+    {
+        mRecList = records;
+        this.outputDirectory = outputDirectory;
+    }
+    
+    /**
+     * Generate Java code for records. This method is only a front-end to
+     * JRecord, since one file is generated for each record.
+     */
+    void genCode() throws IOException {
+        for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext(); ) {
+            JRecord rec = i.next();
+            rec.genJavaCode(outputDirectory);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/ParseException.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/ParseException.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/ParseException.java
new file mode 100644
index 0000000..e4b0a9b
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/ParseException.java
@@ -0,0 +1,210 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.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.jute.compiler.generated;
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends Exception {
+
+  /**
+   * This constructor is used by the method "generateParseException"
+   * in the generated parser.  Calling this constructor generates
+   * a new object of this type with the fields "currentToken",
+   * "expectedTokenSequences", and "tokenImage" set.  The boolean
+   * flag "specialConstructor" is also set to true to indicate that
+   * this constructor was used to create this object.
+   * This constructor calls its super class with the empty string
+   * to force the "toString" method of parent class "Throwable" to
+   * print the error message in the form:
+   *     ParseException: <result of getMessage>
+   */
+  public ParseException(Token currentTokenVal,
+                        int[][] expectedTokenSequencesVal,
+                        String[] tokenImageVal
+                       )
+  {
+    super("");
+    specialConstructor = true;
+    currentToken = currentTokenVal;
+    expectedTokenSequences = expectedTokenSequencesVal;
+    tokenImage = tokenImageVal;
+  }
+
+  /**
+   * The following constructors are for use by you for whatever
+   * purpose you can think of.  Constructing the exception in this
+   * manner makes the exception behave in the normal way - i.e., as
+   * documented in the class "Throwable".  The fields "errorToken",
+   * "expectedTokenSequences", and "tokenImage" do not contain
+   * relevant information.  The JavaCC generated code does not use
+   * these constructors.
+   */
+
+  public ParseException() {
+    super();
+    specialConstructor = false;
+  }
+
+  public ParseException(String message) {
+    super(message);
+    specialConstructor = false;
+  }
+
+  /**
+   * This variable determines which constructor was used to create
+   * this object and thereby affects the semantics of the
+   * "getMessage" method (see below).
+   */
+  protected boolean specialConstructor;
+
+  /**
+   * This is the last token that has been consumed successfully.  If
+   * this object has been created due to a parse error, the token
+   * followng this token will (therefore) be the first error token.
+   */
+  public Token currentToken;
+
+  /**
+   * Each entry in this array is an array of integers.  Each array
+   * of integers represents a sequence of tokens (by their ordinal
+   * values) that is expected at this point of the parse.
+   */
+  public int[][] expectedTokenSequences;
+
+  /**
+   * This is a reference to the "tokenImage" array of the generated
+   * parser within which the parse error occurred.  This array is
+   * defined in the generated ...Constants interface.
+   */
+  public String[] tokenImage;
+
+  /**
+   * This method has the standard behavior when this object has been
+   * created using the standard constructors.  Otherwise, it uses
+   * "currentToken" and "expectedTokenSequences" to generate a parse
+   * error message and returns it.  If this object has been created
+   * due to a parse error, and you do not catch it (it gets thrown
+   * from the parser), then this method is called during the printing
+   * of the final stack trace, and hence the correct error message
+   * gets displayed.
+   */
+  public String getMessage() {
+    if (!specialConstructor) {
+      return super.getMessage();
+    }
+    StringBuffer expected = new StringBuffer();
+    int maxSize = 0;
+    for (int i = 0; i < expectedTokenSequences.length; i++) {
+      if (maxSize < expectedTokenSequences[i].length) {
+        maxSize = expectedTokenSequences[i].length;
+      }
+      for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+        expected.append(tokenImage[expectedTokenSequences[i][j]]).append(" ");
+      }
+      if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+        expected.append("...");
+      }
+      expected.append(eol).append("    ");
+    }
+    String retval = "Encountered \"";
+    Token tok = currentToken.next;
+    for (int i = 0; i < maxSize; i++) {
+      if (i != 0) retval += " ";
+      if (tok.kind == 0) {
+        retval += tokenImage[0];
+        break;
+      }
+      retval += add_escapes(tok.image);
+      tok = tok.next; 
+    }
+    retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
+    retval += "." + eol;
+    if (expectedTokenSequences.length == 1) {
+      retval += "Was expecting:" + eol + "    ";
+    } else {
+      retval += "Was expecting one of:" + eol + "    ";
+    }
+    retval += expected.toString();
+    return retval;
+  }
+
+  /**
+   * The end of line string for this machine.
+   */
+  protected String eol = System.getProperty("line.separator", "\n");
+ 
+  /**
+   * Used to convert raw characters to their escaped version
+   * when these raw version cannot be used as part of an ASCII
+   * string literal.
+   */
+  protected String add_escapes(String str) {
+      StringBuffer retval = new StringBuffer();
+      char ch;
+      for (int i = 0; i < str.length(); i++) {
+        switch (str.charAt(i))
+        {
+           case 0 :
+              continue;
+           case '\b':
+              retval.append("\\b");
+              continue;
+           case '\t':
+              retval.append("\\t");
+              continue;
+           case '\n':
+              retval.append("\\n");
+              continue;
+           case '\f':
+              retval.append("\\f");
+              continue;
+           case '\r':
+              retval.append("\\r");
+              continue;
+           case '\"':
+              retval.append("\\\"");
+              continue;
+           case '\'':
+              retval.append("\\\'");
+              continue;
+           case '\\':
+              retval.append("\\\\");
+              continue;
+           default:
+              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+                 String s = "0000" + Integer.toString(ch, 16);
+                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+              } else {
+                 retval.append(ch);
+              }
+              continue;
+        }
+      }
+      return retval.toString();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/Rcc.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/Rcc.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/Rcc.java
new file mode 100644
index 0000000..1bd4878
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/Rcc.java
@@ -0,0 +1,525 @@
+/* Generated By:JavaCC: Do not edit this line. Rcc.java */
+/**
+ * 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.jute.compiler.generated;
+
+import org.apache.jute.compiler.*;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+public class Rcc implements RccConstants {
+    private static Hashtable recTab = new Hashtable();
+    private static String curDir = System.getProperty("user.dir");
+    private static String curFileName;
+    private static String curModuleName;
+
+    public static void main(String args[]) {
+        String language = "java";
+        ArrayList recFiles = new ArrayList();
+        JFile curFile=null;
+
+        for (int i=0; i<args.length; i++) {
+            if ("-l".equalsIgnoreCase(args[i]) ||
+                "--language".equalsIgnoreCase(args[i])) {
+                language = args[i+1].toLowerCase();
+                i++;
+            } else {
+                recFiles.add(args[i]);
+            }
+        }
+        if (!"c++".equals(language) && !"java".equals(language) && !"c".equals(language)) {
+            System.out.println("Cannot recognize language:" + language);
+            System.exit(1);
+        }
+        if (recFiles.size() == 0) {
+            System.out.println("No record files specified. Exiting.");
+            System.exit(1);
+        }
+        for (int i=0; i<recFiles.size(); i++) {
+            curFileName = (String) recFiles.get(i);
+            File file = new File(curFileName);
+            try {
+                curFile = parseFile(file);
+            } catch (FileNotFoundException e) {
+                System.out.println("File " + (String) recFiles.get(i) + " Not found.");
+                System.exit(1);
+            } catch (ParseException e) {
+                System.out.println(e.toString());
+                System.exit(1);
+            }
+            System.out.println((String) recFiles.get(i) + " Parsed Successfully");
+            try {
+                curFile.genCode(language, new File("."));
+            } catch (IOException e) {
+                System.out.println(e.toString());
+                System.exit(1);
+            }
+        }
+    }
+
+    public static JFile parseFile(File file) throws FileNotFoundException, ParseException {
+        curDir = file.getParent();
+        curFileName = file.getName();
+        FileReader reader = new FileReader(file);
+        try {
+            Rcc parser = new Rcc(reader);
+            recTab = new Hashtable();
+            return parser.Input();
+        } finally {
+            try {
+                reader.close();
+            } catch (IOException e) {
+            }
+        }
+    }
+
+  final public JFile Input() throws ParseException {
+    ArrayList ilist = new ArrayList();
+    ArrayList rlist = new ArrayList();
+    JFile i;
+    ArrayList l;
+    label_1:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case INCLUDE_TKN:
+        i = Include();
+          ilist.add(i);
+        break;
+      case MODULE_TKN:
+        l = Module();
+          rlist.addAll(l);
+        break;
+      default:
+        jj_la1[0] = jj_gen;
+        jj_consume_token(-1);
+        throw new ParseException();
+      }
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case MODULE_TKN:
+      case INCLUDE_TKN:
+        ;
+        break;
+      default:
+        jj_la1[1] = jj_gen;
+        break label_1;
+      }
+    }
+    jj_consume_token(0);
+      {if (true) return new JFile(curFileName, ilist, rlist);}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public JFile Include() throws ParseException {
+    String fname;
+    Token t;
+    jj_consume_token(INCLUDE_TKN);
+    t = jj_consume_token(CSTRING_TKN);
+        JFile ret = null;
+        fname = t.image.replaceAll("^\"", "").replaceAll("\"$","");
+        File file = new File(curDir, fname);
+        String tmpDir = curDir;
+        String tmpFile = curFileName;
+        curDir = file.getParent();
+        curFileName = file.getName();
+        try {
+            FileReader reader = new FileReader(file);
+            Rcc parser = new Rcc(reader);
+            try {
+                ret = parser.Input();
+                System.out.println(fname + " Parsed Successfully");
+            } catch (ParseException e) {
+                System.out.println(e.toString());
+                System.exit(1);
+            }
+            try {
+                reader.close();
+            } catch (IOException e) {
+            }
+        } catch (FileNotFoundException e) {
+            System.out.println("File " + fname +
+                " Not found.");
+            System.exit(1);
+        }
+        curDir = tmpDir;
+        curFileName = tmpFile;
+        {if (true) return ret;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public ArrayList Module() throws ParseException {
+    String mName;
+    ArrayList rlist;
+    jj_consume_token(MODULE_TKN);
+    mName = ModuleName();
+      curModuleName = mName;
+    jj_consume_token(LBRACE_TKN);
+    rlist = RecordList();
+    jj_consume_token(RBRACE_TKN);
+      {if (true) return rlist;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String ModuleName() throws ParseException {
+    String name = "";
+    Token t;
+    t = jj_consume_token(IDENT_TKN);
+      name += t.image;
+    label_2:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case DOT_TKN:
+        ;
+        break;
+      default:
+        jj_la1[2] = jj_gen;
+        break label_2;
+      }
+      jj_consume_token(DOT_TKN);
+      t = jj_consume_token(IDENT_TKN);
+          name += "." + t.image;
+    }
+      {if (true) return name;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public ArrayList RecordList() throws ParseException {
+    ArrayList rlist = new ArrayList();
+    JRecord r;
+    label_3:
+    while (true) {
+      r = Record();
+          rlist.add(r);
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case RECORD_TKN:
+        ;
+        break;
+      default:
+        jj_la1[3] = jj_gen;
+        break label_3;
+      }
+    }
+      {if (true) return rlist;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public JRecord Record() throws ParseException {
+    String rname;
+    ArrayList flist = new ArrayList();
+    Token t;
+    JField f;
+    jj_consume_token(RECORD_TKN);
+    t = jj_consume_token(IDENT_TKN);
+      rname = t.image;
+    jj_consume_token(LBRACE_TKN);
+    label_4:
+    while (true) {
+      f = Field();
+          flist.add(f);
+      jj_consume_token(SEMICOLON_TKN);
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case BYTE_TKN:
+      case BOOLEAN_TKN:
+      case INT_TKN:
+      case LONG_TKN:
+      case FLOAT_TKN:
+      case DOUBLE_TKN:
+      case USTRING_TKN:
+      case BUFFER_TKN:
+      case VECTOR_TKN:
+      case MAP_TKN:
+      case IDENT_TKN:
+        ;
+        break;
+      default:
+        jj_la1[4] = jj_gen;
+        break label_4;
+      }
+    }
+    jj_consume_token(RBRACE_TKN);
+        String fqn = curModuleName + "." + rname;
+        JRecord r = new JRecord(fqn, flist);
+        recTab.put(fqn, r);
+        {if (true) return r;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public JField Field() throws ParseException {
+    JType jt;
+    Token t;
+    jt = Type();
+    t = jj_consume_token(IDENT_TKN);
+      {if (true) return new JField(jt, t.image);}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public JType Type() throws ParseException {
+    JType jt;
+    Token t;
+    String rname;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case MAP_TKN:
+      jt = Map();
+      {if (true) return jt;}
+      break;
+    case VECTOR_TKN:
+      jt = Vector();
+      {if (true) return jt;}
+      break;
+    case BYTE_TKN:
+      jj_consume_token(BYTE_TKN);
+      {if (true) return new JByte();}
+      break;
+    case BOOLEAN_TKN:
+      jj_consume_token(BOOLEAN_TKN);
+      {if (true) return new JBoolean();}
+      break;
+    case INT_TKN:
+      jj_consume_token(INT_TKN);
+      {if (true) return new JInt();}
+      break;
+    case LONG_TKN:
+      jj_consume_token(LONG_TKN);
+      {if (true) return new JLong();}
+      break;
+    case FLOAT_TKN:
+      jj_consume_token(FLOAT_TKN);
+      {if (true) return new JFloat();}
+      break;
+    case DOUBLE_TKN:
+      jj_consume_token(DOUBLE_TKN);
+      {if (true) return new JDouble();}
+      break;
+    case USTRING_TKN:
+      jj_consume_token(USTRING_TKN);
+      {if (true) return new JString();}
+      break;
+    case BUFFER_TKN:
+      jj_consume_token(BUFFER_TKN);
+      {if (true) return new JBuffer();}
+      break;
+    case IDENT_TKN:
+      rname = ModuleName();
+        if (rname.indexOf('.', 0) < 0) {
+            rname = curModuleName + "." + rname;
+        }
+        JRecord r = (JRecord) recTab.get(rname);
+        if (r == null) {
+            System.out.println("Type " + rname + " not known. Exiting.");
+            System.exit(1);
+        }
+        {if (true) return r;}
+      break;
+    default:
+      jj_la1[5] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+    throw new Error("Missing return statement in function");
+  }
+
+  final public JMap Map() throws ParseException {
+    JType jt1;
+    JType jt2;
+    jj_consume_token(MAP_TKN);
+    jj_consume_token(LT_TKN);
+    jt1 = Type();
+    jj_consume_token(COMMA_TKN);
+    jt2 = Type();
+    jj_consume_token(GT_TKN);
+      {if (true) return new JMap(jt1, jt2);}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public JVector Vector() throws ParseException {
+    JType jt;
+    jj_consume_token(VECTOR_TKN);
+    jj_consume_token(LT_TKN);
+    jt = Type();
+    jj_consume_token(GT_TKN);
+      {if (true) return new JVector(jt);}
+    throw new Error("Missing return statement in function");
+  }
+
+  public RccTokenManager token_source;
+  SimpleCharStream jj_input_stream;
+  public Token token, jj_nt;
+  private int jj_ntk;
+  private int jj_gen;
+  final private int[] jj_la1 = new int[6];
+  static private int[] jj_la1_0;
+  static private int[] jj_la1_1;
+  static {
+      jj_la1_0();
+      jj_la1_1();
+   }
+   private static void jj_la1_0() {
+      jj_la1_0 = new int[] {0x2800,0x2800,0x40000000,0x1000,0xffc000,0xffc000,};
+   }
+   private static void jj_la1_1() {
+      jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x1,0x1,};
+   }
+
+  public Rcc(java.io.InputStream stream) {
+     this(stream, null);
+  }
+  public Rcc(java.io.InputStream stream, String encoding) {
+    try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
+    token_source = new RccTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
+  }
+
+  public void ReInit(java.io.InputStream stream) {
+     ReInit(stream, null);
+  }
+  public void ReInit(java.io.InputStream stream, String encoding) {
+    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
+    token_source.ReInit(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
+  }
+
+  public Rcc(java.io.Reader stream) {
+    jj_input_stream = new SimpleCharStream(stream, 1, 1);
+    token_source = new RccTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
+  }
+
+  public void ReInit(java.io.Reader stream) {
+    jj_input_stream.ReInit(stream, 1, 1);
+    token_source.ReInit(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
+  }
+
+  public Rcc(RccTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
+  }
+
+  public void ReInit(RccTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
+  }
+
+  final private Token jj_consume_token(int kind) throws ParseException {
+    Token oldToken;
+    if ((oldToken = token).next != null) token = token.next;
+    else token = token.next = token_source.getNextToken();
+    jj_ntk = -1;
+    if (token.kind == kind) {
+      jj_gen++;
+      return token;
+    }
+    token = oldToken;
+    jj_kind = kind;
+    throw generateParseException();
+  }
+
+  final public Token getNextToken() {
+    if (token.next != null) token = token.next;
+    else token = token.next = token_source.getNextToken();
+    jj_ntk = -1;
+    jj_gen++;
+    return token;
+  }
+
+  final public Token getToken(int index) {
+    Token t = token;
+    for (int i = 0; i < index; i++) {
+      if (t.next != null) t = t.next;
+      else t = t.next = token_source.getNextToken();
+    }
+    return t;
+  }
+
+  final private int jj_ntk() {
+    if ((jj_nt=token.next) == null)
+      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+    else
+      return (jj_ntk = jj_nt.kind);
+  }
+
+  private java.util.Vector jj_expentries = new java.util.Vector();
+  private int[] jj_expentry;
+  private int jj_kind = -1;
+
+  public ParseException generateParseException() {
+    jj_expentries.removeAllElements();
+    boolean[] la1tokens = new boolean[33];
+    for (int i = 0; i < 33; i++) {
+      la1tokens[i] = false;
+    }
+    if (jj_kind >= 0) {
+      la1tokens[jj_kind] = true;
+      jj_kind = -1;
+    }
+    for (int i = 0; i < 6; i++) {
+      if (jj_la1[i] == jj_gen) {
+        for (int j = 0; j < 32; j++) {
+          if ((jj_la1_0[i] & (1<<j)) != 0) {
+            la1tokens[j] = true;
+          }
+          if ((jj_la1_1[i] & (1<<j)) != 0) {
+            la1tokens[32+j] = true;
+          }
+        }
+      }
+    }
+    for (int i = 0; i < 33; i++) {
+      if (la1tokens[i]) {
+        jj_expentry = new int[1];
+        jj_expentry[0] = i;
+        jj_expentries.addElement(jj_expentry);
+      }
+    }
+    int[][] exptokseq = new int[jj_expentries.size()][];
+    for (int i = 0; i < jj_expentries.size(); i++) {
+      exptokseq[i] = (int[])jj_expentries.elementAt(i);
+    }
+    return new ParseException(token, exptokseq, tokenImage);
+  }
+
+  final public void enable_tracing() {
+  }
+
+  final public void disable_tracing() {
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/29cc5c1a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/RccConstants.java
----------------------------------------------------------------------
diff --git a/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/RccConstants.java b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/RccConstants.java
new file mode 100644
index 0000000..9640efb
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/generated/RccConstants.java
@@ -0,0 +1,88 @@
+/* Generated By:JavaCC: Do not edit this line. RccConstants.java */
+/**
+ * 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.jute.compiler.generated;
+
+public interface RccConstants {
+
+  int EOF = 0;
+  int MODULE_TKN = 11;
+  int RECORD_TKN = 12;
+  int INCLUDE_TKN = 13;
+  int BYTE_TKN = 14;
+  int BOOLEAN_TKN = 15;
+  int INT_TKN = 16;
+  int LONG_TKN = 17;
+  int FLOAT_TKN = 18;
+  int DOUBLE_TKN = 19;
+  int USTRING_TKN = 20;
+  int BUFFER_TKN = 21;
+  int VECTOR_TKN = 22;
+  int MAP_TKN = 23;
+  int LBRACE_TKN = 24;
+  int RBRACE_TKN = 25;
+  int LT_TKN = 26;
+  int GT_TKN = 27;
+  int SEMICOLON_TKN = 28;
+  int COMMA_TKN = 29;
+  int DOT_TKN = 30;
+  int CSTRING_TKN = 31;
+  int IDENT_TKN = 32;
+
+  int DEFAULT = 0;
+  int WithinOneLineComment = 1;
+  int WithinMultiLineComment = 2;
+
+  String[] tokenImage = {
+    "<EOF>",
+    "\" \"",
+    "\"\\t\"",
+    "\"\\n\"",
+    "\"\\r\"",
+    "\"//\"",
+    "<token of kind 6>",
+    "<token of kind 7>",
+    "\"/*\"",
+    "\"*/\"",
+    "<token of kind 10>",
+    "\"module\"",
+    "\"class\"",
+    "\"include\"",
+    "\"byte\"",
+    "\"boolean\"",
+    "\"int\"",
+    "\"long\"",
+    "\"float\"",
+    "\"double\"",
+    "\"ustring\"",
+    "\"buffer\"",
+    "\"vector\"",
+    "\"map\"",
+    "\"{\"",
+    "\"}\"",
+    "\"<\"",
+    "\">\"",
+    "\";\"",
+    "\",\"",
+    "\".\"",
+    "<CSTRING_TKN>",
+    "<IDENT_TKN>",
+  };
+
+}