Database Reference
In-Depth Information
<protocol destdir="${interface.avro.dir}">
<fileset dir="${interface.dir}">
<include name="**/*.avpr" />
</fileset>
</protocol>
<schema destdir="${interface.avro.dir}">
<fileset dir="${interface.dir}">
<include name="**/*.avsc" />
</fileset>
</schema>
</target>
The Ant tasks for Thrift generation directly ran the Thrift executable (as you would on the com-
mand line). But the Avro targets are more complex. The check-avro-generate target uses a
custom property called avroUpToDate . The avro-generate target does not run if it is determ-
ined by the check-avro-generate task that all of the files are up to date already. If the gen-
erated client API files are not up to date with the current schema, then the cassandra.avprile
will be reread and will generate the sources again under <CASSANDRA_HOME>/interface/av-
ro. The org.apache.cassandra.avro.Cassandra.java file represents the runtime Java Av-
ro interface.
The Ant <taskdef> tag defines custom extension tasks that subsequent targets can execute.
Here we see two: the SchemaTask and the ParanamerGeneratorTask . The SchemaTask is part
of Avro itself, and is used to generate a Java interface and classes for the described protocol.
The ParaNamer library (paranamer-generator-2.1.jar) is used to allow the parameter names of
nonprivate methods and constructors—which are typically dropped by the compiler—to be ac-
cessed at runtime. It reads the source directory of Avro-generated Java classes and outputs to the
builddirectory Java classes that maintain the names defined in the source.
Avro Speciication
The Avro project defines a specification, so you could theoretically write your own implementa-
tion of the Avro spec. Avro supports six kinds of complex types: records, enums, arrays, maps,
unions, and fixed.
NOTE
If you're interested, you can read the complete Avro specification at http://avro.apache.org/docs/current/
spec.html , though it is definitely not required to work with Cassandra.
Search WWH ::




Custom Search