Repository: incubator-reef Updated Branches: refs/heads/REEF-395 [created] a5bfae411
Define schema and configure avro string to use String instead of CharSequence Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/7d4baf0f Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/7d4baf0f Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/7d4baf0f Branch: refs/heads/REEF-395 Commit: 7d4baf0f4298ec5de18ac374cbe4a9163efd52a9 Parents: 9964d5d Author: Yunseong Lee <[email protected]> Authored: Fri Jun 19 17:22:11 2015 +0900 Committer: Yunseong Lee <[email protected]> Committed: Fri Jun 19 17:22:11 2015 +0900 ---------------------------------------------------------------------- .../tang/src/main/avro/class_hierarchy.avsc | 120 +++++++++++++++++++ pom.xml | 3 + 2 files changed, 123 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7d4baf0f/lang/java/reef-tang/tang/src/main/avro/class_hierarchy.avsc ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/main/avro/class_hierarchy.avsc b/lang/java/reef-tang/tang/src/main/avro/class_hierarchy.avsc new file mode 100644 index 0000000..198c70d --- /dev/null +++ b/lang/java/reef-tang/tang/src/main/avro/class_hierarchy.avsc @@ -0,0 +1,120 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +[ +{ + "namespace":"org.apache.reef.tang.formats.avro", + "type":"record", + "name":"AvroConstructorArg", + "fields":[ + {"name":"fullArgClassName", "type":"string"}, + {"name":"namedParameterName", "type":"string"}, + {"name":"isInjectionFuture", "type":"boolean"} + ] +}, +{ + "namespace":"org.apache.reef.tang.formats.avro", + "type":"record", + "name":"AvroConstructorDef", + "fields":[ + {"name":"fullArgClassName", "type":"string"}, + {"name":"constructorArg", "type":{"type":"array", "items":"AvroConstructorArg"}} + ] +}, +{ + "namespace":"org.apache.reef.tang.formats.avro", + "type":"record", + "name":"AvroNamedParameterNode", + "fields":[ + {"name":"simpleArgClassName", "type":"string"}, + {"name":"fullArgClassName", "type":"string"}, + {"name":"isSet", "type":"boolean"}, + {"name":"isList", "type":"boolean"}, + {"name":"documentation", "type":["null", "string"]}, + {"name":"shortName", "type":["null", "string"]}, + {"name":"instanceDefault", "type":{"type":"array","items":"string"}} + ] +}, +{ + "namespace":"org.apache.reef.tang.formats.avro", + "type":"record", + "name":"AvroClassNode", + "fields":[ + {"name":"isInjectionCandidate", "type":"boolean"}, + {"name":"isExternalConstructor", "type":"boolean"}, + {"name":"isUnit", "type":"boolean"}, + {"name":"injectableConstructors", "type":{"type":"array", "items":"AvroConstructorDef"}}, + {"name":"otherConstructors", "type":{"type":"array", "items":"AvroConstructorDef"}}, + {"name":"implFullNames", "type":{"type":"array", "items":"string"}}, + {"name":"defaultImplementation", "type":["null", "string"]} + ] +}, +/* + Intentionally left blank. Packages don't have any interesting + attributes except their names and children. +*/ +{ + "namespace":"org.apache.reef.tang.formats.avro", + "type":"record", + "name":"AvroPackageNode", + "fields":[] +}, +/* + Node is the abstract base type for all the data encoded in a class hierarchy. + It is represented as an (un)tagged union, so only one of the three optional + fields can be non-null. + */ +{ + "namespace":"org.apache.reef.tang.formats.avro", + "type":"record", + "name":"AvroNode", + "fields":[ + /* + The short name of this node (e.g., a class name without the enclosing + package, or a package name without the name of the enclosing package. + */ + {"name":"name", "type":"string"}, + /* + For some languages it can be difficult to map from a list of nodes to + the correct short name, so for now, the full name is (redundantly) + encoded here. In Java, the full name is a bunch of short names that + have been concatenated with "." and/or "$". + */ + {"name":"fullName", "type":"string"}, + + /* + * Exactly one of the next three fields must be defined. See below for + * their documentation. + */ + {"name":"classNode", "type":["null", "AvroClassNode"]}, + {"name":"namedParameterNode", "type":["null", "AvroNamedParameterNode"]}, + {"name":"packageNode", "type":["null", "AvroPackageNode"]}, + + /* + Class hierarchy nodes are arranged in a tree that mirrors the language + namespaces / packages that contain class names (e.g., Java packages, + C++ namespaces). + + A NamedParameterNode cannot have any children. A ClassNode can not have + any package nodes as children. PackageNodes cannot have PackageNodes as + children. + */ + {"name":"children", "type":{"type":"array","items":"AvroNode"}} + ] +} +] http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/7d4baf0f/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 60f50e8..1cbdde3 100644 --- a/pom.xml +++ b/pom.xml @@ -211,6 +211,9 @@ under the License. <groupId>org.apache.avro</groupId> <artifactId>avro-maven-plugin</artifactId> <version>${avro.version}</version> + <configuration> + <stringType>String</stringType> + </configuration> <executions> <execution> <phase>generate-sources</phase>
