http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/11f5141c/src/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/AnalyzerType.java ---------------------------------------------------------------------- diff --git a/src/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/AnalyzerType.java b/src/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/AnalyzerType.java new file mode 100644 index 0000000..b3e25bb --- /dev/null +++ b/src/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/AnalyzerType.java @@ -0,0 +1,715 @@ +/** + * 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.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.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; + +/** + * The Analyzer struct allows for defining an alternate analyzer class definition + * with optional analyzer sub types. The sub types allow for indexing a single field + * with several different analyzer while only storing the value once. For example, if + * field "name" was a TEXT type the class definition could be set to Lowercase + * analyzer and the analyzer sub types could be set to Keyword (with a sub field name + * of "name.key") and Standard analyzer (with a sub field name of "name.standard"). Then in + * queries the Lowercase analyzer would be used when "name" is referenced, Keyword + * analyzer would be referenced when "name.key" is referenced and Standard analyzer + * would be referenced when "name.standard" is referenced. + */ +public class AnalyzerType implements org.apache.thrift.TBase<AnalyzerType, AnalyzerType._Fields>, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AnalyzerType"); + + private static final org.apache.thrift.protocol.TField FIELD_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("fieldName", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField CLASS_DEFINITION_FIELD_DESC = new org.apache.thrift.protocol.TField("classDefinition", org.apache.thrift.protocol.TType.STRUCT, (short)2); + private static final org.apache.thrift.protocol.TField ANALYZER_SUB_TYPES_FIELD_DESC = new org.apache.thrift.protocol.TField("analyzerSubTypes", org.apache.thrift.protocol.TType.LIST, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new AnalyzerTypeStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AnalyzerTypeTupleSchemeFactory()); + } + + /** + * The field that this defined type is to operate against. + */ + public String fieldName; // required + /** + * The class definition that is to be used. If this field is null then the + * default behavior of the field is to be used. + */ + public ClassDefinition classDefinition; // required + /** + * The analyzer sub types that should be applied. This can be empty or null. + */ + public List<AnalyzerSubType> analyzerSubTypes; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + /** + * The field that this defined type is to operate against. + */ + FIELD_NAME((short)1, "fieldName"), + /** + * The class definition that is to be used. If this field is null then the + * default behavior of the field is to be used. + */ + CLASS_DEFINITION((short)2, "classDefinition"), + /** + * The analyzer sub types that should be applied. This can be empty or null. + */ + ANALYZER_SUB_TYPES((short)3, "analyzerSubTypes"); + + 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: // FIELD_NAME + return FIELD_NAME; + case 2: // CLASS_DEFINITION + return CLASS_DEFINITION; + case 3: // ANALYZER_SUB_TYPES + return ANALYZER_SUB_TYPES; + 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 + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.FIELD_NAME, new org.apache.thrift.meta_data.FieldMetaData("fieldName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CLASS_DEFINITION, new org.apache.thrift.meta_data.FieldMetaData("classDefinition", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ClassDefinition.class))); + tmpMap.put(_Fields.ANALYZER_SUB_TYPES, new org.apache.thrift.meta_data.FieldMetaData("analyzerSubTypes", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, AnalyzerSubType.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AnalyzerType.class, metaDataMap); + } + + public AnalyzerType() { + } + + public AnalyzerType( + String fieldName, + ClassDefinition classDefinition, + List<AnalyzerSubType> analyzerSubTypes) + { + this(); + this.fieldName = fieldName; + this.classDefinition = classDefinition; + this.analyzerSubTypes = analyzerSubTypes; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public AnalyzerType(AnalyzerType other) { + if (other.isSetFieldName()) { + this.fieldName = other.fieldName; + } + if (other.isSetClassDefinition()) { + this.classDefinition = new ClassDefinition(other.classDefinition); + } + if (other.isSetAnalyzerSubTypes()) { + List<AnalyzerSubType> __this__analyzerSubTypes = new ArrayList<AnalyzerSubType>(); + for (AnalyzerSubType other_element : other.analyzerSubTypes) { + __this__analyzerSubTypes.add(new AnalyzerSubType(other_element)); + } + this.analyzerSubTypes = __this__analyzerSubTypes; + } + } + + public AnalyzerType deepCopy() { + return new AnalyzerType(this); + } + + @Override + public void clear() { + this.fieldName = null; + this.classDefinition = null; + this.analyzerSubTypes = null; + } + + /** + * The field that this defined type is to operate against. + */ + public String getFieldName() { + return this.fieldName; + } + + /** + * The field that this defined type is to operate against. + */ + public AnalyzerType setFieldName(String fieldName) { + this.fieldName = fieldName; + return this; + } + + public void unsetFieldName() { + this.fieldName = null; + } + + /** Returns true if field fieldName is set (has been assigned a value) and false otherwise */ + public boolean isSetFieldName() { + return this.fieldName != null; + } + + public void setFieldNameIsSet(boolean value) { + if (!value) { + this.fieldName = null; + } + } + + /** + * The class definition that is to be used. If this field is null then the + * default behavior of the field is to be used. + */ + public ClassDefinition getClassDefinition() { + return this.classDefinition; + } + + /** + * The class definition that is to be used. If this field is null then the + * default behavior of the field is to be used. + */ + public AnalyzerType setClassDefinition(ClassDefinition classDefinition) { + this.classDefinition = classDefinition; + return this; + } + + public void unsetClassDefinition() { + this.classDefinition = null; + } + + /** Returns true if field classDefinition is set (has been assigned a value) and false otherwise */ + public boolean isSetClassDefinition() { + return this.classDefinition != null; + } + + public void setClassDefinitionIsSet(boolean value) { + if (!value) { + this.classDefinition = null; + } + } + + public int getAnalyzerSubTypesSize() { + return (this.analyzerSubTypes == null) ? 0 : this.analyzerSubTypes.size(); + } + + public java.util.Iterator<AnalyzerSubType> getAnalyzerSubTypesIterator() { + return (this.analyzerSubTypes == null) ? null : this.analyzerSubTypes.iterator(); + } + + public void addToAnalyzerSubTypes(AnalyzerSubType elem) { + if (this.analyzerSubTypes == null) { + this.analyzerSubTypes = new ArrayList<AnalyzerSubType>(); + } + this.analyzerSubTypes.add(elem); + } + + /** + * The analyzer sub types that should be applied. This can be empty or null. + */ + public List<AnalyzerSubType> getAnalyzerSubTypes() { + return this.analyzerSubTypes; + } + + /** + * The analyzer sub types that should be applied. This can be empty or null. + */ + public AnalyzerType setAnalyzerSubTypes(List<AnalyzerSubType> analyzerSubTypes) { + this.analyzerSubTypes = analyzerSubTypes; + return this; + } + + public void unsetAnalyzerSubTypes() { + this.analyzerSubTypes = null; + } + + /** Returns true if field analyzerSubTypes is set (has been assigned a value) and false otherwise */ + public boolean isSetAnalyzerSubTypes() { + return this.analyzerSubTypes != null; + } + + public void setAnalyzerSubTypesIsSet(boolean value) { + if (!value) { + this.analyzerSubTypes = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case FIELD_NAME: + if (value == null) { + unsetFieldName(); + } else { + setFieldName((String)value); + } + break; + + case CLASS_DEFINITION: + if (value == null) { + unsetClassDefinition(); + } else { + setClassDefinition((ClassDefinition)value); + } + break; + + case ANALYZER_SUB_TYPES: + if (value == null) { + unsetAnalyzerSubTypes(); + } else { + setAnalyzerSubTypes((List<AnalyzerSubType>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case FIELD_NAME: + return getFieldName(); + + case CLASS_DEFINITION: + return getClassDefinition(); + + case ANALYZER_SUB_TYPES: + return getAnalyzerSubTypes(); + + } + 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 FIELD_NAME: + return isSetFieldName(); + case CLASS_DEFINITION: + return isSetClassDefinition(); + case ANALYZER_SUB_TYPES: + return isSetAnalyzerSubTypes(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof AnalyzerType) + return this.equals((AnalyzerType)that); + return false; + } + + public boolean equals(AnalyzerType that) { + if (that == null) + return false; + + boolean this_present_fieldName = true && this.isSetFieldName(); + boolean that_present_fieldName = true && that.isSetFieldName(); + if (this_present_fieldName || that_present_fieldName) { + if (!(this_present_fieldName && that_present_fieldName)) + return false; + if (!this.fieldName.equals(that.fieldName)) + return false; + } + + boolean this_present_classDefinition = true && this.isSetClassDefinition(); + boolean that_present_classDefinition = true && that.isSetClassDefinition(); + if (this_present_classDefinition || that_present_classDefinition) { + if (!(this_present_classDefinition && that_present_classDefinition)) + return false; + if (!this.classDefinition.equals(that.classDefinition)) + return false; + } + + boolean this_present_analyzerSubTypes = true && this.isSetAnalyzerSubTypes(); + boolean that_present_analyzerSubTypes = true && that.isSetAnalyzerSubTypes(); + if (this_present_analyzerSubTypes || that_present_analyzerSubTypes) { + if (!(this_present_analyzerSubTypes && that_present_analyzerSubTypes)) + return false; + if (!this.analyzerSubTypes.equals(that.analyzerSubTypes)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(AnalyzerType other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + AnalyzerType typedOther = (AnalyzerType)other; + + lastComparison = Boolean.valueOf(isSetFieldName()).compareTo(typedOther.isSetFieldName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFieldName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fieldName, typedOther.fieldName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetClassDefinition()).compareTo(typedOther.isSetClassDefinition()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetClassDefinition()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.classDefinition, typedOther.classDefinition); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAnalyzerSubTypes()).compareTo(typedOther.isSetAnalyzerSubTypes()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAnalyzerSubTypes()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.analyzerSubTypes, typedOther.analyzerSubTypes); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("AnalyzerType("); + boolean first = true; + + sb.append("fieldName:"); + if (this.fieldName == null) { + sb.append("null"); + } else { + sb.append(this.fieldName); + } + first = false; + if (!first) sb.append(", "); + sb.append("classDefinition:"); + if (this.classDefinition == null) { + sb.append("null"); + } else { + sb.append(this.classDefinition); + } + first = false; + if (!first) sb.append(", "); + sb.append("analyzerSubTypes:"); + if (this.analyzerSubTypes == null) { + sb.append("null"); + } else { + sb.append(this.analyzerSubTypes); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (classDefinition != null) { + classDefinition.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.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.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AnalyzerTypeStandardSchemeFactory implements SchemeFactory { + public AnalyzerTypeStandardScheme getScheme() { + return new AnalyzerTypeStandardScheme(); + } + } + + private static class AnalyzerTypeStandardScheme extends StandardScheme<AnalyzerType> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, AnalyzerType struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // FIELD_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.fieldName = iprot.readString(); + struct.setFieldNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CLASS_DEFINITION + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.classDefinition = new ClassDefinition(); + struct.classDefinition.read(iprot); + struct.setClassDefinitionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // ANALYZER_SUB_TYPES + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list18 = iprot.readListBegin(); + struct.analyzerSubTypes = new ArrayList<AnalyzerSubType>(_list18.size); + for (int _i19 = 0; _i19 < _list18.size; ++_i19) + { + AnalyzerSubType _elem20; // required + _elem20 = new AnalyzerSubType(); + _elem20.read(iprot); + struct.analyzerSubTypes.add(_elem20); + } + iprot.readListEnd(); + } + struct.setAnalyzerSubTypesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.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.thrift.protocol.TProtocol oprot, AnalyzerType struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.fieldName != null) { + oprot.writeFieldBegin(FIELD_NAME_FIELD_DESC); + oprot.writeString(struct.fieldName); + oprot.writeFieldEnd(); + } + if (struct.classDefinition != null) { + oprot.writeFieldBegin(CLASS_DEFINITION_FIELD_DESC); + struct.classDefinition.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.analyzerSubTypes != null) { + oprot.writeFieldBegin(ANALYZER_SUB_TYPES_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.analyzerSubTypes.size())); + for (AnalyzerSubType _iter21 : struct.analyzerSubTypes) + { + _iter21.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class AnalyzerTypeTupleSchemeFactory implements SchemeFactory { + public AnalyzerTypeTupleScheme getScheme() { + return new AnalyzerTypeTupleScheme(); + } + } + + private static class AnalyzerTypeTupleScheme extends TupleScheme<AnalyzerType> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, AnalyzerType struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetFieldName()) { + optionals.set(0); + } + if (struct.isSetClassDefinition()) { + optionals.set(1); + } + if (struct.isSetAnalyzerSubTypes()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetFieldName()) { + oprot.writeString(struct.fieldName); + } + if (struct.isSetClassDefinition()) { + struct.classDefinition.write(oprot); + } + if (struct.isSetAnalyzerSubTypes()) { + { + oprot.writeI32(struct.analyzerSubTypes.size()); + for (AnalyzerSubType _iter22 : struct.analyzerSubTypes) + { + _iter22.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, AnalyzerType struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.fieldName = iprot.readString(); + struct.setFieldNameIsSet(true); + } + if (incoming.get(1)) { + struct.classDefinition = new ClassDefinition(); + struct.classDefinition.read(iprot); + struct.setClassDefinitionIsSet(true); + } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TList _list23 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.analyzerSubTypes = new ArrayList<AnalyzerSubType>(_list23.size); + for (int _i24 = 0; _i24 < _list23.size; ++_i24) + { + AnalyzerSubType _elem25; // required + _elem25 = new AnalyzerSubType(); + _elem25.read(iprot); + struct.analyzerSubTypes.add(_elem25); + } + } + struct.setAnalyzerSubTypesIsSet(true); + } + } + } + +} +
