http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/09d76298/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurPackedObject.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurPackedObject.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurPackedObject.java new file mode 100644 index 0000000..680312a --- /dev/null +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/BlurPackedObject.java @@ -0,0 +1,621 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.blur.thrift.generated; + +/** + * 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. + */ + + + +import org.apache.blur.thirdparty.thrift_0_9_0.scheme.IScheme; +import org.apache.blur.thirdparty.thrift_0_9_0.scheme.SchemeFactory; +import org.apache.blur.thirdparty.thrift_0_9_0.scheme.StandardScheme; + +import org.apache.blur.thirdparty.thrift_0_9_0.scheme.TupleScheme; +import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TTupleProtocol; +import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolException; +import org.apache.blur.thirdparty.thrift_0_9_0.EncodingUtils; +import org.apache.blur.thirdparty.thrift_0_9_0.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; + +public class BlurPackedObject implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<BlurPackedObject, BlurPackedObject._Fields>, java.io.Serializable, Cloneable { + private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct STRUCT_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct("BlurPackedObject"); + + private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField PARENT_ID_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("parentId", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I32, (short)1); + private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField TYPE_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("type", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I32, (short)2); + private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField VALUE_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("value", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new BlurPackedObjectStandardSchemeFactory()); + schemes.put(TupleScheme.class, new BlurPackedObjectTupleSchemeFactory()); + } + + public int parentId; // required + /** + * + * @see BlurObjectType + */ + public BlurObjectType type; // required + public Value value; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.blur.thirdparty.thrift_0_9_0.TFieldIdEnum { + PARENT_ID((short)1, "parentId"), + /** + * + * @see BlurObjectType + */ + TYPE((short)2, "type"), + VALUE((short)3, "value"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // PARENT_ID + return PARENT_ID; + case 2: // TYPE + return TYPE; + case 3: // VALUE + return VALUE; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __PARENTID_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.PARENT_ID, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("parentId", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I32))); + tmpMap.put(_Fields.TYPE, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("type", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.EnumMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.ENUM, BlurObjectType.class))); + tmpMap.put(_Fields.VALUE, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("value", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Value.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData.addStructMetaDataMap(BlurPackedObject.class, metaDataMap); + } + + public BlurPackedObject() { + } + + public BlurPackedObject( + int parentId, + BlurObjectType type, + Value value) + { + this(); + this.parentId = parentId; + setParentIdIsSet(true); + this.type = type; + this.value = value; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public BlurPackedObject(BlurPackedObject other) { + __isset_bitfield = other.__isset_bitfield; + this.parentId = other.parentId; + if (other.isSetType()) { + this.type = other.type; + } + if (other.isSetValue()) { + this.value = new Value(other.value); + } + } + + public BlurPackedObject deepCopy() { + return new BlurPackedObject(this); + } + + @Override + public void clear() { + setParentIdIsSet(false); + this.parentId = 0; + this.type = null; + this.value = null; + } + + public int getParentId() { + return this.parentId; + } + + public BlurPackedObject setParentId(int parentId) { + this.parentId = parentId; + setParentIdIsSet(true); + return this; + } + + public void unsetParentId() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PARENTID_ISSET_ID); + } + + /** Returns true if field parentId is set (has been assigned a value) and false otherwise */ + public boolean isSetParentId() { + return EncodingUtils.testBit(__isset_bitfield, __PARENTID_ISSET_ID); + } + + public void setParentIdIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PARENTID_ISSET_ID, value); + } + + /** + * + * @see BlurObjectType + */ + public BlurObjectType getType() { + return this.type; + } + + /** + * + * @see BlurObjectType + */ + public BlurPackedObject setType(BlurObjectType type) { + this.type = type; + return this; + } + + public void unsetType() { + this.type = null; + } + + /** Returns true if field type is set (has been assigned a value) and false otherwise */ + public boolean isSetType() { + return this.type != null; + } + + public void setTypeIsSet(boolean value) { + if (!value) { + this.type = null; + } + } + + public Value getValue() { + return this.value; + } + + public BlurPackedObject setValue(Value value) { + this.value = value; + return this; + } + + public void unsetValue() { + this.value = null; + } + + /** Returns true if field value is set (has been assigned a value) and false otherwise */ + public boolean isSetValue() { + return this.value != null; + } + + public void setValueIsSet(boolean value) { + if (!value) { + this.value = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case PARENT_ID: + if (value == null) { + unsetParentId(); + } else { + setParentId((Integer)value); + } + break; + + case TYPE: + if (value == null) { + unsetType(); + } else { + setType((BlurObjectType)value); + } + break; + + case VALUE: + if (value == null) { + unsetValue(); + } else { + setValue((Value)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case PARENT_ID: + return Integer.valueOf(getParentId()); + + case TYPE: + return getType(); + + case VALUE: + return getValue(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case PARENT_ID: + return isSetParentId(); + case TYPE: + return isSetType(); + case VALUE: + return isSetValue(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof BlurPackedObject) + return this.equals((BlurPackedObject)that); + return false; + } + + public boolean equals(BlurPackedObject that) { + if (that == null) + return false; + + boolean this_present_parentId = true; + boolean that_present_parentId = true; + if (this_present_parentId || that_present_parentId) { + if (!(this_present_parentId && that_present_parentId)) + return false; + if (this.parentId != that.parentId) + return false; + } + + boolean this_present_type = true && this.isSetType(); + boolean that_present_type = true && that.isSetType(); + if (this_present_type || that_present_type) { + if (!(this_present_type && that_present_type)) + return false; + if (!this.type.equals(that.type)) + return false; + } + + boolean this_present_value = true && this.isSetValue(); + boolean that_present_value = true && that.isSetValue(); + if (this_present_value || that_present_value) { + if (!(this_present_value && that_present_value)) + return false; + if (!this.value.equals(that.value)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(BlurPackedObject other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + BlurPackedObject typedOther = (BlurPackedObject)other; + + lastComparison = Boolean.valueOf(isSetParentId()).compareTo(typedOther.isSetParentId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetParentId()) { + lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.parentId, typedOther.parentId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetType()) { + lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.type, typedOther.type); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetValue()) { + lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.value, typedOther.value); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol iprot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("BlurPackedObject("); + boolean first = true; + + sb.append("parentId:"); + sb.append(this.parentId); + first = false; + if (!first) sb.append(", "); + sb.append("type:"); + if (this.type == null) { + sb.append("null"); + } else { + sb.append(this.type); + } + first = false; + if (!first) sb.append(", "); + sb.append("value:"); + if (this.value == null) { + sb.append("null"); + } else { + sb.append(this.value); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol(new org.apache.blur.thirdparty.thrift_0_9_0.transport.TIOStreamTransport(out))); + } catch (org.apache.blur.thirdparty.thrift_0_9_0.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol(new org.apache.blur.thirdparty.thrift_0_9_0.transport.TIOStreamTransport(in))); + } catch (org.apache.blur.thirdparty.thrift_0_9_0.TException te) { + throw new java.io.IOException(te); + } + } + + private static class BlurPackedObjectStandardSchemeFactory implements SchemeFactory { + public BlurPackedObjectStandardScheme getScheme() { + return new BlurPackedObjectStandardScheme(); + } + } + + private static class BlurPackedObjectStandardScheme extends StandardScheme<BlurPackedObject> { + + public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol iprot, BlurPackedObject struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // PARENT_ID + if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I32) { + struct.parentId = iprot.readI32(); + struct.setParentIdIsSet(true); + } else { + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // TYPE + if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.I32) { + struct.type = BlurObjectType.findByValue(iprot.readI32()); + struct.setTypeIsSet(true); + } else { + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // VALUE + if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT) { + struct.value = new Value(); + struct.value.read(iprot); + struct.setValueIsSet(true); + } else { + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot, BlurPackedObject struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(PARENT_ID_FIELD_DESC); + oprot.writeI32(struct.parentId); + oprot.writeFieldEnd(); + if (struct.type != null) { + oprot.writeFieldBegin(TYPE_FIELD_DESC); + oprot.writeI32(struct.type.getValue()); + oprot.writeFieldEnd(); + } + if (struct.value != null) { + oprot.writeFieldBegin(VALUE_FIELD_DESC); + struct.value.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class BlurPackedObjectTupleSchemeFactory implements SchemeFactory { + public BlurPackedObjectTupleScheme getScheme() { + return new BlurPackedObjectTupleScheme(); + } + } + + private static class BlurPackedObjectTupleScheme extends TupleScheme<BlurPackedObject> { + + @Override + public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, BlurPackedObject struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetParentId()) { + optionals.set(0); + } + if (struct.isSetType()) { + optionals.set(1); + } + if (struct.isSetValue()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetParentId()) { + oprot.writeI32(struct.parentId); + } + if (struct.isSetType()) { + oprot.writeI32(struct.type.getValue()); + } + if (struct.isSetValue()) { + struct.value.write(oprot); + } + } + + @Override + public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, BlurPackedObject struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.parentId = iprot.readI32(); + struct.setParentIdIsSet(true); + } + if (incoming.get(1)) { + struct.type = BlurObjectType.findByValue(iprot.readI32()); + struct.setTypeIsSet(true); + } + if (incoming.get(2)) { + struct.value = new Value(); + struct.value.read(iprot); + struct.setValueIsSet(true); + } + } + } + +} +
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/09d76298/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Response.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Response.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Response.java index 2291733..1e36a12 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Response.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Response.java @@ -125,13 +125,13 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res tmpMap.put(_Fields.SHARD_TO_VALUE, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("shardToValue", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.MapMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.MAP, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Shard.class), - new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Value.class)))); + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, ValueObject.class)))); tmpMap.put(_Fields.SERVER_TO_VALUE, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("serverToValue", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.MapMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.MAP, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Server.class), - new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Value.class)))); + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, ValueObject.class)))); tmpMap.put(_Fields.VALUE, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("value", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, - new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Value.class))); + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, ValueObject.class))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData.addStructMetaDataMap(Response.class, metaDataMap); } @@ -151,19 +151,19 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res return new Response(this); } - public static Response shardToValue(Map<Shard,Value> value) { + public static Response shardToValue(Map<Shard,ValueObject> value) { Response x = new Response(); x.setShardToValue(value); return x; } - public static Response serverToValue(Map<Server,Value> value) { + public static Response serverToValue(Map<Server,ValueObject> value) { Response x = new Response(); x.setServerToValue(value); return x; } - public static Response value(Value value) { + public static Response value(ValueObject value) { Response x = new Response(); x.setValue(value); return x; @@ -177,17 +177,17 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res if (value instanceof Map) { break; } - throw new ClassCastException("Was expecting value of type Map<Shard,Value> for field 'shardToValue', but got " + value.getClass().getSimpleName()); + throw new ClassCastException("Was expecting value of type Map<Shard,ValueObject> for field 'shardToValue', but got " + value.getClass().getSimpleName()); case SERVER_TO_VALUE: if (value instanceof Map) { break; } - throw new ClassCastException("Was expecting value of type Map<Server,Value> for field 'serverToValue', but got " + value.getClass().getSimpleName()); + throw new ClassCastException("Was expecting value of type Map<Server,ValueObject> for field 'serverToValue', but got " + value.getClass().getSimpleName()); case VALUE: - if (value instanceof Value) { + if (value instanceof ValueObject) { break; } - throw new ClassCastException("Was expecting value of type Value for field 'value', but got " + value.getClass().getSimpleName()); + throw new ClassCastException("Was expecting value of type ValueObject for field 'value', but got " + value.getClass().getSimpleName()); default: throw new IllegalArgumentException("Unknown field id " + setField); } @@ -200,19 +200,19 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res switch (setField) { case SHARD_TO_VALUE: if (field.type == SHARD_TO_VALUE_FIELD_DESC.type) { - Map<Shard,Value> shardToValue; + Map<Shard,ValueObject> shardToValue; { - org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map232 = iprot.readMapBegin(); - shardToValue = new HashMap<Shard,Value>(2*_map232.size); - for (int _i233 = 0; _i233 < _map232.size; ++_i233) + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map240 = iprot.readMapBegin(); + shardToValue = new HashMap<Shard,ValueObject>(2*_map240.size); + for (int _i241 = 0; _i241 < _map240.size; ++_i241) { - Shard _key234; // optional - Value _val235; // required - _key234 = new Shard(); - _key234.read(iprot); - _val235 = new Value(); - _val235.read(iprot); - shardToValue.put(_key234, _val235); + Shard _key242; // optional + ValueObject _val243; // required + _key242 = new Shard(); + _key242.read(iprot); + _val243 = new ValueObject(); + _val243.read(iprot); + shardToValue.put(_key242, _val243); } iprot.readMapEnd(); } @@ -223,19 +223,19 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res } case SERVER_TO_VALUE: if (field.type == SERVER_TO_VALUE_FIELD_DESC.type) { - Map<Server,Value> serverToValue; + Map<Server,ValueObject> serverToValue; { - org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map236 = iprot.readMapBegin(); - serverToValue = new HashMap<Server,Value>(2*_map236.size); - for (int _i237 = 0; _i237 < _map236.size; ++_i237) + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map244 = iprot.readMapBegin(); + serverToValue = new HashMap<Server,ValueObject>(2*_map244.size); + for (int _i245 = 0; _i245 < _map244.size; ++_i245) { - Server _key238; // optional - Value _val239; // required - _key238 = new Server(); - _key238.read(iprot); - _val239 = new Value(); - _val239.read(iprot); - serverToValue.put(_key238, _val239); + Server _key246; // optional + ValueObject _val247; // required + _key246 = new Server(); + _key246.read(iprot); + _val247 = new ValueObject(); + _val247.read(iprot); + serverToValue.put(_key246, _val247); } iprot.readMapEnd(); } @@ -246,8 +246,8 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res } case VALUE: if (field.type == VALUE_FIELD_DESC.type) { - Value value; - value = new Value(); + ValueObject value; + value = new ValueObject(); value.read(iprot); return value; } else { @@ -266,31 +266,31 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res protected void standardSchemeWriteValue(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { switch (setField_) { case SHARD_TO_VALUE: - Map<Shard,Value> shardToValue = (Map<Shard,Value>)value_; + Map<Shard,ValueObject> shardToValue = (Map<Shard,ValueObject>)value_; { oprot.writeMapBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, shardToValue.size())); - for (Map.Entry<Shard, Value> _iter240 : shardToValue.entrySet()) + for (Map.Entry<Shard, ValueObject> _iter248 : shardToValue.entrySet()) { - _iter240.getKey().write(oprot); - _iter240.getValue().write(oprot); + _iter248.getKey().write(oprot); + _iter248.getValue().write(oprot); } oprot.writeMapEnd(); } return; case SERVER_TO_VALUE: - Map<Server,Value> serverToValue = (Map<Server,Value>)value_; + Map<Server,ValueObject> serverToValue = (Map<Server,ValueObject>)value_; { oprot.writeMapBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, serverToValue.size())); - for (Map.Entry<Server, Value> _iter241 : serverToValue.entrySet()) + for (Map.Entry<Server, ValueObject> _iter249 : serverToValue.entrySet()) { - _iter241.getKey().write(oprot); - _iter241.getValue().write(oprot); + _iter249.getKey().write(oprot); + _iter249.getValue().write(oprot); } oprot.writeMapEnd(); } return; case VALUE: - Value value = (Value)value_; + ValueObject value = (ValueObject)value_; value.write(oprot); return; default: @@ -304,44 +304,44 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res if (setField != null) { switch (setField) { case SHARD_TO_VALUE: - Map<Shard,Value> shardToValue; + Map<Shard,ValueObject> shardToValue; { - org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map242 = iprot.readMapBegin(); - shardToValue = new HashMap<Shard,Value>(2*_map242.size); - for (int _i243 = 0; _i243 < _map242.size; ++_i243) + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map250 = iprot.readMapBegin(); + shardToValue = new HashMap<Shard,ValueObject>(2*_map250.size); + for (int _i251 = 0; _i251 < _map250.size; ++_i251) { - Shard _key244; // optional - Value _val245; // required - _key244 = new Shard(); - _key244.read(iprot); - _val245 = new Value(); - _val245.read(iprot); - shardToValue.put(_key244, _val245); + Shard _key252; // optional + ValueObject _val253; // required + _key252 = new Shard(); + _key252.read(iprot); + _val253 = new ValueObject(); + _val253.read(iprot); + shardToValue.put(_key252, _val253); } iprot.readMapEnd(); } return shardToValue; case SERVER_TO_VALUE: - Map<Server,Value> serverToValue; + Map<Server,ValueObject> serverToValue; { - org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map246 = iprot.readMapBegin(); - serverToValue = new HashMap<Server,Value>(2*_map246.size); - for (int _i247 = 0; _i247 < _map246.size; ++_i247) + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map254 = iprot.readMapBegin(); + serverToValue = new HashMap<Server,ValueObject>(2*_map254.size); + for (int _i255 = 0; _i255 < _map254.size; ++_i255) { - Server _key248; // optional - Value _val249; // required - _key248 = new Server(); - _key248.read(iprot); - _val249 = new Value(); - _val249.read(iprot); - serverToValue.put(_key248, _val249); + Server _key256; // optional + ValueObject _val257; // required + _key256 = new Server(); + _key256.read(iprot); + _val257 = new ValueObject(); + _val257.read(iprot); + serverToValue.put(_key256, _val257); } iprot.readMapEnd(); } return serverToValue; case VALUE: - Value value; - value = new Value(); + ValueObject value; + value = new ValueObject(); value.read(iprot); return value; default: @@ -356,31 +356,31 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res protected void tupleSchemeWriteValue(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { switch (setField_) { case SHARD_TO_VALUE: - Map<Shard,Value> shardToValue = (Map<Shard,Value>)value_; + Map<Shard,ValueObject> shardToValue = (Map<Shard,ValueObject>)value_; { oprot.writeMapBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, shardToValue.size())); - for (Map.Entry<Shard, Value> _iter250 : shardToValue.entrySet()) + for (Map.Entry<Shard, ValueObject> _iter258 : shardToValue.entrySet()) { - _iter250.getKey().write(oprot); - _iter250.getValue().write(oprot); + _iter258.getKey().write(oprot); + _iter258.getValue().write(oprot); } oprot.writeMapEnd(); } return; case SERVER_TO_VALUE: - Map<Server,Value> serverToValue = (Map<Server,Value>)value_; + Map<Server,ValueObject> serverToValue = (Map<Server,ValueObject>)value_; { oprot.writeMapBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, serverToValue.size())); - for (Map.Entry<Server, Value> _iter251 : serverToValue.entrySet()) + for (Map.Entry<Server, ValueObject> _iter259 : serverToValue.entrySet()) { - _iter251.getKey().write(oprot); - _iter251.getValue().write(oprot); + _iter259.getKey().write(oprot); + _iter259.getValue().write(oprot); } oprot.writeMapEnd(); } return; case VALUE: - Value value = (Value)value_; + ValueObject value = (ValueObject)value_; value.write(oprot); return; default: @@ -417,43 +417,43 @@ public class Response extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<Res } - public Map<Shard,Value> getShardToValue() { + public Map<Shard,ValueObject> getShardToValue() { if (getSetField() == _Fields.SHARD_TO_VALUE) { - return (Map<Shard,Value>)getFieldValue(); + return (Map<Shard,ValueObject>)getFieldValue(); } else { throw new RuntimeException("Cannot get field 'shardToValue' because union is currently set to " + getFieldDesc(getSetField()).name); } } - public void setShardToValue(Map<Shard,Value> value) { + public void setShardToValue(Map<Shard,ValueObject> value) { if (value == null) throw new NullPointerException(); setField_ = _Fields.SHARD_TO_VALUE; value_ = value; } - public Map<Server,Value> getServerToValue() { + public Map<Server,ValueObject> getServerToValue() { if (getSetField() == _Fields.SERVER_TO_VALUE) { - return (Map<Server,Value>)getFieldValue(); + return (Map<Server,ValueObject>)getFieldValue(); } else { throw new RuntimeException("Cannot get field 'serverToValue' because union is currently set to " + getFieldDesc(getSetField()).name); } } - public void setServerToValue(Map<Server,Value> value) { + public void setServerToValue(Map<Server,ValueObject> value) { if (value == null) throw new NullPointerException(); setField_ = _Fields.SERVER_TO_VALUE; value_ = value; } - public Value getValue() { + public ValueObject getValue() { if (getSetField() == _Fields.VALUE) { - return (Value)getFieldValue(); + return (ValueObject)getFieldValue(); } else { throw new RuntimeException("Cannot get field 'value' because union is currently set to " + getFieldDesc(getSetField()).name); } } - public void setValue(Value value) { + public void setValue(ValueObject value) { if (value == null) throw new NullPointerException(); setField_ = _Fields.VALUE; value_ = value; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/09d76298/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ValueObject.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ValueObject.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ValueObject.java new file mode 100644 index 0000000..acdf7c4 --- /dev/null +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ValueObject.java @@ -0,0 +1,411 @@ +/** + * Autogenerated by Thrift Compiler (0.9.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.blur.thrift.generated; + +/** + * 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. + */ + + + +import org.apache.blur.thirdparty.thrift_0_9_0.scheme.IScheme; +import org.apache.blur.thirdparty.thrift_0_9_0.scheme.SchemeFactory; +import org.apache.blur.thirdparty.thrift_0_9_0.scheme.StandardScheme; + +import org.apache.blur.thirdparty.thrift_0_9_0.scheme.TupleScheme; +import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TTupleProtocol; +import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolException; +import org.apache.blur.thirdparty.thrift_0_9_0.EncodingUtils; +import org.apache.blur.thirdparty.thrift_0_9_0.TException; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; + +public class ValueObject extends org.apache.blur.thirdparty.thrift_0_9_0.TUnion<ValueObject, ValueObject._Fields> { + private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct STRUCT_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct("ValueObject"); + private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField VALUE_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("value", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, (short)1); + private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField BLUR_OBJECT_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("blurObject", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST, (short)2); + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.blur.thirdparty.thrift_0_9_0.TFieldIdEnum { + VALUE((short)1, "value"), + BLUR_OBJECT((short)2, "blurObject"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // VALUE + return VALUE; + case 2: // BLUR_OBJECT + return BLUR_OBJECT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.VALUE, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("value", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Value.class))); + tmpMap.put(_Fields.BLUR_OBJECT, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("blurObject", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.ListMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.LIST, + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, BlurPackedObject.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData.addStructMetaDataMap(ValueObject.class, metaDataMap); + } + + public ValueObject() { + super(); + } + + public ValueObject(_Fields setField, Object value) { + super(setField, value); + } + + public ValueObject(ValueObject other) { + super(other); + } + public ValueObject deepCopy() { + return new ValueObject(this); + } + + public static ValueObject value(Value value) { + ValueObject x = new ValueObject(); + x.setValue(value); + return x; + } + + public static ValueObject blurObject(List<BlurPackedObject> value) { + ValueObject x = new ValueObject(); + x.setBlurObject(value); + return x; + } + + + @Override + protected void checkType(_Fields setField, Object value) throws ClassCastException { + switch (setField) { + case VALUE: + if (value instanceof Value) { + break; + } + throw new ClassCastException("Was expecting value of type Value for field 'value', but got " + value.getClass().getSimpleName()); + case BLUR_OBJECT: + if (value instanceof List) { + break; + } + throw new ClassCastException("Was expecting value of type List<BlurPackedObject> for field 'blurObject', but got " + value.getClass().getSimpleName()); + default: + throw new IllegalArgumentException("Unknown field id " + setField); + } + } + + @Override + protected Object standardSchemeReadValue(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol iprot, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField field) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + _Fields setField = _Fields.findByThriftId(field.id); + if (setField != null) { + switch (setField) { + case VALUE: + if (field.type == VALUE_FIELD_DESC.type) { + Value value; + value = new Value(); + value.read(iprot); + return value; + } else { + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, field.type); + return null; + } + case BLUR_OBJECT: + if (field.type == BLUR_OBJECT_FIELD_DESC.type) { + List<BlurPackedObject> blurObject; + { + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList _list232 = iprot.readListBegin(); + blurObject = new ArrayList<BlurPackedObject>(_list232.size); + for (int _i233 = 0; _i233 < _list232.size; ++_i233) + { + BlurPackedObject _elem234; // required + _elem234 = new BlurPackedObject(); + _elem234.read(iprot); + blurObject.add(_elem234); + } + iprot.readListEnd(); + } + return blurObject; + } else { + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, field.type); + return null; + } + default: + throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!"); + } + } else { + return null; + } + } + + @Override + protected void standardSchemeWriteValue(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + switch (setField_) { + case VALUE: + Value value = (Value)value_; + value.write(oprot); + return; + case BLUR_OBJECT: + List<BlurPackedObject> blurObject = (List<BlurPackedObject>)value_; + { + oprot.writeListBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, blurObject.size())); + for (BlurPackedObject _iter235 : blurObject) + { + _iter235.write(oprot); + } + oprot.writeListEnd(); + } + return; + default: + throw new IllegalStateException("Cannot write union with unknown field " + setField_); + } + } + + @Override + protected Object tupleSchemeReadValue(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol iprot, short fieldID) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + _Fields setField = _Fields.findByThriftId(fieldID); + if (setField != null) { + switch (setField) { + case VALUE: + Value value; + value = new Value(); + value.read(iprot); + return value; + case BLUR_OBJECT: + List<BlurPackedObject> blurObject; + { + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList _list236 = iprot.readListBegin(); + blurObject = new ArrayList<BlurPackedObject>(_list236.size); + for (int _i237 = 0; _i237 < _list236.size; ++_i237) + { + BlurPackedObject _elem238; // required + _elem238 = new BlurPackedObject(); + _elem238.read(iprot); + blurObject.add(_elem238); + } + iprot.readListEnd(); + } + return blurObject; + default: + throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!"); + } + } else { + throw new TProtocolException("Couldn't find a field with field id " + fieldID); + } + } + + @Override + protected void tupleSchemeWriteValue(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException { + switch (setField_) { + case VALUE: + Value value = (Value)value_; + value.write(oprot); + return; + case BLUR_OBJECT: + List<BlurPackedObject> blurObject = (List<BlurPackedObject>)value_; + { + oprot.writeListBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TList(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, blurObject.size())); + for (BlurPackedObject _iter239 : blurObject) + { + _iter239.write(oprot); + } + oprot.writeListEnd(); + } + return; + default: + throw new IllegalStateException("Cannot write union with unknown field " + setField_); + } + } + + @Override + protected org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField getFieldDesc(_Fields setField) { + switch (setField) { + case VALUE: + return VALUE_FIELD_DESC; + case BLUR_OBJECT: + return BLUR_OBJECT_FIELD_DESC; + default: + throw new IllegalArgumentException("Unknown field id " + setField); + } + } + + @Override + protected org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct getStructDesc() { + return STRUCT_DESC; + } + + @Override + protected _Fields enumForId(short id) { + return _Fields.findByThriftIdOrThrow(id); + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + + public Value getValue() { + if (getSetField() == _Fields.VALUE) { + return (Value)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'value' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setValue(Value value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.VALUE; + value_ = value; + } + + public List<BlurPackedObject> getBlurObject() { + if (getSetField() == _Fields.BLUR_OBJECT) { + return (List<BlurPackedObject>)getFieldValue(); + } else { + throw new RuntimeException("Cannot get field 'blurObject' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setBlurObject(List<BlurPackedObject> value) { + if (value == null) throw new NullPointerException(); + setField_ = _Fields.BLUR_OBJECT; + value_ = value; + } + + public boolean isSetValue() { + return setField_ == _Fields.VALUE; + } + + + public boolean isSetBlurObject() { + return setField_ == _Fields.BLUR_OBJECT; + } + + + public boolean equals(Object other) { + if (other instanceof ValueObject) { + return equals((ValueObject)other); + } else { + return false; + } + } + + public boolean equals(ValueObject other) { + return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue()); + } + + @Override + public int compareTo(ValueObject other) { + int lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(getSetField(), other.getSetField()); + if (lastComparison == 0) { + return org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue()); + } + return lastComparison; + } + + + /** + * If you'd like this to perform more respectably, use the hashcode generator option. + */ + @Override + public int hashCode() { + return 0; + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol(new org.apache.blur.thirdparty.thrift_0_9_0.transport.TIOStreamTransport(out))); + } catch (org.apache.blur.thirdparty.thrift_0_9_0.TException te) { + throw new java.io.IOException(te); + } + } + + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol(new org.apache.blur.thirdparty.thrift_0_9_0.transport.TIOStreamTransport(in))); + } catch (org.apache.blur.thirdparty.thrift_0_9_0.TException te) { + throw new java.io.IOException(te); + } + } + + +} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/09d76298/blur-thrift/src/main/java/org/apache/blur/thrift/util/CommandExample.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/util/CommandExample.java b/blur-thrift/src/main/java/org/apache/blur/thrift/util/CommandExample.java index fe8dab4..c19fb1f 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/util/CommandExample.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/util/CommandExample.java @@ -32,9 +32,14 @@ public class CommandExample { System.out.println(client.execute("test", "docCount", null)); System.out.println(client.execute("test", "docCountNoCombine", null)); - Response response = client.execute("test", "docCountAggregate", null); - long count = response.getValue().getLongValue(); - System.out.println(count); - + { + Response response = client.execute("test", "docCountAggregate", null); + long count = response.getValue().getValue().getLongValue(); + System.out.println(count); + } + { + Response response = client.execute("test", "testBlurObject", null); + System.out.println(response); + } } } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/09d76298/distribution/src/main/scripts/interface/Blur.thrift ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/Blur.thrift b/distribution/src/main/scripts/interface/Blur.thrift index ec1bae3..590d1fc 100644 --- a/distribution/src/main/scripts/interface/Blur.thrift +++ b/distribution/src/main/scripts/interface/Blur.thrift @@ -858,14 +858,29 @@ struct Server { 1:string server } +enum BlurObjectType { + MAP, LIST, NAME, VALUE +} + +struct BlurPackedObject { + 1:i32 parentId, + 2:BlurObjectType type, + 3:Value value, +} + +union ValueObject { + 1:Value value, + 2:list<BlurPackedObject> blurObject +} + union Response { - 1:map<Shard, Value> shardToValue, - 2:map<Server, Value> serverToValue, - 3:Value value + 1:map<Shard, ValueObject> shardToValue, + 2:map<Server, ValueObject> serverToValue, + 3:ValueObject value } struct Arguments { - 1:map<string,Value> values + 1:map<string, ValueObject> values } /** http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/09d76298/distribution/src/main/scripts/interface/gen-html/Blur.html ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-html/Blur.html b/distribution/src/main/scripts/interface/gen-html/Blur.html index 5bd262f..a73aa48 100644 --- a/distribution/src/main/scripts/interface/gen-html/Blur.html +++ b/distribution/src/main/scripts/interface/gen-html/Blur.html @@ -62,6 +62,8 @@ </td> <td><a href="Blur.html#Struct_Arguments">Arguments</a><br/> <a href="Blur.html#Struct_BlurException">BlurException</a><br/> +<a href="Blur.html#Enum_BlurObjectType">BlurObjectType</a><br/> +<a href="Blur.html#Struct_BlurPackedObject">BlurPackedObject</a><br/> <a href="Blur.html#Struct_BlurQuery">BlurQuery</a><br/> <a href="Blur.html#Struct_BlurQueryStatus">BlurQueryStatus</a><br/> <a href="Blur.html#Struct_BlurResult">BlurResult</a><br/> @@ -100,6 +102,7 @@ <a href="Blur.html#Struct_TimeoutException">TimeoutException</a><br/> <a href="Blur.html#Struct_User">User</a><br/> <a href="Blur.html#Struct_Value">Value</a><br/> +<a href="Blur.html#Struct_ValueObject">ValueObject</a><br/> </td> <td></code></td> </tr></table> @@ -212,6 +215,13 @@ Logging level enum used to change the logging levels at runtime. <tr><td><code>TRACE</code></td><td><code>6</code></td></tr> <tr><td><code>ALL</code></td><td><code>7</code></td></tr> </table></div> +<div class="definition"><h3 id="Enum_BlurObjectType">Enumeration: BlurObjectType</h3> +<br/><table class="table-bordered table-striped table-condensed"> +<tr><td><code>MAP</code></td><td><code>0</code></td></tr> +<tr><td><code>LIST</code></td><td><code>1</code></td></tr> +<tr><td><code>NAME</code></td><td><code>2</code></td></tr> +<tr><td><code>VALUE</code></td><td><code>3</code></td></tr> +</table></div> <hr/><h2 id="Structs">Data structures</h2> <div class="definition"><h3 id="Struct_BlurException">Exception: BlurException</h3> <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default value</th></thead> @@ -605,14 +615,23 @@ be family dot column, "family.column". </table><br/></div><div class="definition"><h3 id="Struct_Server">Struct: Server</h3> <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default value</th></thead> <tr><td>1</td><td>server</td><td><code>string</code></td><td></td><td>default</td><td></td></tr> -</table><br/></div><div class="definition"><h3 id="Struct_Response">Struct: Response</h3> +</table><br/></div><div class="definition"><h3 id="Struct_BlurPackedObject">Struct: BlurPackedObject</h3> <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default value</th></thead> -<tr><td>1</td><td>shardToValue</td><td><code>map<<code><a href="Blur.html#Struct_Shard">Shard</a></code>, <code><a href="Blur.html#Struct_Value">Value</a></code>></code></td><td></td><td>default</td><td></td></tr> -<tr><td>2</td><td>serverToValue</td><td><code>map<<code><a href="Blur.html#Struct_Server">Server</a></code>, <code><a href="Blur.html#Struct_Value">Value</a></code>></code></td><td></td><td>default</td><td></td></tr> +<tr><td>1</td><td>parentId</td><td><code>i32</code></td><td></td><td>default</td><td></td></tr> +<tr><td>2</td><td>type</td><td><code><a href="Blur.html#Enum_BlurObjectType">BlurObjectType</a></code></td><td></td><td>default</td><td></td></tr> <tr><td>3</td><td>value</td><td><code><a href="Blur.html#Struct_Value">Value</a></code></td><td></td><td>default</td><td></td></tr> +</table><br/></div><div class="definition"><h3 id="Struct_ValueObject">Struct: ValueObject</h3> +<table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default value</th></thead> +<tr><td>1</td><td>value</td><td><code><a href="Blur.html#Struct_Value">Value</a></code></td><td></td><td>default</td><td></td></tr> +<tr><td>2</td><td>blurObject</td><td><code>list<<code><a href="Blur.html#Struct_BlurPackedObject">BlurPackedObject</a></code>></code></td><td></td><td>default</td><td></td></tr> +</table><br/></div><div class="definition"><h3 id="Struct_Response">Struct: Response</h3> +<table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default value</th></thead> +<tr><td>1</td><td>shardToValue</td><td><code>map<<code><a href="Blur.html#Struct_Shard">Shard</a></code>, <code><a href="Blur.html#Struct_ValueObject">ValueObject</a></code>></code></td><td></td><td>default</td><td></td></tr> +<tr><td>2</td><td>serverToValue</td><td><code>map<<code><a href="Blur.html#Struct_Server">Server</a></code>, <code><a href="Blur.html#Struct_ValueObject">ValueObject</a></code>></code></td><td></td><td>default</td><td></td></tr> +<tr><td>3</td><td>value</td><td><code><a href="Blur.html#Struct_ValueObject">ValueObject</a></code></td><td></td><td>default</td><td></td></tr> </table><br/></div><div class="definition"><h3 id="Struct_Arguments">Struct: Arguments</h3> <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default value</th></thead> -<tr><td>1</td><td>values</td><td><code>map<<code>string</code>, <code><a href="Blur.html#Struct_Value">Value</a></code>></code></td><td></td><td>default</td><td></td></tr> +<tr><td>1</td><td>values</td><td><code>map<<code>string</code>, <code><a href="Blur.html#Struct_ValueObject">ValueObject</a></code>></code></td><td></td><td>default</td><td></td></tr> </table><br/></div><hr/><h2 id="Services">Services</h2> <h3 id="Svc_Blur">Service: Blur</h3> The Blur service API. This API is the same for both controller servers as well as http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/09d76298/distribution/src/main/scripts/interface/gen-html/index.html ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-html/index.html b/distribution/src/main/scripts/interface/gen-html/index.html index 5a9c99a..80db661 100644 --- a/distribution/src/main/scripts/interface/gen-html/index.html +++ b/distribution/src/main/scripts/interface/gen-html/index.html @@ -58,6 +58,8 @@ </td> <td><a href="Blur.html#Struct_Arguments">Arguments</a><br/> <a href="Blur.html#Struct_BlurException">BlurException</a><br/> +<a href="Blur.html#Enum_BlurObjectType">BlurObjectType</a><br/> +<a href="Blur.html#Struct_BlurPackedObject">BlurPackedObject</a><br/> <a href="Blur.html#Struct_BlurQuery">BlurQuery</a><br/> <a href="Blur.html#Struct_BlurQueryStatus">BlurQueryStatus</a><br/> <a href="Blur.html#Struct_BlurResult">BlurResult</a><br/> @@ -96,6 +98,7 @@ <a href="Blur.html#Struct_TimeoutException">TimeoutException</a><br/> <a href="Blur.html#Struct_User">User</a><br/> <a href="Blur.html#Struct_Value">Value</a><br/> +<a href="Blur.html#Struct_ValueObject">ValueObject</a><br/> </td> <td></code></td> </tr></table> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/09d76298/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Arguments.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Arguments.java b/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Arguments.java index d14f8c9..53a01a0 100644 --- a/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Arguments.java +++ b/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Arguments.java @@ -60,7 +60,7 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< schemes.put(TupleScheme.class, new ArgumentsTupleSchemeFactory()); } - public Map<String,Value> values; // required + public Map<String,ValueObject> values; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.blur.thirdparty.thrift_0_9_0.TFieldIdEnum { @@ -127,7 +127,7 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< tmpMap.put(_Fields.VALUES, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("values", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.MapMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.MAP, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING), - new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, Value.class)))); + new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.StructMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, ValueObject.class)))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData.addStructMetaDataMap(Arguments.class, metaDataMap); } @@ -136,7 +136,7 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< } public Arguments( - Map<String,Value> values) + Map<String,ValueObject> values) { this(); this.values = values; @@ -147,15 +147,15 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< */ public Arguments(Arguments other) { if (other.isSetValues()) { - Map<String,Value> __this__values = new HashMap<String,Value>(); - for (Map.Entry<String, Value> other_element : other.values.entrySet()) { + Map<String,ValueObject> __this__values = new HashMap<String,ValueObject>(); + for (Map.Entry<String, ValueObject> other_element : other.values.entrySet()) { String other_element_key = other_element.getKey(); - Value other_element_value = other_element.getValue(); + ValueObject other_element_value = other_element.getValue(); String __this__values_copy_key = other_element_key; - Value __this__values_copy_value = new Value(other_element_value); + ValueObject __this__values_copy_value = new ValueObject(other_element_value); __this__values.put(__this__values_copy_key, __this__values_copy_value); } @@ -176,18 +176,18 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< return (this.values == null) ? 0 : this.values.size(); } - public void putToValues(String key, Value val) { + public void putToValues(String key, ValueObject val) { if (this.values == null) { - this.values = new HashMap<String,Value>(); + this.values = new HashMap<String,ValueObject>(); } this.values.put(key, val); } - public Map<String,Value> getValues() { + public Map<String,ValueObject> getValues() { return this.values; } - public Arguments setValues(Map<String,Value> values) { + public Arguments setValues(Map<String,ValueObject> values) { this.values = values; return this; } @@ -213,7 +213,7 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< if (value == null) { unsetValues(); } else { - setValues((Map<String,Value>)value); + setValues((Map<String,ValueObject>)value); } break; @@ -363,16 +363,16 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< case 1: // VALUES if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.MAP) { { - org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map252 = iprot.readMapBegin(); - struct.values = new HashMap<String,Value>(2*_map252.size); - for (int _i253 = 0; _i253 < _map252.size; ++_i253) + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map260 = iprot.readMapBegin(); + struct.values = new HashMap<String,ValueObject>(2*_map260.size); + for (int _i261 = 0; _i261 < _map260.size; ++_i261) { - String _key254; // optional - Value _val255; // required - _key254 = iprot.readString(); - _val255 = new Value(); - _val255.read(iprot); - struct.values.put(_key254, _val255); + String _key262; // optional + ValueObject _val263; // required + _key262 = iprot.readString(); + _val263 = new ValueObject(); + _val263.read(iprot); + struct.values.put(_key262, _val263); } iprot.readMapEnd(); } @@ -400,10 +400,10 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< oprot.writeFieldBegin(VALUES_FIELD_DESC); { oprot.writeMapBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, struct.values.size())); - for (Map.Entry<String, Value> _iter256 : struct.values.entrySet()) + for (Map.Entry<String, ValueObject> _iter264 : struct.values.entrySet()) { - oprot.writeString(_iter256.getKey()); - _iter256.getValue().write(oprot); + oprot.writeString(_iter264.getKey()); + _iter264.getValue().write(oprot); } oprot.writeMapEnd(); } @@ -434,10 +434,10 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< if (struct.isSetValues()) { { oprot.writeI32(struct.values.size()); - for (Map.Entry<String, Value> _iter257 : struct.values.entrySet()) + for (Map.Entry<String, ValueObject> _iter265 : struct.values.entrySet()) { - oprot.writeString(_iter257.getKey()); - _iter257.getValue().write(oprot); + oprot.writeString(_iter265.getKey()); + _iter265.getValue().write(oprot); } } } @@ -449,16 +449,16 @@ public class Arguments implements org.apache.blur.thirdparty.thrift_0_9_0.TBase< BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map258 = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, iprot.readI32()); - struct.values = new HashMap<String,Value>(2*_map258.size); - for (int _i259 = 0; _i259 < _map258.size; ++_i259) + org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap _map266 = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMap(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRUCT, iprot.readI32()); + struct.values = new HashMap<String,ValueObject>(2*_map266.size); + for (int _i267 = 0; _i267 < _map266.size; ++_i267) { - String _key260; // optional - Value _val261; // required - _key260 = iprot.readString(); - _val261 = new Value(); - _val261.read(iprot); - struct.values.put(_key260, _val261); + String _key268; // optional + ValueObject _val269; // required + _key268 = iprot.readString(); + _val269 = new ValueObject(); + _val269.read(iprot); + struct.values.put(_key268, _val269); } } struct.setValuesIsSet(true);
