Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 38109200CBF for ; Fri, 23 Jun 2017 15:42:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3639A160BF8; Fri, 23 Jun 2017 13:42:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3CF97160BCA for ; Fri, 23 Jun 2017 15:42:16 +0200 (CEST) Received: (qmail 30429 invoked by uid 500); 23 Jun 2017 13:42:15 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 30419 invoked by uid 99); 23 Jun 2017 13:42:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jun 2017 13:42:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 48025DFA83; Fri, 23 Jun 2017 13:42:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Fri, 23 Jun 2017 13:42:15 -0000 Message-Id: <991d5b3d44944beaa72e3f210fe6fc80@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/4] camel git commit: CAMEL-11333: Create a new camel-thrift RPC component archived-at: Fri, 23 Jun 2017 13:42:18 -0000 Repository: camel Updated Branches: refs/heads/master d5e35c95b -> 2a0a9e665 http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/InvalidOperation.java ---------------------------------------------------------------------- diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/InvalidOperation.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/InvalidOperation.java new file mode 100644 index 0000000..8c5329a --- /dev/null +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/InvalidOperation.java @@ -0,0 +1,475 @@ +/** + * Autogenerated by Thrift Compiler (0.10.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.camel.component.thrift.generated; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +/** + * Structs can also be exceptions, if they are nasty. + */ +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)", date = "2017-06-14") +public class InvalidOperation extends org.apache.thrift.TException implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InvalidOperation"); + + private static final org.apache.thrift.protocol.TField WHAT_OP_FIELD_DESC = new org.apache.thrift.protocol.TField("whatOp", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField WHY_FIELD_DESC = new org.apache.thrift.protocol.TField("why", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new InvalidOperationStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new InvalidOperationTupleSchemeFactory(); + + public int whatOp; // required + public java.lang.String why; // 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 { + WHAT_OP((short)1, "whatOp"), + WHY((short)2, "why"); + + private static final java.util.Map byName = new java.util.HashMap(); + + static { + for (_Fields field : java.util.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: // WHAT_OP + return WHAT_OP; + case 2: // WHY + return WHY; + 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 java.lang.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(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __WHATOP_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.WHAT_OP, new org.apache.thrift.meta_data.FieldMetaData("whatOp", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.WHY, new org.apache.thrift.meta_data.FieldMetaData("why", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InvalidOperation.class, metaDataMap); + } + + public InvalidOperation() { + } + + public InvalidOperation( + int whatOp, + java.lang.String why) + { + this(); + this.whatOp = whatOp; + setWhatOpIsSet(true); + this.why = why; + } + + /** + * Performs a deep copy on other. + */ + public InvalidOperation(InvalidOperation other) { + __isset_bitfield = other.__isset_bitfield; + this.whatOp = other.whatOp; + if (other.isSetWhy()) { + this.why = other.why; + } + } + + public InvalidOperation deepCopy() { + return new InvalidOperation(this); + } + + @Override + public void clear() { + setWhatOpIsSet(false); + this.whatOp = 0; + this.why = null; + } + + public int getWhatOp() { + return this.whatOp; + } + + public InvalidOperation setWhatOp(int whatOp) { + this.whatOp = whatOp; + setWhatOpIsSet(true); + return this; + } + + public void unsetWhatOp() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __WHATOP_ISSET_ID); + } + + /** Returns true if field whatOp is set (has been assigned a value) and false otherwise */ + public boolean isSetWhatOp() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __WHATOP_ISSET_ID); + } + + public void setWhatOpIsSet(boolean value) { + __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __WHATOP_ISSET_ID, value); + } + + public java.lang.String getWhy() { + return this.why; + } + + public InvalidOperation setWhy(java.lang.String why) { + this.why = why; + return this; + } + + public void unsetWhy() { + this.why = null; + } + + /** Returns true if field why is set (has been assigned a value) and false otherwise */ + public boolean isSetWhy() { + return this.why != null; + } + + public void setWhyIsSet(boolean value) { + if (!value) { + this.why = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case WHAT_OP: + if (value == null) { + unsetWhatOp(); + } else { + setWhatOp((java.lang.Integer)value); + } + break; + + case WHY: + if (value == null) { + unsetWhy(); + } else { + setWhy((java.lang.String)value); + } + break; + + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case WHAT_OP: + return getWhatOp(); + + case WHY: + return getWhy(); + + } + throw new java.lang.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 java.lang.IllegalArgumentException(); + } + + switch (field) { + case WHAT_OP: + return isSetWhatOp(); + case WHY: + return isSetWhy(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) + return false; + if (that instanceof InvalidOperation) + return this.equals((InvalidOperation)that); + return false; + } + + public boolean equals(InvalidOperation that) { + if (that == null) + return false; + if (this == that) + return true; + + boolean this_present_whatOp = true; + boolean that_present_whatOp = true; + if (this_present_whatOp || that_present_whatOp) { + if (!(this_present_whatOp && that_present_whatOp)) + return false; + if (this.whatOp != that.whatOp) + return false; + } + + boolean this_present_why = true && this.isSetWhy(); + boolean that_present_why = true && that.isSetWhy(); + if (this_present_why || that_present_why) { + if (!(this_present_why && that_present_why)) + return false; + if (!this.why.equals(that.why)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + whatOp; + + hashCode = hashCode * 8191 + ((isSetWhy()) ? 131071 : 524287); + if (isSetWhy()) + hashCode = hashCode * 8191 + why.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(InvalidOperation other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetWhatOp()).compareTo(other.isSetWhatOp()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetWhatOp()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.whatOp, other.whatOp); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetWhy()).compareTo(other.isSetWhy()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetWhy()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.why, other.why); + 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 { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("InvalidOperation("); + boolean first = true; + + sb.append("whatOp:"); + sb.append(this.whatOp); + first = false; + if (!first) sb.append(", "); + sb.append("why:"); + if (this.why == null) { + sb.append("null"); + } else { + sb.append(this.why); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.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.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, java.lang.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.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 InvalidOperationStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public InvalidOperationStandardScheme getScheme() { + return new InvalidOperationStandardScheme(); + } + } + + private static class InvalidOperationStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, InvalidOperation 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: // WHAT_OP + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.whatOp = iprot.readI32(); + struct.setWhatOpIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // WHY + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.why = iprot.readString(); + struct.setWhyIsSet(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, InvalidOperation struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(WHAT_OP_FIELD_DESC); + oprot.writeI32(struct.whatOp); + oprot.writeFieldEnd(); + if (struct.why != null) { + oprot.writeFieldBegin(WHY_FIELD_DESC); + oprot.writeString(struct.why); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class InvalidOperationTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public InvalidOperationTupleScheme getScheme() { + return new InvalidOperationTupleScheme(); + } + } + + private static class InvalidOperationTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, InvalidOperation struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetWhatOp()) { + optionals.set(0); + } + if (struct.isSetWhy()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetWhatOp()) { + oprot.writeI32(struct.whatOp); + } + if (struct.isSetWhy()) { + oprot.writeString(struct.why); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, InvalidOperation struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.whatOp = iprot.readI32(); + struct.setWhatOpIsSet(true); + } + if (incoming.get(1)) { + struct.why = iprot.readString(); + struct.setWhyIsSet(true); + } + } + } + + private static S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } +} + http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/Operation.java ---------------------------------------------------------------------- diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/Operation.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/Operation.java new file mode 100644 index 0000000..6089b80 --- /dev/null +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/Operation.java @@ -0,0 +1,55 @@ +/** + * Autogenerated by Thrift Compiler (0.10.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.camel.component.thrift.generated; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +/** + * You can define enums, which are just 32 bit integers. Values are optional + * and start at 1 if not supplied, C style again. + */ +public enum Operation implements org.apache.thrift.TEnum { + ADD(1), + SUBTRACT(2), + MULTIPLY(3), + DIVIDE(4); + + private final int value; + + private Operation(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static Operation findByValue(int value) { + switch (value) { + case 1: + return ADD; + case 2: + return SUBTRACT; + case 3: + return MULTIPLY; + case 4: + return DIVIDE; + default: + return null; + } + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/Work.java ---------------------------------------------------------------------- diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/Work.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/Work.java new file mode 100644 index 0000000..4bdad0f --- /dev/null +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/generated/Work.java @@ -0,0 +1,702 @@ +/** + * Autogenerated by Thrift Compiler (0.10.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.camel.component.thrift.generated; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +/** + * Structs are the basic complex data structures. They are comprised of fields + * which each have an integer identifier, a type, a symbolic name, and an + * optional default value. + * + * Fields can be declared "optional", which ensures they will not be included + * in the serialized output if they aren't set. Note that this requires some + * manual management in some languages. + */ +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)", date = "2017-06-14") +public class Work implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Work"); + + private static final org.apache.thrift.protocol.TField NUM1_FIELD_DESC = new org.apache.thrift.protocol.TField("num1", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField NUM2_FIELD_DESC = new org.apache.thrift.protocol.TField("num2", org.apache.thrift.protocol.TType.I32, (short)2); + private static final org.apache.thrift.protocol.TField OP_FIELD_DESC = new org.apache.thrift.protocol.TField("op", org.apache.thrift.protocol.TType.I32, (short)3); + private static final org.apache.thrift.protocol.TField COMMENT_FIELD_DESC = new org.apache.thrift.protocol.TField("comment", org.apache.thrift.protocol.TType.STRING, (short)4); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new WorkStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new WorkTupleSchemeFactory(); + + public int num1; // required + public int num2; // required + /** + * + * @see Operation + */ + public Operation op; // required + public java.lang.String comment; // optional + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NUM1((short)1, "num1"), + NUM2((short)2, "num2"), + /** + * + * @see Operation + */ + OP((short)3, "op"), + COMMENT((short)4, "comment"); + + private static final java.util.Map byName = new java.util.HashMap(); + + static { + for (_Fields field : java.util.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: // NUM1 + return NUM1; + case 2: // NUM2 + return NUM2; + case 3: // OP + return OP; + case 4: // COMMENT + return COMMENT; + 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 java.lang.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(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __NUM1_ISSET_ID = 0; + private static final int __NUM2_ISSET_ID = 1; + private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.COMMENT}; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.NUM1, new org.apache.thrift.meta_data.FieldMetaData("num1", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.NUM2, new org.apache.thrift.meta_data.FieldMetaData("num2", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.OP, new org.apache.thrift.meta_data.FieldMetaData("op", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Operation.class))); + tmpMap.put(_Fields.COMMENT, new org.apache.thrift.meta_data.FieldMetaData("comment", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Work.class, metaDataMap); + } + + public Work() { + this.num1 = 0; + + } + + public Work( + int num1, + int num2, + Operation op) + { + this(); + this.num1 = num1; + setNum1IsSet(true); + this.num2 = num2; + setNum2IsSet(true); + this.op = op; + } + + /** + * Performs a deep copy on other. + */ + public Work(Work other) { + __isset_bitfield = other.__isset_bitfield; + this.num1 = other.num1; + this.num2 = other.num2; + if (other.isSetOp()) { + this.op = other.op; + } + if (other.isSetComment()) { + this.comment = other.comment; + } + } + + public Work deepCopy() { + return new Work(this); + } + + @Override + public void clear() { + this.num1 = 0; + + setNum2IsSet(false); + this.num2 = 0; + this.op = null; + this.comment = null; + } + + public int getNum1() { + return this.num1; + } + + public Work setNum1(int num1) { + this.num1 = num1; + setNum1IsSet(true); + return this; + } + + public void unsetNum1() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __NUM1_ISSET_ID); + } + + /** Returns true if field num1 is set (has been assigned a value) and false otherwise */ + public boolean isSetNum1() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NUM1_ISSET_ID); + } + + public void setNum1IsSet(boolean value) { + __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __NUM1_ISSET_ID, value); + } + + public int getNum2() { + return this.num2; + } + + public Work setNum2(int num2) { + this.num2 = num2; + setNum2IsSet(true); + return this; + } + + public void unsetNum2() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __NUM2_ISSET_ID); + } + + /** Returns true if field num2 is set (has been assigned a value) and false otherwise */ + public boolean isSetNum2() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NUM2_ISSET_ID); + } + + public void setNum2IsSet(boolean value) { + __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __NUM2_ISSET_ID, value); + } + + /** + * + * @see Operation + */ + public Operation getOp() { + return this.op; + } + + /** + * + * @see Operation + */ + public Work setOp(Operation op) { + this.op = op; + return this; + } + + public void unsetOp() { + this.op = null; + } + + /** Returns true if field op is set (has been assigned a value) and false otherwise */ + public boolean isSetOp() { + return this.op != null; + } + + public void setOpIsSet(boolean value) { + if (!value) { + this.op = null; + } + } + + public java.lang.String getComment() { + return this.comment; + } + + public Work setComment(java.lang.String comment) { + this.comment = comment; + return this; + } + + public void unsetComment() { + this.comment = null; + } + + /** Returns true if field comment is set (has been assigned a value) and false otherwise */ + public boolean isSetComment() { + return this.comment != null; + } + + public void setCommentIsSet(boolean value) { + if (!value) { + this.comment = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case NUM1: + if (value == null) { + unsetNum1(); + } else { + setNum1((java.lang.Integer)value); + } + break; + + case NUM2: + if (value == null) { + unsetNum2(); + } else { + setNum2((java.lang.Integer)value); + } + break; + + case OP: + if (value == null) { + unsetOp(); + } else { + setOp((Operation)value); + } + break; + + case COMMENT: + if (value == null) { + unsetComment(); + } else { + setComment((java.lang.String)value); + } + break; + + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NUM1: + return getNum1(); + + case NUM2: + return getNum2(); + + case OP: + return getOp(); + + case COMMENT: + return getComment(); + + } + throw new java.lang.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 java.lang.IllegalArgumentException(); + } + + switch (field) { + case NUM1: + return isSetNum1(); + case NUM2: + return isSetNum2(); + case OP: + return isSetOp(); + case COMMENT: + return isSetComment(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) + return false; + if (that instanceof Work) + return this.equals((Work)that); + return false; + } + + public boolean equals(Work that) { + if (that == null) + return false; + if (this == that) + return true; + + boolean this_present_num1 = true; + boolean that_present_num1 = true; + if (this_present_num1 || that_present_num1) { + if (!(this_present_num1 && that_present_num1)) + return false; + if (this.num1 != that.num1) + return false; + } + + boolean this_present_num2 = true; + boolean that_present_num2 = true; + if (this_present_num2 || that_present_num2) { + if (!(this_present_num2 && that_present_num2)) + return false; + if (this.num2 != that.num2) + return false; + } + + boolean this_present_op = true && this.isSetOp(); + boolean that_present_op = true && that.isSetOp(); + if (this_present_op || that_present_op) { + if (!(this_present_op && that_present_op)) + return false; + if (!this.op.equals(that.op)) + return false; + } + + boolean this_present_comment = true && this.isSetComment(); + boolean that_present_comment = true && that.isSetComment(); + if (this_present_comment || that_present_comment) { + if (!(this_present_comment && that_present_comment)) + return false; + if (!this.comment.equals(that.comment)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + num1; + + hashCode = hashCode * 8191 + num2; + + hashCode = hashCode * 8191 + ((isSetOp()) ? 131071 : 524287); + if (isSetOp()) + hashCode = hashCode * 8191 + op.getValue(); + + hashCode = hashCode * 8191 + ((isSetComment()) ? 131071 : 524287); + if (isSetComment()) + hashCode = hashCode * 8191 + comment.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Work other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetNum1()).compareTo(other.isSetNum1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNum1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num1, other.num1); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetNum2()).compareTo(other.isSetNum2()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetNum2()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num2, other.num2); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetOp()).compareTo(other.isSetOp()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetOp()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.op, other.op); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetComment()).compareTo(other.isSetComment()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetComment()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.comment, other.comment); + 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 { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Work("); + boolean first = true; + + sb.append("num1:"); + sb.append(this.num1); + first = false; + if (!first) sb.append(", "); + sb.append("num2:"); + sb.append(this.num2); + first = false; + if (!first) sb.append(", "); + sb.append("op:"); + if (this.op == null) { + sb.append("null"); + } else { + sb.append(this.op); + } + first = false; + if (isSetComment()) { + if (!first) sb.append(", "); + sb.append("comment:"); + if (this.comment == null) { + sb.append("null"); + } else { + sb.append(this.comment); + } + first = false; + } + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.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.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, java.lang.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.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 WorkStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public WorkStandardScheme getScheme() { + return new WorkStandardScheme(); + } + } + + private static class WorkStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Work 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: // NUM1 + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.num1 = iprot.readI32(); + struct.setNum1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NUM2 + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.num2 = iprot.readI32(); + struct.setNum2IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // OP + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.op = org.apache.camel.component.thrift.generated.Operation.findByValue(iprot.readI32()); + struct.setOpIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // COMMENT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.comment = iprot.readString(); + struct.setCommentIsSet(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, Work struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(NUM1_FIELD_DESC); + oprot.writeI32(struct.num1); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(NUM2_FIELD_DESC); + oprot.writeI32(struct.num2); + oprot.writeFieldEnd(); + if (struct.op != null) { + oprot.writeFieldBegin(OP_FIELD_DESC); + oprot.writeI32(struct.op.getValue()); + oprot.writeFieldEnd(); + } + if (struct.comment != null) { + if (struct.isSetComment()) { + oprot.writeFieldBegin(COMMENT_FIELD_DESC); + oprot.writeString(struct.comment); + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class WorkTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public WorkTupleScheme getScheme() { + return new WorkTupleScheme(); + } + } + + private static class WorkTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Work struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetNum1()) { + optionals.set(0); + } + if (struct.isSetNum2()) { + optionals.set(1); + } + if (struct.isSetOp()) { + optionals.set(2); + } + if (struct.isSetComment()) { + optionals.set(3); + } + oprot.writeBitSet(optionals, 4); + if (struct.isSetNum1()) { + oprot.writeI32(struct.num1); + } + if (struct.isSetNum2()) { + oprot.writeI32(struct.num2); + } + if (struct.isSetOp()) { + oprot.writeI32(struct.op.getValue()); + } + if (struct.isSetComment()) { + oprot.writeString(struct.comment); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Work struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(4); + if (incoming.get(0)) { + struct.num1 = iprot.readI32(); + struct.setNum1IsSet(true); + } + if (incoming.get(1)) { + struct.num2 = iprot.readI32(); + struct.setNum2IsSet(true); + } + if (incoming.get(2)) { + struct.op = org.apache.camel.component.thrift.generated.Operation.findByValue(iprot.readI32()); + struct.setOpIsSet(true); + } + if (incoming.get(3)) { + struct.comment = iprot.readString(); + struct.setCommentIsSet(true); + } + } + } + + private static S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } +} + http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/generated/Operation.java ---------------------------------------------------------------------- diff --git a/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/generated/Operation.java b/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/generated/Operation.java index cb98641..d54ab74 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/generated/Operation.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/generated/Operation.java @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.3) + * Autogenerated by Thrift Compiler (0.10.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/generated/Work.java ---------------------------------------------------------------------- diff --git a/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/generated/Work.java b/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/generated/Work.java index 5e08c16..13ca450 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/generated/Work.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/generated/Work.java @@ -1,39 +1,12 @@ /** - * Autogenerated by Thrift Compiler (0.9.3) + * Autogenerated by Thrift Compiler (0.10.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.camel.dataformat.thrift.generated; -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 org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -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 javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) /** * Structs are the basic complex data structures. They are comprised of fields * which each have an integer identifier, a type, a symbolic name, and an @@ -43,7 +16,7 @@ import org.slf4j.LoggerFactory; * in the serialized output if they aren't set. Note that this requires some * manual management in some languages. */ -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-05-30") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)", date = "2017-06-14") public class Work implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Work"); @@ -52,11 +25,8 @@ public class Work implements org.apache.thrift.TBase, java.i private static final org.apache.thrift.protocol.TField OP_FIELD_DESC = new org.apache.thrift.protocol.TField("op", org.apache.thrift.protocol.TType.I32, (short)3); private static final org.apache.thrift.protocol.TField COMMENT_FIELD_DESC = new org.apache.thrift.protocol.TField("comment", org.apache.thrift.protocol.TType.STRING, (short)4); - private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new WorkStandardSchemeFactory()); - schemes.put(TupleScheme.class, new WorkTupleSchemeFactory()); - } + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new WorkStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new WorkTupleSchemeFactory(); public int num1; // required public int num2; // required @@ -65,7 +35,7 @@ public class Work implements org.apache.thrift.TBase, java.i * @see Operation */ public Operation op; // required - public String comment; // optional + public java.lang.String comment; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -78,10 +48,10 @@ public class Work implements org.apache.thrift.TBase, java.i OP((short)3, "op"), COMMENT((short)4, "comment"); - private static final Map byName = new HashMap(); + private static final java.util.Map byName = new java.util.HashMap(); static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -110,21 +80,21 @@ public class Work implements org.apache.thrift.TBase, java.i */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + if (fields == null) throw new java.lang.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) { + public static _Fields findByName(java.lang.String name) { return byName.get(name); } private final short _thriftId; - private final String _fieldName; + private final java.lang.String _fieldName; - _Fields(short thriftId, String fieldName) { + _Fields(short thriftId, java.lang.String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } @@ -133,7 +103,7 @@ public class Work implements org.apache.thrift.TBase, java.i return _thriftId; } - public String getFieldName() { + public java.lang.String getFieldName() { return _fieldName; } } @@ -143,9 +113,9 @@ public class Work implements org.apache.thrift.TBase, java.i private static final int __NUM2_ISSET_ID = 1; private byte __isset_bitfield = 0; private static final _Fields optionals[] = {_Fields.COMMENT}; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + public static final java.util.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); + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.NUM1, new org.apache.thrift.meta_data.FieldMetaData("num1", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.NUM2, new org.apache.thrift.meta_data.FieldMetaData("num2", org.apache.thrift.TFieldRequirementType.DEFAULT, @@ -154,7 +124,7 @@ public class Work implements org.apache.thrift.TBase, java.i new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Operation.class))); tmpMap.put(_Fields.COMMENT, new org.apache.thrift.meta_data.FieldMetaData("comment", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Work.class, metaDataMap); } @@ -216,16 +186,16 @@ public class Work implements org.apache.thrift.TBase, java.i } public void unsetNum1() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUM1_ISSET_ID); + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __NUM1_ISSET_ID); } /** Returns true if field num1 is set (has been assigned a value) and false otherwise */ public boolean isSetNum1() { - return EncodingUtils.testBit(__isset_bitfield, __NUM1_ISSET_ID); + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NUM1_ISSET_ID); } public void setNum1IsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUM1_ISSET_ID, value); + __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __NUM1_ISSET_ID, value); } public int getNum2() { @@ -239,16 +209,16 @@ public class Work implements org.apache.thrift.TBase, java.i } public void unsetNum2() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUM2_ISSET_ID); + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __NUM2_ISSET_ID); } /** Returns true if field num2 is set (has been assigned a value) and false otherwise */ public boolean isSetNum2() { - return EncodingUtils.testBit(__isset_bitfield, __NUM2_ISSET_ID); + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __NUM2_ISSET_ID); } public void setNum2IsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUM2_ISSET_ID, value); + __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __NUM2_ISSET_ID, value); } /** @@ -283,11 +253,11 @@ public class Work implements org.apache.thrift.TBase, java.i } } - public String getComment() { + public java.lang.String getComment() { return this.comment; } - public Work setComment(String comment) { + public Work setComment(java.lang.String comment) { this.comment = comment; return this; } @@ -307,13 +277,13 @@ public class Work implements org.apache.thrift.TBase, java.i } } - public void setFieldValue(_Fields field, Object value) { + public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case NUM1: if (value == null) { unsetNum1(); } else { - setNum1((Integer)value); + setNum1((java.lang.Integer)value); } break; @@ -321,7 +291,7 @@ public class Work implements org.apache.thrift.TBase, java.i if (value == null) { unsetNum2(); } else { - setNum2((Integer)value); + setNum2((java.lang.Integer)value); } break; @@ -337,14 +307,14 @@ public class Work implements org.apache.thrift.TBase, java.i if (value == null) { unsetComment(); } else { - setComment((String)value); + setComment((java.lang.String)value); } break; } } - public Object getFieldValue(_Fields field) { + public java.lang.Object getFieldValue(_Fields field) { switch (field) { case NUM1: return getNum1(); @@ -359,13 +329,13 @@ public class Work implements org.apache.thrift.TBase, java.i return getComment(); } - throw new IllegalStateException(); + throw new java.lang.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(); + throw new java.lang.IllegalArgumentException(); } switch (field) { @@ -378,11 +348,11 @@ public class Work implements org.apache.thrift.TBase, java.i case COMMENT: return isSetComment(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } @Override - public boolean equals(Object that) { + public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof Work) @@ -393,6 +363,8 @@ public class Work implements org.apache.thrift.TBase, java.i public boolean equals(Work that) { if (that == null) return false; + if (this == that) + return true; boolean this_present_num1 = true; boolean that_present_num1 = true; @@ -435,29 +407,21 @@ public class Work implements org.apache.thrift.TBase, java.i @Override public int hashCode() { - List list = new ArrayList(); + int hashCode = 1; - boolean present_num1 = true; - list.add(present_num1); - if (present_num1) - list.add(num1); + hashCode = hashCode * 8191 + num1; - boolean present_num2 = true; - list.add(present_num2); - if (present_num2) - list.add(num2); + hashCode = hashCode * 8191 + num2; - boolean present_op = true && (isSetOp()); - list.add(present_op); - if (present_op) - list.add(op.getValue()); + hashCode = hashCode * 8191 + ((isSetOp()) ? 131071 : 524287); + if (isSetOp()) + hashCode = hashCode * 8191 + op.getValue(); - boolean present_comment = true && (isSetComment()); - list.add(present_comment); - if (present_comment) - list.add(comment); + hashCode = hashCode * 8191 + ((isSetComment()) ? 131071 : 524287); + if (isSetComment()) + hashCode = hashCode * 8191 + comment.hashCode(); - return list.hashCode(); + return hashCode; } @Override @@ -468,7 +432,7 @@ public class Work implements org.apache.thrift.TBase, java.i int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetNum1()).compareTo(other.isSetNum1()); + lastComparison = java.lang.Boolean.valueOf(isSetNum1()).compareTo(other.isSetNum1()); if (lastComparison != 0) { return lastComparison; } @@ -478,7 +442,7 @@ public class Work implements org.apache.thrift.TBase, java.i return lastComparison; } } - lastComparison = Boolean.valueOf(isSetNum2()).compareTo(other.isSetNum2()); + lastComparison = java.lang.Boolean.valueOf(isSetNum2()).compareTo(other.isSetNum2()); if (lastComparison != 0) { return lastComparison; } @@ -488,7 +452,7 @@ public class Work implements org.apache.thrift.TBase, java.i return lastComparison; } } - lastComparison = Boolean.valueOf(isSetOp()).compareTo(other.isSetOp()); + lastComparison = java.lang.Boolean.valueOf(isSetOp()).compareTo(other.isSetOp()); if (lastComparison != 0) { return lastComparison; } @@ -498,7 +462,7 @@ public class Work implements org.apache.thrift.TBase, java.i return lastComparison; } } - lastComparison = Boolean.valueOf(isSetComment()).compareTo(other.isSetComment()); + lastComparison = java.lang.Boolean.valueOf(isSetComment()).compareTo(other.isSetComment()); if (lastComparison != 0) { return lastComparison; } @@ -516,16 +480,16 @@ public class Work implements org.apache.thrift.TBase, java.i } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + scheme(iprot).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); + scheme(oprot).write(oprot, this); } @Override - public String toString() { - StringBuilder sb = new StringBuilder("Work("); + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Work("); boolean first = true; sb.append("num1:"); @@ -570,7 +534,7 @@ public class Work implements org.apache.thrift.TBase, java.i } } - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.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; @@ -580,13 +544,13 @@ public class Work implements org.apache.thrift.TBase, java.i } } - private static class WorkStandardSchemeFactory implements SchemeFactory { + private static class WorkStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public WorkStandardScheme getScheme() { return new WorkStandardScheme(); } } - private static class WorkStandardScheme extends StandardScheme { + private static class WorkStandardScheme extends org.apache.thrift.scheme.StandardScheme { public void read(org.apache.thrift.protocol.TProtocol iprot, Work struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; @@ -669,18 +633,18 @@ public class Work implements org.apache.thrift.TBase, java.i } - private static class WorkTupleSchemeFactory implements SchemeFactory { + private static class WorkTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public WorkTupleScheme getScheme() { return new WorkTupleScheme(); } } - private static class WorkTupleScheme extends TupleScheme { + private static class WorkTupleScheme extends org.apache.thrift.scheme.TupleScheme { @Override public void write(org.apache.thrift.protocol.TProtocol prot, Work struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); + org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetNum1()) { optionals.set(0); } @@ -710,8 +674,8 @@ public class Work implements org.apache.thrift.TBase, java.i @Override public void read(org.apache.thrift.protocol.TProtocol prot, Work struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(4); + org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(4); if (incoming.get(0)) { struct.num1 = iprot.readI32(); struct.setNum1IsSet(true); @@ -731,5 +695,8 @@ public class Work implements org.apache.thrift.TBase, java.i } } + private static S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } } http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/components/camel-thrift/src/test/thrift/readme.txt ---------------------------------------------------------------------- diff --git a/components/camel-thrift/src/test/thrift/readme.txt b/components/camel-thrift/src/test/thrift/readme.txt index 8211f43..13e69ce 100644 --- a/components/camel-thrift/src/test/thrift/readme.txt +++ b/components/camel-thrift/src/test/thrift/readme.txt @@ -2,4 +2,5 @@ Examples taken from the Apache Thrift java tutorial https://thrift.apache.org/tu Thrift tutorial java files generation cd src/test/thrift - thrift -r --gen java -out ../java/ ./tutorial-dataformat.thrift \ No newline at end of file + thrift -r --gen java -out ../java/ ./tutorial-dataformat.thrift + thrift -r --gen java -out ../java/ ./tutorial-component.thrift \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/components/camel-thrift/src/test/thrift/tutorial-component.thrift ---------------------------------------------------------------------- diff --git a/components/camel-thrift/src/test/thrift/tutorial-component.thrift b/components/camel-thrift/src/test/thrift/tutorial-component.thrift new file mode 100644 index 0000000..0ee0eeb --- /dev/null +++ b/components/camel-thrift/src/test/thrift/tutorial-component.thrift @@ -0,0 +1,130 @@ +/** + * 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. + */ + +# Thrift Tutorial +# Mark Slee (mcslee@facebook.com) +# +# This file aims to teach you how to use Thrift, in a .thrift file. The +# first thing to notice is that .thrift files support standard shell comments. +# This lets you make your thrift file executable and include your Thrift build +# step on the top line. And you can place comments like this anywhere you like. +# + +/** + * The first thing to know about are types. The available types in Thrift are: + * + * bool Boolean, one byte + * i8 (byte) Signed 8-bit integer + * i16 Signed 16-bit integer + * i32 Signed 32-bit integer + * i64 Signed 64-bit integer + * double 64-bit floating point value + * string String + * binary Blob (byte array) + * map Map from one type to another + * list Ordered list of one type + * set Set of unique elements of one type + * + * Did you also notice that Thrift supports C style comments? + */ + +// Just in case you were wondering... yes. We support simple C comments too. + +/** + * Thrift files can namespace, package, or prefix their output in various + * target languages. + */ +namespace java org.apache.camel.component.thrift.generated + +/** + * Thrift lets you do typedefs to get pretty names for your types. Standard + * C style here. + */ +typedef i32 MyInteger + +/** + * You can define enums, which are just 32 bit integers. Values are optional + * and start at 1 if not supplied, C style again. + */ +enum Operation { + ADD = 1, + SUBTRACT = 2, + MULTIPLY = 3, + DIVIDE = 4 +} + +/** + * Structs are the basic complex data structures. They are comprised of fields + * which each have an integer identifier, a type, a symbolic name, and an + * optional default value. + * + * Fields can be declared "optional", which ensures they will not be included + * in the serialized output if they aren't set. Note that this requires some + * manual management in some languages. + */ +struct Work { + 1: i32 num1 = 0, + 2: i32 num2, + 3: Operation op, + 4: optional string comment, +} + +/** + * Structs can also be exceptions, if they are nasty. + */ +exception InvalidOperation { + 1: i32 whatOp, + 2: string why +} + +/** + * Ahh, now onto the cool part, defining a service. Services just need a name + * and can optionally inherit from another service using the extends keyword. + */ +service Calculator { + + /** + * A method definition looks like C code. It has a return type, arguments, + * and optionally a list of exceptions that it may throw. Note that argument + * lists and exception lists are specified using the exact same syntax as + * field lists in struct or exception definitions. + */ + + void ping(), + + i32 add(1:i32 num1, 2:i32 num2), + + i32 calculate(1:i32 logid, 2:Work w) throws (1:InvalidOperation ouch), + + /** + * This method has a oneway modifier. That means the client only makes + * a request and does not listen for any response at all. Oneway methods + * must be void. + */ + oneway void zip(), + + /** + * This method echoed input object as return value. + */ + Work echo(1:Work w), + + /** + * This method contains all possible simple, special, struct and + * container types as input parameters + */ + i32 alltypes(1:bool v1, 2:i8 v2, 3:i16 v3, 4:i32 v4, 5:i64 v5, 6:double v6, 7:string v7, 8:binary v8, 9:Work v9, 10:list v10, 11:set v11, 12:map v12) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index 2eededf..7fb8909 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -368,7 +368,7 @@ 1.3.8 4.8.0.201706111038-r 4.0.3.Final - 0.9.3 + 0.10.0 1.2.6 20030619_5 20030619 @@ -719,8 +719,9 @@ 1.2.5 2.2.0 0.5.4 - 1.24.0 + 0.9.3 0.10.0 + 1.24.0 0.3.0 3.4.10 16.0 http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/platforms/karaf/features/src/main/resources/features.xml ---------------------------------------------------------------------- diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml index 5f82446..36a1ffa 100644 --- a/platforms/karaf/features/src/main/resources/features.xml +++ b/platforms/karaf/features/src/main/resources/features.xml @@ -2010,6 +2010,7 @@ camel-core mvn:org.apache.thrift/libthrift/${libthrift-version} mvn:commons-io/commons-io/${commons-io-version} + mvn:org.javassist/javassist/${javassist-version} mvn:org.apache.camel/camel-thrift/${project.version} @@ -2185,7 +2186,7 @@ mvn:io.zipkin.brave/brave-spancollector-scribe/${brave-zipkin-version} mvn:io.zipkin.java/zipkin/${zipkin-version} mvn:io.zipkin.reporter/zipkin-reporter/${zipkin-reporter-version} - mvn:org.apache.thrift/libthrift/${libthrift-version} + mvn:org.apache.thrift/libthrift/${zipkin-libthrift-version} mvn:org.apache.camel/camel-zipkin/${project.version} http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/java/org/apache/camel/component/thrift/springboot/ThriftComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/java/org/apache/camel/component/thrift/springboot/ThriftComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/java/org/apache/camel/component/thrift/springboot/ThriftComponentAutoConfiguration.java new file mode 100644 index 0000000..9eacf54 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/java/org/apache/camel/component/thrift/springboot/ThriftComponentAutoConfiguration.java @@ -0,0 +1,128 @@ +/** + * 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. + */ +package org.apache.camel.component.thrift.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.thrift.ThriftComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.util.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class, + ThriftComponentAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class, + ThriftComponentConfiguration.class}) +public class ThriftComponentAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(ThriftComponentAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private ThriftComponentConfiguration configuration; + @Autowired(required = false) + private List> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.component", "camel.component.thrift"); + } + } + + @Lazy + @Bean(name = "thrift-component") + @ConditionalOnMissingBean(ThriftComponent.class) + public ThriftComponent configureThriftComponent() throws Exception { + ThriftComponent component = new ThriftComponent(); + component.setCamelContext(camelContext); + Map parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), component, parameters); + if (ObjectHelper.isNotEmpty(customizers)) { + for (ComponentCustomizer customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.thrift.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.thrift.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } + } + } + return component; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/java/org/apache/camel/component/thrift/springboot/ThriftComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/java/org/apache/camel/component/thrift/springboot/ThriftComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/java/org/apache/camel/component/thrift/springboot/ThriftComponentConfiguration.java new file mode 100644 index 0000000..cfa6a34 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/java/org/apache/camel/component/thrift/springboot/ThriftComponentConfiguration.java @@ -0,0 +1,50 @@ +/** + * 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. + */ +package org.apache.camel.component.thrift.springboot; + +import javax.annotation.Generated; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The Thrift component allows to call and expose remote procedures (RPC) with + * Apache Thrift data format and serialization mechanism + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.thrift") +public class ThriftComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether the component should resolve property placeholders on itself when + * starting. Only properties which are of String type can use property + * placeholders. + */ + private Boolean resolvePropertyPlaceholders = true; + + public Boolean getResolvePropertyPlaceholders() { + return resolvePropertyPlaceholders; + } + + public void setResolvePropertyPlaceholders( + Boolean resolvePropertyPlaceholders) { + this.resolvePropertyPlaceholders = resolvePropertyPlaceholders; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/resources/META-INF/spring.factories index fc26916..8bbe517 100644 --- a/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/resources/META-INF/spring.factories +++ b/platforms/spring-boot/components-starter/camel-thrift-starter/src/main/resources/META-INF/spring.factories @@ -16,4 +16,6 @@ ## --------------------------------------------------------------------------- org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.apache.camel.dataformat.thrift.springboot.ThriftDataFormatAutoConfiguration +org.apache.camel.dataformat.thrift.springboot.ThriftDataFormatAutoConfiguration,\ +org.apache.camel.component.thrift.springboot.ThriftComponentAutoConfiguration + http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelThriftTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelThriftTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelThriftTest.java index b5f3e16..8c00e62 100644 --- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelThriftTest.java +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelThriftTest.java @@ -28,6 +28,7 @@ public class CamelThriftTest extends BaseKarafTest { @Test public void test() throws Exception { testDataFormat(COMPONENT); + testComponent(COMPONENT); } http://git-wip-us.apache.org/repos/asf/camel/blob/2a0a9e66/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelThriftTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelThriftTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelThriftTest.java index ac388de..0949735 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelThriftTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelThriftTest.java @@ -41,6 +41,7 @@ public class CamelThriftTest extends AbstractSpringBootTestSupport { @Test public void componentTests() throws Exception { this.runDataformatTest(config); + this.runComponentTest(config); this.runModuleUnitTestsIfEnabled(config); }