Author: lewismc
Date: Thu Jan 23 21:39:40 2014
New Revision: 1560819
URL: http://svn.apache.org/r1560819
Log:
GORA-94 GORA-94v12.patch
Modified:
gora/branches/GORA_94/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
gora/branches/GORA_94/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/TokenDatum.java
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
Modified:
gora/branches/GORA_94/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
URL:
http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java?rev=1560819&r1=1560818&r2=1560819&view=diff
==============================================================================
---
gora/branches/GORA_94/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
(original)
+++
gora/branches/GORA_94/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
Thu Jan 23 21:39:40 2014
@@ -92,7 +92,7 @@ public class GoraCompiler extends Specif
return "value";
}
}
-
+
public static String generateAppropriateWrapperOrValueForPut(Schema schema) {
switch (schema.getType()) {
case MAP:
@@ -105,7 +105,7 @@ public class GoraCompiler extends Specif
return "value";
}
}
-
+
public static String generateAppropriateWrapper(Schema schema, Field field) {
if (field.name() == "__g__dirty") {
return "java.nio.ByteBuffer.wrap(new byte["
@@ -138,6 +138,24 @@ public class GoraCompiler extends Specif
}
}
+ /** Recognizes camel case */
+ public static String toUpperCase(String s) {
+ StringBuilder builder = new StringBuilder();
+
+ for (int i = 0; i < s.length(); i++) {
+ if (i > 0) {
+ if (Character.isUpperCase(s.charAt(i))
+ && Character.isLowerCase(s.charAt(i - 1))
+ && Character.isLetter(s.charAt(i))) {
+ builder.append("_");
+ }
+ }
+ builder.append(Character.toUpperCase(s.charAt(i)));
+ }
+
+ return builder.toString();
+ }
+
private static int getNumberOfBytesNeededForDirtyBits(Schema originalSchema)
{
return (int) Math.ceil((originalSchema.getFields().size() + 1) * 0.125);
}
Modified:
gora/branches/GORA_94/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
URL:
http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm?rev=1560819&r1=1560818&r2=1560819&view=diff
==============================================================================
---
gora/branches/GORA_94/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
(original)
+++
gora/branches/GORA_94/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
Thu Jan 23 21:39:40 2014
@@ -16,7 +16,7 @@
## limitations under the License.
##
#if ($schema.getNamespace())
-package $schema.getNamespace();
+package $schema.getNamespace();
#end
@SuppressWarnings("all")
#if ($schema.getDoc())
@@ -24,6 +24,57 @@ package $schema.getNamespace();
#end
public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends
org.apache.avro.specific.SpecificExceptionBase#else extends
org.apache.gora.persistency.impl.PersistentBase#end implements
org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent
{
public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("${this.javaEscape($schema.toString())}");
+
+ /** Enum containing all data bean's fields. */
+ public static enum Field {
+#set ($i = 0)
+#foreach ($field in $schema.getFields())
+ ${this.toUpperCase($field.name())}($i, "${this.mangle($field.name(),
$schema.isError())}"),
+#set ($i = $i + 1)
+#end
+ ;
+ /**
+ * Field's index.
+ */
+ private int index;
+
+ /**
+ * Field's name.
+ */
+ private String name;
+
+ /**
+ * Field's constructor
+ * @param index field's index.
+ * @param name field's name.
+ */
+ Field(int index, String name) {this.index=index;this.name=name;}
+
+ /**
+ * Gets field's index.
+ * @return int field's index.
+ */
+ public int getIndex() {return index;}
+
+ /**
+ * Gets field's name.
+ * @return String field's name.
+ */
+ public String getName() {return name;}
+
+ /**
+ * Gets field's attributes to string.
+ * @return String field's attributes to string.
+ */
+ public String toString() {return name;}
+ };
+
+ public static final String[] _ALL_FIELDS = {
+#foreach ($field in $schema.getFields())
+ "${this.mangle($field.name(), $schema.isError())}",
+#end
+ };
+
#foreach ($field in $schema.getFields())
#if ($field.doc())
/** $field.doc() */
@@ -35,7 +86,7 @@ public class ${this.mangle($schema.getNa
public ${this.mangle($schema.getName())}() {
super();
}
-
+
public ${this.mangle($schema.getName())}(Object value) {
super(value);
}
@@ -50,7 +101,7 @@ public class ${this.mangle($schema.getNa
#end
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
- // Used by DatumWriter. Applications should not call.
+ // Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
switch (field$) {
#set ($i = 0)
@@ -61,8 +112,8 @@ public class ${this.mangle($schema.getNa
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
-
- // Used by DatumReader. Applications should not call.
+
+ // Used by DatumReader. Applications should not call.
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value) {
switch (field$) {
@@ -94,7 +145,7 @@ public class ${this.mangle($schema.getNa
this.${this.mangle($field.name(), $schema.isError())} =
${this.generateAppropriateWrapperOrValue($field.schema())};
setDirty(${field.pos()});
}
-
+
/**
* Checks the dirty status of the '${this.mangle($field.name(),
$schema.isError())}' field. A field is dirty if it represents a change that has
not yet been written to the database.
#if ($field.doc()) * $field.doc()#end
@@ -110,17 +161,17 @@ public class ${this.mangle($schema.getNa
public static #if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder
newBuilder() {
return new #if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder();
}
-
+
/** Creates a new ${this.mangle($schema.getName())} RecordBuilder by copying
an existing Builder */
public static #if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder
newBuilder(#if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder
other) {
return new #if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder(other);
}
-
+
/** Creates a new ${this.mangle($schema.getName())} RecordBuilder by copying
an existing $this.mangle($schema.getName()) instance */
public static #if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder
newBuilder(#if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}
other) {
return new #if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder(other);
}
-
+
private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
java.nio.ByteBuffer input) {
java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
@@ -143,7 +194,7 @@ public class ${this.mangle($schema.getNa
copy.limit(limit);
return copy.asReadOnlyBuffer();
}
-
+
/**
* RecordBuilder for ${this.mangle($schema.getName())} instances.
*/
@@ -159,12 +210,12 @@ public class ${this.mangle($schema.getNa
private Builder() {
super(#if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.SCHEMA$);
}
-
+
/** Creates a Builder by copying an existing Builder */
private Builder(#if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder
other) {
super(other);
}
-
+
/** Creates a Builder by copying an existing
$this.mangle($schema.getName()) instance */
private Builder(#if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}
other) {
#if ($schema.isError())super(other)#else
@@ -183,7 +234,7 @@ public class ${this.mangle($schema.getNa
super.setValue(value);
return this;
}
-
+
@Override
public #if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder
clearValue() {
super.clearValue();
@@ -195,7 +246,7 @@ public class ${this.mangle($schema.getNa
super.setCause(cause);
return this;
}
-
+
@Override
public #if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder
clearCause() {
super.clearCause();
@@ -209,20 +260,20 @@ public class ${this.mangle($schema.getNa
public ${this.javaType($field.schema())} ${this.generateGetMethod($schema,
$field)}() {
return ${this.mangle($field.name(), $schema.isError())};
}
-
+
/** Sets the value of the '${this.mangle($field.name(),
$schema.isError())}' field */
public #if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder
${this.generateSetMethod($schema, $field)}(${this.javaUnbox($field.schema())}
value) {
validate(fields()[$field.pos()], value);
this.${this.mangle($field.name(), $schema.isError())} = value;
fieldSetFlags()[$field.pos()] = true;
- return this;
+ return this;
}
-
+
/** Checks whether the '${this.mangle($field.name(), $schema.isError())}'
field has been set */
public boolean ${this.generateHasMethod($schema, $field)}() {
return fieldSetFlags()[$field.pos()];
}
-
+
/** Clears the value of the '${this.mangle($field.name(),
$schema.isError())}' field */
public #if
($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder
${this.generateClearMethod($schema, $field)}() {
#if (${this.isUnboxedJavaTypeNullable($field.schema())})
@@ -231,7 +282,7 @@ public class ${this.mangle($schema.getNa
fieldSetFlags()[$field.pos()] = false;
return this;
}
-
+
#end
#end
@Override
@@ -247,7 +298,7 @@ public class ${this.mangle($schema.getNa
}
}
}
-
+
public ${this.mangle($schema.getName())}.Tombstone getTombstone(){
return TOMBSTONE;
}
@@ -257,11 +308,11 @@ public class ${this.mangle($schema.getNa
}
private static final Tombstone TOMBSTONE = new Tombstone();
-
+
public static final class Tombstone extends
${this.mangle($schema.getName())} implements
org.apache.gora.persistency.Tombstone {
-
+
private Tombstone() { }
-
+
#foreach ($field in $schema.getFields())
#if ($this.isNotHiddenField($field.name()))
/**
@@ -271,7 +322,7 @@ public class ${this.mangle($schema.getNa
public ${this.javaType($field.schema())}
${this.generateGetMethod($schema, $field)}() {
throw new java.lang.UnsupportedOperationException("Get is not
supported on tombstones");
}
-
+
/**
* Sets the value of the '${this.mangle($field.name(),
$schema.isError())}' field.
#if ($field.doc()) * $field.doc()#end
@@ -280,7 +331,7 @@ public class ${this.mangle($schema.getNa
public void ${this.generateSetMethod($schema,
$field)}(${this.javaType($field.schema())} value) {
throw new java.lang.UnsupportedOperationException("Set is not
supported on tombstones");
}
-
+
/**
* Checks the dirty status of the '${this.mangle($field.name(),
$schema.isError())}' field. A field is dirty if it represents a change that has
not yet been written to the database.
#if ($field.doc()) * $field.doc()#end
@@ -289,10 +340,10 @@ public class ${this.mangle($schema.getNa
public boolean ${this.generateDirtyMethod($schema,
$field)}(${this.javaType($field.schema())} value) {
throw new java.lang.UnsupportedOperationException("IsDirty is not
supported on tombstones");
}
-
+
#end
#end
-
+
}
-
+
}
\ No newline at end of file
Modified:
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
URL:
http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java?rev=1560819&r1=1560818&r2=1560819&view=diff
==============================================================================
---
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
(original)
+++
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
Thu Jan 23 21:39:40 2014
@@ -6,7 +6,64 @@
package org.apache.gora.examples.generated;
@SuppressWarnings("all")
public class Employee extends org.apache.gora.persistency.impl.PersistentBase
implements org.apache.avro.specific.SpecificRecord,
org.apache.gora.persistency.Persistent {
- public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Employee\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"dateOfBirth\",\"type\":\"long\",\"default\":0},{\"name\":\"ssn\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"salary\",\"type\":\"int\",\"default\":0},{\"name\":\"boss\",\"type\":[\"null\",\"Employee\",\"string\"],\"default\":null},{\"name\":\"webpage\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"WebPage\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"url\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"content\",\"type\":
[\"null\",\"bytes\"],\"default\":null},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":{}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}}]},\"default\":null}]}],\"default\":null}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Employee\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"dateOfBirth\",\"type\":\"long\",\"default\":0},{\"name\":\"ssn\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"salary\",\"type\":\"int\",\"default\":0},{\"name\":\"boss\",\"type\":[\"null\",\"Employee\",\"string\"],\"default\":null},{\"name\":\"webpage\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"WebPage\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"url\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"content\",\"type\":
[\"null\",\"bytes\"],\"default\":null},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":{}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"string\"]},\"default\":{}},{\"name\":\"headers\",\"type\":[\"null\",{\"type\":\"map\",\"values\":[\"null\",\"string\"]}],\"default\":null},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}}]},\"default\":null}]}],\"default\":null}]}");
+
+ /** Enum containing all data bean's fields. */
+ public static enum Field {
+ __G__DIRTY(0, "__g__dirty"),
+ NAME(1, "name"),
+ DATE_OF_BIRTH(2, "dateOfBirth"),
+ SSN(3, "ssn"),
+ SALARY(4, "salary"),
+ BOSS(5, "boss"),
+ WEBPAGE(6, "webpage"),
+ ;
+ /**
+ * Field's index.
+ */
+ private int index;
+
+ /**
+ * Field's name.
+ */
+ private String name;
+
+ /**
+ * Field's constructor
+ * @param index field's index.
+ * @param name field's name.
+ */
+ Field(int index, String name) {this.index=index;this.name=name;}
+
+ /**
+ * Gets field's index.
+ * @return int field's index.
+ */
+ public int getIndex() {return index;}
+
+ /**
+ * Gets field's name.
+ * @return String field's name.
+ */
+ public String getName() {return name;}
+
+ /**
+ * Gets field's attributes to string.
+ * @return String field's attributes to string.
+ */
+ public String toString() {return name;}
+ };
+
+ public static final String[] _ALL_FIELDS = {
+ "__g__dirty",
+ "name",
+ "dateOfBirth",
+ "ssn",
+ "salary",
+ "boss",
+ "webpage",
+ };
+
/** Bytes used to represent weather or not a field is dirty. */
private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new
byte[1]);
private java.lang.CharSequence name;
Modified:
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java
URL:
http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java?rev=1560819&r1=1560818&r2=1560819&view=diff
==============================================================================
---
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java
(original)
+++
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java
Thu Jan 23 21:39:40 2014
@@ -8,6 +8,55 @@ package org.apache.gora.examples.generat
/** Record with only immutable or dirtyable fields, used for testing */
public class ImmutableFields extends
org.apache.gora.persistency.impl.PersistentBase implements
org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent
{
public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ImmutableFields\",\"namespace\":\"org.apache.gora.examples.generated\",\"doc\":\"Record
with only immutable or dirtyable fields, used for
testing\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"v1\",\"type\":\"int\",\"default\":0},{\"name\":\"v2\",\"type\":[{\"type\":\"record\",\"name\":\"V2\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"v3\",\"type\":\"int\",\"default\":0}]},\"null\"],\"default\":null}]}");
+
+ /** Enum containing all data bean's fields. */
+ public static enum Field {
+ __G__DIRTY(0, "__g__dirty"),
+ V1(1, "v1"),
+ V2(2, "v2"),
+ ;
+ /**
+ * Field's index.
+ */
+ private int index;
+
+ /**
+ * Field's name.
+ */
+ private String name;
+
+ /**
+ * Field's constructor
+ * @param index field's index.
+ * @param name field's name.
+ */
+ Field(int index, String name) {this.index=index;this.name=name;}
+
+ /**
+ * Gets field's index.
+ * @return int field's index.
+ */
+ public int getIndex() {return index;}
+
+ /**
+ * Gets field's name.
+ * @return String field's name.
+ */
+ public String getName() {return name;}
+
+ /**
+ * Gets field's attributes to string.
+ * @return String field's attributes to string.
+ */
+ public String toString() {return name;}
+ };
+
+ public static final String[] _ALL_FIELDS = {
+ "__g__dirty",
+ "v1",
+ "v2",
+ };
+
/** Bytes used to represent weather or not a field is dirty. */
private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new
byte[1]);
private int v1;
Modified:
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
URL:
http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java?rev=1560819&r1=1560818&r2=1560819&view=diff
==============================================================================
---
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
(original)
+++
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
Thu Jan 23 21:39:40 2014
@@ -7,6 +7,55 @@ package org.apache.gora.examples.generat
@SuppressWarnings("all")
public class Metadata extends org.apache.gora.persistency.impl.PersistentBase
implements org.apache.avro.specific.SpecificRecord,
org.apache.gora.persistency.Persistent {
public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Metadata\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}}]}");
+
+ /** Enum containing all data bean's fields. */
+ public static enum Field {
+ __G__DIRTY(0, "__g__dirty"),
+ VERSION(1, "version"),
+ DATA(2, "data"),
+ ;
+ /**
+ * Field's index.
+ */
+ private int index;
+
+ /**
+ * Field's name.
+ */
+ private String name;
+
+ /**
+ * Field's constructor
+ * @param index field's index.
+ * @param name field's name.
+ */
+ Field(int index, String name) {this.index=index;this.name=name;}
+
+ /**
+ * Gets field's index.
+ * @return int field's index.
+ */
+ public int getIndex() {return index;}
+
+ /**
+ * Gets field's name.
+ * @return String field's name.
+ */
+ public String getName() {return name;}
+
+ /**
+ * Gets field's attributes to string.
+ * @return String field's attributes to string.
+ */
+ public String toString() {return name;}
+ };
+
+ public static final String[] _ALL_FIELDS = {
+ "__g__dirty",
+ "version",
+ "data",
+ };
+
/** Bytes used to represent weather or not a field is dirty. */
private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new
byte[1]);
private int version;
Modified:
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/TokenDatum.java
URL:
http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/TokenDatum.java?rev=1560819&r1=1560818&r2=1560819&view=diff
==============================================================================
---
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/TokenDatum.java
(original)
+++
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/TokenDatum.java
Thu Jan 23 21:39:40 2014
@@ -7,6 +7,53 @@ package org.apache.gora.examples.generat
@SuppressWarnings("all")
public class TokenDatum extends
org.apache.gora.persistency.impl.PersistentBase implements
org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent
{
public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"TokenDatum\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"count\",\"type\":\"int\",\"default\":0}]}");
+
+ /** Enum containing all data bean's fields. */
+ public static enum Field {
+ __G__DIRTY(0, "__g__dirty"),
+ COUNT(1, "count"),
+ ;
+ /**
+ * Field's index.
+ */
+ private int index;
+
+ /**
+ * Field's name.
+ */
+ private String name;
+
+ /**
+ * Field's constructor
+ * @param index field's index.
+ * @param name field's name.
+ */
+ Field(int index, String name) {this.index=index;this.name=name;}
+
+ /**
+ * Gets field's index.
+ * @return int field's index.
+ */
+ public int getIndex() {return index;}
+
+ /**
+ * Gets field's name.
+ * @return String field's name.
+ */
+ public String getName() {return name;}
+
+ /**
+ * Gets field's attributes to string.
+ * @return String field's attributes to string.
+ */
+ public String toString() {return name;}
+ };
+
+ public static final String[] _ALL_FIELDS = {
+ "__g__dirty",
+ "count",
+ };
+
/** Bytes used to represent weather or not a field is dirty. */
private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new
byte[1]);
private int count;
Modified:
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java
URL:
http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java?rev=1560819&r1=1560818&r2=1560819&view=diff
==============================================================================
---
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java
(original)
+++
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java
Thu Jan 23 21:39:40 2014
@@ -7,6 +7,53 @@ package org.apache.gora.examples.generat
@SuppressWarnings("all")
public class V2 extends org.apache.gora.persistency.impl.PersistentBase
implements org.apache.avro.specific.SpecificRecord,
org.apache.gora.persistency.Persistent {
public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"V2\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"v3\",\"type\":\"int\",\"default\":0}]}");
+
+ /** Enum containing all data bean's fields. */
+ public static enum Field {
+ __G__DIRTY(0, "__g__dirty"),
+ V3(1, "v3"),
+ ;
+ /**
+ * Field's index.
+ */
+ private int index;
+
+ /**
+ * Field's name.
+ */
+ private String name;
+
+ /**
+ * Field's constructor
+ * @param index field's index.
+ * @param name field's name.
+ */
+ Field(int index, String name) {this.index=index;this.name=name;}
+
+ /**
+ * Gets field's index.
+ * @return int field's index.
+ */
+ public int getIndex() {return index;}
+
+ /**
+ * Gets field's name.
+ * @return String field's name.
+ */
+ public String getName() {return name;}
+
+ /**
+ * Gets field's attributes to string.
+ * @return String field's attributes to string.
+ */
+ public String toString() {return name;}
+ };
+
+ public static final String[] _ALL_FIELDS = {
+ "__g__dirty",
+ "v3",
+ };
+
/** Bytes used to represent weather or not a field is dirty. */
private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new
byte[1]);
private int v3;
Modified:
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
URL:
http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java?rev=1560819&r1=1560818&r2=1560819&view=diff
==============================================================================
---
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
(original)
+++
gora/branches/GORA_94/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
Thu Jan 23 21:39:40 2014
@@ -6,13 +6,71 @@
package org.apache.gora.examples.generated;
@SuppressWarnings("all")
public class WebPage extends org.apache.gora.persistency.impl.PersistentBase
implements org.apache.avro.specific.SpecificRecord,
org.apache.gora.persistency.Persistent {
- public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WebPage\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"url\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"content\",\"type\":[\"null\",\"bytes\"],\"default\":null},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":{}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"s
tring\"},\"default\":{}}]},\"default\":null}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new
org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WebPage\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is
dirty.\",\"default\":\"AA==\"},{\"name\":\"url\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"content\",\"type\":[\"null\",\"bytes\"],\"default\":null},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":{}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"string\"]},\"default\":{}},{\"name\":\"headers\",\"type\":[\"null\",{\"type\":\"map\",\"values\":[\"null\",\"string\"]}],\"default\":null},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes
used to represent weather or not a field is dirty.\",\"default\":\
"AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}}]},\"default\":null}]}");
+
+ /** Enum containing all data bean's fields. */
+ public static enum Field {
+ __G__DIRTY(0, "__g__dirty"),
+ URL(1, "url"),
+ CONTENT(2, "content"),
+ PARSED_CONTENT(3, "parsedContent"),
+ OUTLINKS(4, "outlinks"),
+ HEADERS(5, "headers"),
+ METADATA(6, "metadata"),
+ ;
+ /**
+ * Field's index.
+ */
+ private int index;
+
+ /**
+ * Field's name.
+ */
+ private String name;
+
+ /**
+ * Field's constructor
+ * @param index field's index.
+ * @param name field's name.
+ */
+ Field(int index, String name) {this.index=index;this.name=name;}
+
+ /**
+ * Gets field's index.
+ * @return int field's index.
+ */
+ public int getIndex() {return index;}
+
+ /**
+ * Gets field's name.
+ * @return String field's name.
+ */
+ public String getName() {return name;}
+
+ /**
+ * Gets field's attributes to string.
+ * @return String field's attributes to string.
+ */
+ public String toString() {return name;}
+ };
+
+ public static final String[] _ALL_FIELDS = {
+ "__g__dirty",
+ "url",
+ "content",
+ "parsedContent",
+ "outlinks",
+ "headers",
+ "metadata",
+ };
+
/** Bytes used to represent weather or not a field is dirty. */
private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new
byte[1]);
private java.lang.CharSequence url;
private java.nio.ByteBuffer content;
private java.util.List<java.lang.CharSequence> parsedContent;
private java.util.Map<java.lang.CharSequence,java.lang.CharSequence>
outlinks;
+ private java.util.Map<java.lang.CharSequence,java.lang.CharSequence> headers;
private org.apache.gora.examples.generated.Metadata metadata;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
@@ -23,7 +81,8 @@ public class WebPage extends org.apache.
case 2: return content;
case 3: return parsedContent;
case 4: return outlinks;
- case 5: return metadata;
+ case 5: return headers;
+ case 6: return metadata;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
@@ -37,7 +96,8 @@ public class WebPage extends org.apache.
case 2: content = (java.nio.ByteBuffer)(value); break;
case 3: parsedContent = (java.util.List<java.lang.CharSequence>)((value
instanceof org.apache.gora.persistency.Dirtyable) ? value : new
org.apache.gora.persistency.impl.DirtyListWrapper((java.util.List)value));
break;
case 4: outlinks =
(java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)((value
instanceof org.apache.gora.persistency.Dirtyable) ? value : new
org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)value)); break;
- case 5: metadata = (org.apache.gora.examples.generated.Metadata)(value);
break;
+ case 5: headers =
(java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)(value); break;
+ case 6: metadata = (org.apache.gora.examples.generated.Metadata)(value);
break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
@@ -139,6 +199,30 @@ public class WebPage extends org.apache.
}
/**
+ * Gets the value of the 'headers' field.
+ */
+ public java.util.Map<java.lang.CharSequence,java.lang.CharSequence>
getHeaders() {
+ return headers;
+ }
+
+ /**
+ * Sets the value of the 'headers' field.
+ * @param value the value to set.
+ */
+ public void
setHeaders(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
+ this.headers = value;
+ setDirty(5);
+ }
+
+ /**
+ * Checks the dirty status of the 'headers' field. A field is dirty if it
represents a change that has not yet been written to the database.
+ * @param value the value to set.
+ */
+ public boolean
isHeadersDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence>
value) {
+ return isDirty(5);
+ }
+
+ /**
* Gets the value of the 'metadata' field.
*/
public org.apache.gora.examples.generated.Metadata getMetadata() {
@@ -151,7 +235,7 @@ public class WebPage extends org.apache.
*/
public void setMetadata(org.apache.gora.examples.generated.Metadata value) {
this.metadata = value;
- setDirty(5);
+ setDirty(6);
}
/**
@@ -159,7 +243,7 @@ public class WebPage extends org.apache.
* @param value the value to set.
*/
public boolean isMetadataDirty(org.apache.gora.examples.generated.Metadata
value) {
- return isDirty(5);
+ return isDirty(6);
}
/** Creates a new WebPage RecordBuilder */
@@ -211,6 +295,7 @@ public class WebPage extends org.apache.
private java.nio.ByteBuffer content;
private java.util.List<java.lang.CharSequence> parsedContent;
private java.util.Map<java.lang.CharSequence,java.lang.CharSequence>
outlinks;
+ private java.util.Map<java.lang.CharSequence,java.lang.CharSequence>
headers;
private org.apache.gora.examples.generated.Metadata metadata;
/** Creates a new Builder */
@@ -246,10 +331,14 @@ public class WebPage extends org.apache.
this.outlinks =
(java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)
data().deepCopy(fields()[4].schema(), other.outlinks);
fieldSetFlags()[4] = true;
}
- if (isValidValue(fields()[5], other.metadata)) {
- this.metadata = (org.apache.gora.examples.generated.Metadata)
data().deepCopy(fields()[5].schema(), other.metadata);
+ if (isValidValue(fields()[5], other.headers)) {
+ this.headers =
(java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)
data().deepCopy(fields()[5].schema(), other.headers);
fieldSetFlags()[5] = true;
}
+ if (isValidValue(fields()[6], other.metadata)) {
+ this.metadata = (org.apache.gora.examples.generated.Metadata)
data().deepCopy(fields()[6].schema(), other.metadata);
+ fieldSetFlags()[6] = true;
+ }
}
/** Gets the value of the 'url' field */
@@ -352,6 +441,31 @@ public class WebPage extends org.apache.
return this;
}
+ /** Gets the value of the 'headers' field */
+ public java.util.Map<java.lang.CharSequence,java.lang.CharSequence>
getHeaders() {
+ return headers;
+ }
+
+ /** Sets the value of the 'headers' field */
+ public org.apache.gora.examples.generated.WebPage.Builder
setHeaders(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
+ validate(fields()[5], value);
+ this.headers = value;
+ fieldSetFlags()[5] = true;
+ return this;
+ }
+
+ /** Checks whether the 'headers' field has been set */
+ public boolean hasHeaders() {
+ return fieldSetFlags()[5];
+ }
+
+ /** Clears the value of the 'headers' field */
+ public org.apache.gora.examples.generated.WebPage.Builder clearHeaders() {
+ headers = null;
+ fieldSetFlags()[5] = false;
+ return this;
+ }
+
/** Gets the value of the 'metadata' field */
public org.apache.gora.examples.generated.Metadata getMetadata() {
return metadata;
@@ -359,21 +473,21 @@ public class WebPage extends org.apache.
/** Sets the value of the 'metadata' field */
public org.apache.gora.examples.generated.WebPage.Builder
setMetadata(org.apache.gora.examples.generated.Metadata value) {
- validate(fields()[5], value);
+ validate(fields()[6], value);
this.metadata = value;
- fieldSetFlags()[5] = true;
+ fieldSetFlags()[6] = true;
return this;
}
/** Checks whether the 'metadata' field has been set */
public boolean hasMetadata() {
- return fieldSetFlags()[5];
+ return fieldSetFlags()[6];
}
/** Clears the value of the 'metadata' field */
public org.apache.gora.examples.generated.WebPage.Builder clearMetadata() {
metadata = null;
- fieldSetFlags()[5] = false;
+ fieldSetFlags()[6] = false;
return this;
}
@@ -386,7 +500,8 @@ public class WebPage extends org.apache.
record.content = fieldSetFlags()[2] ? this.content :
(java.nio.ByteBuffer) defaultValue(fields()[2]);
record.parsedContent = fieldSetFlags()[3] ? this.parsedContent :
(java.util.List<java.lang.CharSequence>) new
org.apache.gora.persistency.impl.DirtyListWrapper((java.util.List)defaultValue(fields()[3]));
record.outlinks = fieldSetFlags()[4] ? this.outlinks :
(java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) new
org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)defaultValue(fields()[4]));
- record.metadata = fieldSetFlags()[5] ? this.metadata :
(org.apache.gora.examples.generated.Metadata) Metadata.newBuilder().build();
+ record.headers = fieldSetFlags()[5] ? this.headers :
(java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)
defaultValue(fields()[5]);
+ record.metadata = fieldSetFlags()[6] ? this.metadata :
(org.apache.gora.examples.generated.Metadata) Metadata.newBuilder().build();
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
@@ -501,6 +616,29 @@ public class WebPage extends org.apache.
}
/**
+ * Gets the value of the 'headers' field.
+ */
+ public java.util.Map<java.lang.CharSequence,java.lang.CharSequence>
getHeaders() {
+ throw new java.lang.UnsupportedOperationException("Get is not
supported on tombstones");
+ }
+
+ /**
+ * Sets the value of the 'headers' field.
+ * @param value the value to set.
+ */
+ public void
setHeaders(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
+ throw new java.lang.UnsupportedOperationException("Set is not
supported on tombstones");
+ }
+
+ /**
+ * Checks the dirty status of the 'headers' field. A field is dirty
if it represents a change that has not yet been written to the database.
+ * @param value the value to set.
+ */
+ public boolean
isHeadersDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence>
value) {
+ throw new java.lang.UnsupportedOperationException("IsDirty is not
supported on tombstones");
+ }
+
+ /**
* Gets the value of the 'metadata' field.
*/
public org.apache.gora.examples.generated.Metadata getMetadata() {