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/03 09:57:57 UTC

[1/6] zookeeper git commit: ZOOKEEPER-3080: MAVEN MIGRATION - Step 1.5 - move jute dir

Repository: zookeeper
Updated Branches:
  refs/heads/master 4d7b9e8f3 -> b7181d2c5


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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..2533ddf
--- /dev/null
+++ b/zookeeper-jute/src/main/resources/zookeeper.jute
@@ -0,0 +1,322 @@
+/**
+ * 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
+    }
+}
+
+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 ReconfigRequest {
+        ustring joiningServers;
+        ustring leavingServers;
+        ustring newMembers;
+        long curConfigId;
+    }
+    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 CreateTTLRequest {
+        ustring path;
+        buffer data;
+        vector<org.apache.zookeeper.data.ACL> acl;
+        int flags;
+        long ttl;
+    }
+    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 Create2Response {
+        ustring path;
+        org.apache.zookeeper.data.Stat stat;
+    }
+    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;
+    }
+    class CheckWatchesRequest {
+        ustring path;
+        int type;
+    }
+    class RemoveWatchesRequest {
+        ustring path;
+        int type;
+    }
+}
+
+module org.apache.zookeeper.server.quorum {
+    class LearnerInfo {
+        long serverid;
+        int protocolVersion;
+        long configVersion;
+    }
+    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 CreateTTLTxn {
+        ustring path;
+        buffer data;
+        vector<org.apache.zookeeper.data.ACL> acl;
+        int parentCVersion;
+        long ttl;
+    }
+    class CreateContainerTxn {
+        ustring path;
+        buffer data;
+        vector<org.apache.zookeeper.data.ACL> acl;
+        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/b7181d2c/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..52fdae9
--- /dev/null
+++ b/zookeeper-jute/src/test/java/org/apache/jute/BinaryInputArchiveTest.java
@@ -0,0 +1,44 @@
+/**
+ * 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 org.junit.Assert;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+
+// TODO: introduce JuteTestCase as in ZKTestCase
+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));
+        }
+    }
+}


[2/6] zookeeper git commit: ZOOKEEPER-3080: MAVEN MIGRATION - Step 1.5 - move jute dir

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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..6ba844d
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JRecord.java
@@ -0,0 +1,762 @@
+/**
+ * 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;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ */
+public class JRecord extends JCompType {
+
+    private String mFQName;
+    private String mName;
+    private String mModule;
+    private List<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 List<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 Map<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.");
+        }
+        try (FileWriter jj = new FileWriter(new File(pkgdir, getName()+".java"))) {
+            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");
+        }
+    }
+
+    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.");
+        }
+
+        try (FileWriter cs = new FileWriter(new File(outputDirectory, getName() + ".cs"));) {
+            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");
+
+            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/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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..250ff56
--- /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.Iterator;
+import java.util.List;
+
+/**
+ * Java Code generator front-end for Hadoop record I/O.
+ */
+class JavaGenerator {
+    private List<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, List<JFile> incl,
+            List<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/b7181d2c/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/b7181d2c/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/b7181d2c/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>


[3/6] zookeeper git commit: ZOOKEEPER-3080: MAVEN MIGRATION - Step 1.5 - move jute dir

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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..5f78ea9
--- /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 all 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/b7181d2c/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/b7181d2c/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..5f24f56
--- /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<String, Method> archiveFactory;
+    
+    static {
+        archiveFactory = new HashMap<String, Method>();
+
+        try {
+            archiveFactory.put("binary",
+                    BinaryInputArchive.class.getDeclaredMethod(
+                        "getArchive", new Class[]{ InputStream.class } ));
+            archiveFactory.put("csv",
+                    CsvInputArchive.class.getDeclaredMethod(
+                        "getArchive", new Class[]{ InputStream.class }));
+            archiveFactory.put("xml",
+                    XmlInputArchive.class.getDeclaredMethod(
+                        "getArchive", new Class[]{ InputStream.class }));
+        } 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/b7181d2c/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..a400775
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/RecordWriter.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.OutputStream;
+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 HashMap<String, Method> constructFactory() {
+        HashMap<String, Method> factory = new HashMap<String, Method>();
+
+        try {
+            factory.put("binary",
+                    BinaryOutputArchive.class.getDeclaredMethod(
+                        "getArchive", new Class[]{ OutputStream.class }));
+            factory.put("csv",
+                    CsvOutputArchive.class.getDeclaredMethod(
+                        "getArchive", new Class[]{ OutputStream.class }));
+            factory.put("xml",
+                    XmlOutputArchive.class.getDeclaredMethod(
+                        "getArchive", new Class[]{ OutputStream.class }));
+        } catch (SecurityException ex) {
+            ex.printStackTrace();
+        } catch (NoSuchMethodException ex) {
+            ex.printStackTrace();
+        }
+        return factory;
+    }
+    
+    static private HashMap<String, Method> 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/b7181d2c/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/b7181d2c/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/b7181d2c/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..8c7afe4
--- /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/b7181d2c/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..ef5dd54
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/CGenerator.java
@@ -0,0 +1,129 @@
+/**
+ * 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.Iterator;
+import java.util.List;
+
+/**
+ * C++ Code generator front-end for Hadoop record I/O.
+ */
+class CGenerator {
+    private String mName;
+    private List<JFile> mInclFiles;
+    private List<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, List<JFile> ilist, List<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);
+            }
+        }
+
+        try (FileWriter c = new FileWriter(new File(outputDirectory, mName + ".c"));
+             FileWriter 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");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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..f59cdb2
--- /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.List;
+
+public class CSharpGenerator {
+    private List<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, List<JFile> ilist, List<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/b7181d2c/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..3f5ccb3
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/CppGenerator.java
@@ -0,0 +1,124 @@
+/**
+ * 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.Iterator;
+import java.util.List;
+
+/**
+ * C++ Code generator front-end for Hadoop record I/O.
+ */
+class CppGenerator {
+    private String mName;
+    private List<JFile> mInclFiles;
+    private List<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, List<JFile> ilist, List<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);
+            }
+        }
+
+        try (FileWriter cc = new FileWriter(new File(outputDirectory, mName + ".cc"));
+             FileWriter 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");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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..ae59490
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/compiler/JFile.java
@@ -0,0 +1,85 @@
+/**
+ * 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.List;
+
+/**
+ * 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 List<JFile> mInclFiles;
+    private List<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/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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);
+    }
+}


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

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

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

Reviewers: andor@apache.org

Closes #609 from nkalmar/ZOOKEEPER-3080


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

Branch: refs/heads/master
Commit: b7181d2c5a48accbd47e30430ccfe1291a91d900
Parents: 4d7b9e8
Author: Norbert Kalmar <nk...@yahoo.com>
Authored: Mon Sep 3 11:57:50 2018 +0200
Committer: Andor Molnar <an...@apache.org>
Committed: Mon Sep 3 11:57:50 2018 +0200

----------------------------------------------------------------------
 build.xml                                       |  35 +-
 .../org/apache/jute/BinaryInputArchive.java     | 130 ---
 .../org/apache/jute/BinaryOutputArchive.java    | 146 ----
 .../main/org/apache/jute/CsvInputArchive.java   | 204 -----
 .../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 |  93 ---
 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    | 129 ---
 .../apache/jute/compiler/CSharpGenerator.java   |  53 --
 .../org/apache/jute/compiler/CppGenerator.java  | 124 ---
 .../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    |  85 --
 .../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  | 762 ------------------
 .../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 --
 .../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 |  44 -
 src/zookeeper.jute                              | 322 --------
 .../org/apache/jute/BinaryInputArchive.java     | 130 +++
 .../org/apache/jute/BinaryOutputArchive.java    | 146 ++++
 .../java/org/apache/jute/CsvInputArchive.java   | 204 +++++
 .../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 |  93 +++
 .../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    | 129 +++
 .../apache/jute/compiler/CSharpGenerator.java   |  53 ++
 .../org/apache/jute/compiler/CppGenerator.java  | 124 +++
 .../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    |  85 ++
 .../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  | 762 ++++++++++++++++++
 .../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 ++
 .../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           | 322 ++++++++
 .../org/apache/jute/BinaryInputArchiveTest.java |  44 +
 77 files changed, 5699 insertions(+), 5678 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 0d72472..18eb104 100644
--- a/build.xml
+++ b/build.xml
@@ -90,6 +90,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
 
     <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" />
@@ -108,7 +109,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
     <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" />
@@ -118,6 +119,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
     <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" />
@@ -309,7 +311,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
       <ivy:artifactproperty name="[artifact].revision" value="[revision]" />
       <move file="${ivy.javacc.lib}/javacc-${javacc.revision}.jar" tofile="${ivy.javacc.lib}/javacc.jar" failonerror="false"/>
       <javacc
-          target="${java.src.dir}${jute_javacc.packagedir}/rcc.jj"
+          target="${basedir}/zookeeper-jute/src/main/java${jute_javacc.packagedir}/rcc.jj"
           outputdirectory="${jute_javacc.dir}${jute_javacc.packagedir}/"
           javacchome="${ivy.javacc.lib}"
           />
@@ -319,7 +321,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
         <javac srcdir="${jute_javacc.dir}" destdir="${build.classes}" includeantruntime="false"
             target="${javac.target}" source="${javac.source}"
             includes="org/apache/jute/**" debug="on" encoding="${build.encoding}" classpath="${ivy.lib}/audience-annotations-${audience-annotations.version}.jar">
-          <src path="${java.src.dir}" />
+          <src path="${basedir}/zookeeper-jute/src/main/java" />
           <src path="${jute_javacc.dir}" />
         </javac>
     </target>
@@ -336,7 +338,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
         <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}" />
                 <pathelement path="${jute_javacc.dir}" />
@@ -346,7 +348,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
         <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>
@@ -486,8 +488,10 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
       <ivy:cachepath pathid="mvn-ant-task-classpath" conf="mvn-ant-task"/>
     </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" encoding="${build.encoding}">
+            <src path="${java.src.dir}"/>
+            <src path="${jute.src.dir}"/>
             <classpath refid="java.classpath"/>
             <compilerarg value="-Xlint:all"/>
             <compilerarg value="-Xlint:-path"/>
@@ -496,8 +500,10 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
 
     <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" encoding="${build.encoding}">
+        <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"
@@ -607,6 +613,9 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
           <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"/>
@@ -653,6 +662,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
             <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" />
@@ -727,6 +737,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
         <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}"/>
@@ -877,6 +888,7 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
           <include name="zookeeper-docs/**"/>
           <include name="zookeeper-contrib/**"/>
           <include name="zookeeper-client/**"/>
+          <include name="zookeeper-jute/**"/>
         </fileset>
         <fileset file="src/pom.template"/>
       </copy>
@@ -1270,6 +1282,9 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
         <include name="**/*${test.category}Test.java" />
         <exclude name="**/*HammerTest.java" />
       </fileset>
+      <fileset id="jutetest.files" dir="${jute.test.src.dir}">
+        <include name="**/*${test.category}Test.java" />
+      </fileset>
       <fileset id="fulltest.files" dir="${test.src.dir}">
         <include name="**/*${test.category}Test.java" />
       </fileset>
@@ -1297,9 +1312,11 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
           <formatter type="${test.junit.output.format}" />
           <batchtest todir="${test.log.dir}" if="quicktest">
             <fileset refid="quicktest.files" />
+            <fileset refid="jutetest.files" />
           </batchtest>
           <batchtest todir="${test.log.dir}" if="fulltest">
             <fileset refid="fulltest.files" />
+            <fileset refid="jutetest.files" />
           </batchtest>
           <batchtest todir="${test.log.dir}" if="testcase">
             <fileset refid="testcase.files" />
@@ -1327,9 +1344,11 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
           <formatter type="${test.junit.output.format}" />
           <batchtest todir="${test.log.dir}" if="quicktest">
             <fileset refid="quicktest.files" />
+            <fileset refid="jutetest.files" />
           </batchtest>
           <batchtest todir="${test.log.dir}" if="fulltest">
             <fileset refid="fulltest.files" />
+            <fileset refid="jutetest.files" />
           </batchtest>
           <batchtest todir="${test.log.dir}" if="testcase">
             <fileset refid="testcase.files" />
@@ -1940,6 +1959,8 @@ xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
          <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/b7181d2c/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/b7181d2c/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 a8f313c..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/b7181d2c/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 e1613ca..0000000
--- a/src/java/main/org/apache/jute/CsvInputArchive.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;
-
-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 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/b7181d2c/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 df1c9f8..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/b7181d2c/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/b7181d2c/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/b7181d2c/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 5f78ea9..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 all 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/b7181d2c/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/b7181d2c/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 5f24f56..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<String, Method> archiveFactory;
-    
-    static {
-        archiveFactory = new HashMap<String, Method>();
-
-        try {
-            archiveFactory.put("binary",
-                    BinaryInputArchive.class.getDeclaredMethod(
-                        "getArchive", new Class[]{ InputStream.class } ));
-            archiveFactory.put("csv",
-                    CsvInputArchive.class.getDeclaredMethod(
-                        "getArchive", new Class[]{ InputStream.class }));
-            archiveFactory.put("xml",
-                    XmlInputArchive.class.getDeclaredMethod(
-                        "getArchive", new Class[]{ InputStream.class }));
-        } 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/b7181d2c/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 a400775..0000000
--- a/src/java/main/org/apache/jute/RecordWriter.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.OutputStream;
-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 HashMap<String, Method> constructFactory() {
-        HashMap<String, Method> factory = new HashMap<String, Method>();
-
-        try {
-            factory.put("binary",
-                    BinaryOutputArchive.class.getDeclaredMethod(
-                        "getArchive", new Class[]{ OutputStream.class }));
-            factory.put("csv",
-                    CsvOutputArchive.class.getDeclaredMethod(
-                        "getArchive", new Class[]{ OutputStream.class }));
-            factory.put("xml",
-                    XmlOutputArchive.class.getDeclaredMethod(
-                        "getArchive", new Class[]{ OutputStream.class }));
-        } catch (SecurityException ex) {
-            ex.printStackTrace();
-        } catch (NoSuchMethodException ex) {
-            ex.printStackTrace();
-        }
-        return factory;
-    }
-    
-    static private HashMap<String, Method> 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/b7181d2c/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/b7181d2c/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/b7181d2c/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 8c7afe4..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/b7181d2c/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 ef5dd54..0000000
--- a/src/java/main/org/apache/jute/compiler/CGenerator.java
+++ /dev/null
@@ -1,129 +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.Iterator;
-import java.util.List;
-
-/**
- * C++ Code generator front-end for Hadoop record I/O.
- */
-class CGenerator {
-    private String mName;
-    private List<JFile> mInclFiles;
-    private List<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, List<JFile> ilist, List<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);
-            }
-        }
-
-        try (FileWriter c = new FileWriter(new File(outputDirectory, mName + ".c"));
-             FileWriter 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");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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 f59cdb2..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.List;
-
-public class CSharpGenerator {
-    private List<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, List<JFile> ilist, List<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);
-        }
-    }
-}


[5/6] zookeeper git commit: ZOOKEEPER-3080: MAVEN MIGRATION - Step 1.5 - move jute dir

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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 3f5ccb3..0000000
--- a/src/java/main/org/apache/jute/compiler/CppGenerator.java
+++ /dev/null
@@ -1,124 +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.Iterator;
-import java.util.List;
-
-/**
- * C++ Code generator front-end for Hadoop record I/O.
- */
-class CppGenerator {
-    private String mName;
-    private List<JFile> mInclFiles;
-    private List<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, List<JFile> ilist, List<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);
-            }
-        }
-
-        try (FileWriter cc = new FileWriter(new File(outputDirectory, mName + ".cc"));
-             FileWriter 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");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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 ae59490..0000000
--- a/src/java/main/org/apache/jute/compiler/JFile.java
+++ /dev/null
@@ -1,85 +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.List;
-
-/**
- * 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 List<JFile> mInclFiles;
-    private List<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/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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 6ba844d..0000000
--- a/src/java/main/org/apache/jute/compiler/JRecord.java
+++ /dev/null
@@ -1,762 +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;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- */
-public class JRecord extends JCompType {
-
-    private String mFQName;
-    private String mName;
-    private String mModule;
-    private List<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 List<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 Map<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.");
-        }
-        try (FileWriter jj = new FileWriter(new File(pkgdir, getName()+".java"))) {
-            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");
-        }
-    }
-
-    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.");
-        }
-
-        try (FileWriter cs = new FileWriter(new File(outputDirectory, getName() + ".cs"));) {
-            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");
-
-            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/b7181d2c/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/b7181d2c/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";
-    }
-}


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

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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/b7181d2c/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 250ff56..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.Iterator;
-import java.util.List;
-
-/**
- * Java Code generator front-end for Hadoop record I/O.
- */
-class JavaGenerator {
-    private List<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, List<JFile> incl,
-            List<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/b7181d2c/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>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/b7181d2c/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/b7181d2c/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/b7181d2c/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/b7181d2c/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 52fdae9..0000000
--- a/src/java/test/org/apache/jute/BinaryInputArchiveTest.java
+++ /dev/null
@@ -1,44 +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 org.junit.Assert;
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-
-// TODO: introduce JuteTestCase as in ZKTestCase
-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/b7181d2c/src/zookeeper.jute
----------------------------------------------------------------------
diff --git a/src/zookeeper.jute b/src/zookeeper.jute
deleted file mode 100644
index 2533ddf..0000000
--- a/src/zookeeper.jute
+++ /dev/null
@@ -1,322 +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
-    }
-}
-
-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 ReconfigRequest {
-        ustring joiningServers;
-        ustring leavingServers;
-        ustring newMembers;
-        long curConfigId;
-    }
-    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 CreateTTLRequest {
-        ustring path;
-        buffer data;
-        vector<org.apache.zookeeper.data.ACL> acl;
-        int flags;
-        long ttl;
-    }
-    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 Create2Response {
-        ustring path;
-        org.apache.zookeeper.data.Stat stat;
-    }
-    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;
-    }
-    class CheckWatchesRequest {
-        ustring path;
-        int type;
-    }
-    class RemoveWatchesRequest {
-        ustring path;
-        int type;
-    }
-}
-
-module org.apache.zookeeper.server.quorum {
-    class LearnerInfo {
-        long serverid;
-        int protocolVersion;
-        long configVersion;
-    }
-    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 CreateTTLTxn {
-        ustring path;
-        buffer data;
-        vector<org.apache.zookeeper.data.ACL> acl;
-        int parentCVersion;
-        long ttl;
-    }
-    class CreateContainerTxn {
-        ustring path;
-        buffer data;
-        vector<org.apache.zookeeper.data.ACL> acl;
-        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/b7181d2c/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/b7181d2c/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..a8f313c
--- /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/b7181d2c/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..e1613ca
--- /dev/null
+++ b/zookeeper-jute/src/main/java/org/apache/jute/CsvInputArchive.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;
+
+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 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/b7181d2c/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..df1c9f8
--- /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/b7181d2c/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/b7181d2c/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;
+}