You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flume.apache.org by br...@apache.org on 2013/02/11 19:31:03 UTC
[2/3] FLUME-1896: Implement Thrift RpcClient
http://git-wip-us.apache.org/repos/asf/flume/blob/60da3d86/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java
----------------------------------------------------------------------
diff --git a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java
new file mode 100644
index 0000000..b8af99c
--- /dev/null
+++ b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java
@@ -0,0 +1,580 @@
+/*
+ * 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.
+ */
+/**
+ * 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.flume.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
+
+public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEvent, ThriftFlumeEvent._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftFlumeEvent");
+
+ private static final org.apache.thrift.protocol.TField HEADERS_FIELD_DESC = new org.apache.thrift.protocol.TField("headers", org.apache.thrift.protocol.TType.MAP, (short)1);
+ private static final org.apache.thrift.protocol.TField BODY_FIELD_DESC = new org.apache.thrift.protocol.TField("body", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ThriftFlumeEventStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ThriftFlumeEventTupleSchemeFactory());
+ }
+
+ public Map<String,String> headers; // required
+ public ByteBuffer body; // 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 {
+ HEADERS((short)1, "headers"),
+ BODY((short)2, "body");
+
+ 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: // HEADERS
+ return HEADERS;
+ case 2: // BODY
+ return BODY;
+ 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.HEADERS, new org.apache.thrift.meta_data.FieldMetaData("headers", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ tmpMap.put(_Fields.BODY, new org.apache.thrift.meta_data.FieldMetaData("body", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ThriftFlumeEvent.class, metaDataMap);
+ }
+
+ public ThriftFlumeEvent() {
+ }
+
+ public ThriftFlumeEvent(
+ Map<String,String> headers,
+ ByteBuffer body)
+ {
+ this();
+ this.headers = headers;
+ this.body = body;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public ThriftFlumeEvent(ThriftFlumeEvent other) {
+ if (other.isSetHeaders()) {
+ Map<String,String> __this__headers = new HashMap<String,String>();
+ for (Map.Entry<String, String> other_element : other.headers.entrySet()) {
+
+ String other_element_key = other_element.getKey();
+ String other_element_value = other_element.getValue();
+
+ String __this__headers_copy_key = other_element_key;
+
+ String __this__headers_copy_value = other_element_value;
+
+ __this__headers.put(__this__headers_copy_key, __this__headers_copy_value);
+ }
+ this.headers = __this__headers;
+ }
+ if (other.isSetBody()) {
+ this.body = org.apache.thrift.TBaseHelper.copyBinary(other.body);
+;
+ }
+ }
+
+ public ThriftFlumeEvent deepCopy() {
+ return new ThriftFlumeEvent(this);
+ }
+
+ @Override
+ public void clear() {
+ this.headers = null;
+ this.body = null;
+ }
+
+ public int getHeadersSize() {
+ return (this.headers == null) ? 0 : this.headers.size();
+ }
+
+ public void putToHeaders(String key, String val) {
+ if (this.headers == null) {
+ this.headers = new HashMap<String,String>();
+ }
+ this.headers.put(key, val);
+ }
+
+ public Map<String,String> getHeaders() {
+ return this.headers;
+ }
+
+ public ThriftFlumeEvent setHeaders(Map<String,String> headers) {
+ this.headers = headers;
+ return this;
+ }
+
+ public void unsetHeaders() {
+ this.headers = null;
+ }
+
+ /** Returns true if field headers is set (has been assigned a value) and false otherwise */
+ public boolean isSetHeaders() {
+ return this.headers != null;
+ }
+
+ public void setHeadersIsSet(boolean value) {
+ if (!value) {
+ this.headers = null;
+ }
+ }
+
+ public byte[] getBody() {
+ setBody(org.apache.thrift.TBaseHelper.rightSize(body));
+ return body == null ? null : body.array();
+ }
+
+ public ByteBuffer bufferForBody() {
+ return body;
+ }
+
+ public ThriftFlumeEvent setBody(byte[] body) {
+ setBody(body == null ? (ByteBuffer)null : ByteBuffer.wrap(body));
+ return this;
+ }
+
+ public ThriftFlumeEvent setBody(ByteBuffer body) {
+ this.body = body;
+ return this;
+ }
+
+ public void unsetBody() {
+ this.body = null;
+ }
+
+ /** Returns true if field body is set (has been assigned a value) and false otherwise */
+ public boolean isSetBody() {
+ return this.body != null;
+ }
+
+ public void setBodyIsSet(boolean value) {
+ if (!value) {
+ this.body = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case HEADERS:
+ if (value == null) {
+ unsetHeaders();
+ } else {
+ setHeaders((Map<String,String>)value);
+ }
+ break;
+
+ case BODY:
+ if (value == null) {
+ unsetBody();
+ } else {
+ setBody((ByteBuffer)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case HEADERS:
+ return getHeaders();
+
+ case BODY:
+ return getBody();
+
+ }
+ 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 HEADERS:
+ return isSetHeaders();
+ case BODY:
+ return isSetBody();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof ThriftFlumeEvent)
+ return this.equals((ThriftFlumeEvent)that);
+ return false;
+ }
+
+ public boolean equals(ThriftFlumeEvent that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_headers = true && this.isSetHeaders();
+ boolean that_present_headers = true && that.isSetHeaders();
+ if (this_present_headers || that_present_headers) {
+ if (!(this_present_headers && that_present_headers))
+ return false;
+ if (!this.headers.equals(that.headers))
+ return false;
+ }
+
+ boolean this_present_body = true && this.isSetBody();
+ boolean that_present_body = true && that.isSetBody();
+ if (this_present_body || that_present_body) {
+ if (!(this_present_body && that_present_body))
+ return false;
+ if (!this.body.equals(that.body))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_headers = true && (isSetHeaders());
+ builder.append(present_headers);
+ if (present_headers)
+ builder.append(headers);
+
+ boolean present_body = true && (isSetBody());
+ builder.append(present_body);
+ if (present_body)
+ builder.append(body);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(ThriftFlumeEvent other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ ThriftFlumeEvent typedOther = (ThriftFlumeEvent)other;
+
+ lastComparison = Boolean.valueOf(isSetHeaders()).compareTo(typedOther.isSetHeaders());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetHeaders()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.headers, typedOther.headers);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetBody()).compareTo(typedOther.isSetBody());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetBody()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, typedOther.body);
+ 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("ThriftFlumeEvent(");
+ boolean first = true;
+
+ sb.append("headers:");
+ if (this.headers == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.headers);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("body:");
+ if (this.body == null) {
+ sb.append("null");
+ } else {
+ org.apache.thrift.TBaseHelper.toString(this.body, sb);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (headers == null) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'headers' was not present! Struct: " + toString());
+ }
+ if (body == null) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'body' was not present! Struct: " + toString());
+ }
+ // 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, 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 ThriftFlumeEventStandardSchemeFactory implements SchemeFactory {
+ public ThriftFlumeEventStandardScheme getScheme() {
+ return new ThriftFlumeEventStandardScheme();
+ }
+ }
+
+ private static class ThriftFlumeEventStandardScheme extends StandardScheme<ThriftFlumeEvent> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftFlumeEvent 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: // HEADERS
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin();
+ struct.headers = new HashMap<String,String>(2*_map0.size);
+ for (int _i1 = 0; _i1 < _map0.size; ++_i1)
+ {
+ String _key2; // required
+ String _val3; // required
+ _key2 = iprot.readString();
+ _val3 = iprot.readString();
+ struct.headers.put(_key2, _val3);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setHeadersIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // BODY
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.body = iprot.readBinary();
+ struct.setBodyIsSet(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, ThriftFlumeEvent struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.headers != null) {
+ oprot.writeFieldBegin(HEADERS_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.headers.size()));
+ for (Map.Entry<String, String> _iter4 : struct.headers.entrySet())
+ {
+ oprot.writeString(_iter4.getKey());
+ oprot.writeString(_iter4.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.body != null) {
+ oprot.writeFieldBegin(BODY_FIELD_DESC);
+ oprot.writeBinary(struct.body);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ThriftFlumeEventTupleSchemeFactory implements SchemeFactory {
+ public ThriftFlumeEventTupleScheme getScheme() {
+ return new ThriftFlumeEventTupleScheme();
+ }
+ }
+
+ private static class ThriftFlumeEventTupleScheme extends TupleScheme<ThriftFlumeEvent> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, ThriftFlumeEvent struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ {
+ oprot.writeI32(struct.headers.size());
+ for (Map.Entry<String, String> _iter5 : struct.headers.entrySet())
+ {
+ oprot.writeString(_iter5.getKey());
+ oprot.writeString(_iter5.getValue());
+ }
+ }
+ oprot.writeBinary(struct.body);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, ThriftFlumeEvent struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ {
+ org.apache.thrift.protocol.TMap _map6 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.headers = new HashMap<String,String>(2*_map6.size);
+ for (int _i7 = 0; _i7 < _map6.size; ++_i7)
+ {
+ String _key8; // required
+ String _val9; // required
+ _key8 = iprot.readString();
+ _val9 = iprot.readString();
+ struct.headers.put(_key8, _val9);
+ }
+ }
+ struct.setHeadersIsSet(true);
+ struct.body = iprot.readBinary();
+ struct.setBodyIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/flume/blob/60da3d86/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftSourceProtocol.java
----------------------------------------------------------------------
diff --git a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftSourceProtocol.java b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftSourceProtocol.java
new file mode 100644
index 0000000..b041895
--- /dev/null
+++ b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftSourceProtocol.java
@@ -0,0 +1,1813 @@
+/*
+ * 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.
+ */
+/**
+ * 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.flume.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
+
+public class ThriftSourceProtocol {
+
+ public interface Iface {
+
+ public Status append(ThriftFlumeEvent event) throws org.apache.thrift.TException;
+
+ public Status appendBatch(List<ThriftFlumeEvent> events) throws org.apache.thrift.TException;
+
+ }
+
+ public interface AsyncIface {
+
+ public void append(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.append_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void appendBatch(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.appendBatch_call> resultHandler) throws org.apache.thrift.TException;
+
+ }
+
+ public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+ public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+ public Factory() {}
+ public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+ return new Client(prot);
+ }
+ public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+ return new Client(iprot, oprot);
+ }
+ }
+
+ public Client(org.apache.thrift.protocol.TProtocol prot)
+ {
+ super(prot, prot);
+ }
+
+ public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+ super(iprot, oprot);
+ }
+
+ public Status append(ThriftFlumeEvent event) throws org.apache.thrift.TException
+ {
+ send_append(event);
+ return recv_append();
+ }
+
+ public void send_append(ThriftFlumeEvent event) throws org.apache.thrift.TException
+ {
+ append_args args = new append_args();
+ args.setEvent(event);
+ sendBase("append", args);
+ }
+
+ public Status recv_append() throws org.apache.thrift.TException
+ {
+ append_result result = new append_result();
+ receiveBase(result, "append");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "append failed: unknown result");
+ }
+
+ public Status appendBatch(List<ThriftFlumeEvent> events) throws org.apache.thrift.TException
+ {
+ send_appendBatch(events);
+ return recv_appendBatch();
+ }
+
+ public void send_appendBatch(List<ThriftFlumeEvent> events) throws org.apache.thrift.TException
+ {
+ appendBatch_args args = new appendBatch_args();
+ args.setEvents(events);
+ sendBase("appendBatch", args);
+ }
+
+ public Status recv_appendBatch() throws org.apache.thrift.TException
+ {
+ appendBatch_result result = new appendBatch_result();
+ receiveBase(result, "appendBatch");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "appendBatch failed: unknown result");
+ }
+
+ }
+ public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
+ public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
+ private org.apache.thrift.async.TAsyncClientManager clientManager;
+ private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+ public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+ this.clientManager = clientManager;
+ this.protocolFactory = protocolFactory;
+ }
+ public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+ return new AsyncClient(protocolFactory, clientManager, transport);
+ }
+ }
+
+ public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+ super(protocolFactory, clientManager, transport);
+ }
+
+ public void append(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback<append_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ append_call method_call = new append_call(event, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class append_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private ThriftFlumeEvent event;
+ public append_call(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback<append_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.event = event;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("append", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ append_args args = new append_args();
+ args.setEvent(event);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public Status getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_append();
+ }
+ }
+
+ public void appendBatch(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback<appendBatch_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ appendBatch_call method_call = new appendBatch_call(events, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class appendBatch_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private List<ThriftFlumeEvent> events;
+ public appendBatch_call(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback<appendBatch_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.events = events;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("appendBatch", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ appendBatch_args args = new appendBatch_args();
+ args.setEvents(events);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public Status getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_appendBatch();
+ }
+ }
+
+ }
+
+ public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
+ public Processor(I iface) {
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+ }
+
+ protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
+ super(iface, getProcessMap(processMap));
+ }
+
+ private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
+ processMap.put("append", new append());
+ processMap.put("appendBatch", new appendBatch());
+ return processMap;
+ }
+
+ public static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> {
+ public append() {
+ super("append");
+ }
+
+ public append_args getEmptyArgsInstance() {
+ return new append_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public append_result getResult(I iface, append_args args) throws org.apache.thrift.TException {
+ append_result result = new append_result();
+ result.success = iface.append(args.event);
+ return result;
+ }
+ }
+
+ public static class appendBatch<I extends Iface> extends org.apache.thrift.ProcessFunction<I, appendBatch_args> {
+ public appendBatch() {
+ super("appendBatch");
+ }
+
+ public appendBatch_args getEmptyArgsInstance() {
+ return new appendBatch_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public appendBatch_result getResult(I iface, appendBatch_args args) throws org.apache.thrift.TException {
+ appendBatch_result result = new appendBatch_result();
+ result.success = iface.appendBatch(args.events);
+ return result;
+ }
+ }
+
+ }
+
+ public static class append_args implements org.apache.thrift.TBase<append_args, append_args._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("append_args");
+
+ private static final org.apache.thrift.protocol.TField EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("event", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new append_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new append_argsTupleSchemeFactory());
+ }
+
+ public ThriftFlumeEvent event; // 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 {
+ EVENT((short)1, "event");
+
+ 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: // EVENT
+ return EVENT;
+ 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.EVENT, new org.apache.thrift.meta_data.FieldMetaData("event", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ThriftFlumeEvent.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(append_args.class, metaDataMap);
+ }
+
+ public append_args() {
+ }
+
+ public append_args(
+ ThriftFlumeEvent event)
+ {
+ this();
+ this.event = event;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public append_args(append_args other) {
+ if (other.isSetEvent()) {
+ this.event = new ThriftFlumeEvent(other.event);
+ }
+ }
+
+ public append_args deepCopy() {
+ return new append_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.event = null;
+ }
+
+ public ThriftFlumeEvent getEvent() {
+ return this.event;
+ }
+
+ public append_args setEvent(ThriftFlumeEvent event) {
+ this.event = event;
+ return this;
+ }
+
+ public void unsetEvent() {
+ this.event = null;
+ }
+
+ /** Returns true if field event is set (has been assigned a value) and false otherwise */
+ public boolean isSetEvent() {
+ return this.event != null;
+ }
+
+ public void setEventIsSet(boolean value) {
+ if (!value) {
+ this.event = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case EVENT:
+ if (value == null) {
+ unsetEvent();
+ } else {
+ setEvent((ThriftFlumeEvent)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case EVENT:
+ return getEvent();
+
+ }
+ 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 EVENT:
+ return isSetEvent();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof append_args)
+ return this.equals((append_args)that);
+ return false;
+ }
+
+ public boolean equals(append_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_event = true && this.isSetEvent();
+ boolean that_present_event = true && that.isSetEvent();
+ if (this_present_event || that_present_event) {
+ if (!(this_present_event && that_present_event))
+ return false;
+ if (!this.event.equals(that.event))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_event = true && (isSetEvent());
+ builder.append(present_event);
+ if (present_event)
+ builder.append(event);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(append_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ append_args typedOther = (append_args)other;
+
+ lastComparison = Boolean.valueOf(isSetEvent()).compareTo(typedOther.isSetEvent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetEvent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.event, typedOther.event);
+ 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("append_args(");
+ boolean first = true;
+
+ sb.append("event:");
+ if (this.event == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.event);
+ }
+ 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 (event != null) {
+ event.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 append_argsStandardSchemeFactory implements SchemeFactory {
+ public append_argsStandardScheme getScheme() {
+ return new append_argsStandardScheme();
+ }
+ }
+
+ private static class append_argsStandardScheme extends StandardScheme<append_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, append_args 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: // EVENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.event = new ThriftFlumeEvent();
+ struct.event.read(iprot);
+ struct.setEventIsSet(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, append_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.event != null) {
+ oprot.writeFieldBegin(EVENT_FIELD_DESC);
+ struct.event.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class append_argsTupleSchemeFactory implements SchemeFactory {
+ public append_argsTupleScheme getScheme() {
+ return new append_argsTupleScheme();
+ }
+ }
+
+ private static class append_argsTupleScheme extends TupleScheme<append_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, append_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetEvent()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetEvent()) {
+ struct.event.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, append_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.event = new ThriftFlumeEvent();
+ struct.event.read(iprot);
+ struct.setEventIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class append_result implements org.apache.thrift.TBase<append_result, append_result._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("append_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new append_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new append_resultTupleSchemeFactory());
+ }
+
+ /**
+ *
+ * @see Status
+ */
+ public Status success; // 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 {
+ /**
+ *
+ * @see Status
+ */
+ SUCCESS((short)0, "success");
+
+ 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 0: // SUCCESS
+ return SUCCESS;
+ 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Status.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(append_result.class, metaDataMap);
+ }
+
+ public append_result() {
+ }
+
+ public append_result(
+ Status success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public append_result(append_result other) {
+ if (other.isSetSuccess()) {
+ this.success = other.success;
+ }
+ }
+
+ public append_result deepCopy() {
+ return new append_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ /**
+ *
+ * @see Status
+ */
+ public Status getSuccess() {
+ return this.success;
+ }
+
+ /**
+ *
+ * @see Status
+ */
+ public append_result setSuccess(Status success) {
+ this.success = success;
+ return this;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((Status)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ }
+ 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 SUCCESS:
+ return isSetSuccess();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof append_result)
+ return this.equals((append_result)that);
+ return false;
+ }
+
+ public boolean equals(append_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_success = true && (isSetSuccess());
+ builder.append(present_success);
+ if (present_success)
+ builder.append(success.getValue());
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(append_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ append_result typedOther = (append_result)other;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ 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("append_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ 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, 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 append_resultStandardSchemeFactory implements SchemeFactory {
+ public append_resultStandardScheme getScheme() {
+ return new append_resultStandardScheme();
+ }
+ }
+
+ private static class append_resultStandardScheme extends StandardScheme<append_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, append_result 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 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.success = Status.findByValue(iprot.readI32());
+ struct.setSuccessIsSet(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, append_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeI32(struct.success.getValue());
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class append_resultTupleSchemeFactory implements SchemeFactory {
+ public append_resultTupleScheme getScheme() {
+ return new append_resultTupleScheme();
+ }
+ }
+
+ private static class append_resultTupleScheme extends TupleScheme<append_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, append_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetSuccess()) {
+ oprot.writeI32(struct.success.getValue());
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, append_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = Status.findByValue(iprot.readI32());
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class appendBatch_args implements org.apache.thrift.TBase<appendBatch_args, appendBatch_args._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("appendBatch_args");
+
+ private static final org.apache.thrift.protocol.TField EVENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("events", org.apache.thrift.protocol.TType.LIST, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new appendBatch_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new appendBatch_argsTupleSchemeFactory());
+ }
+
+ public List<ThriftFlumeEvent> events; // 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 {
+ EVENTS((short)1, "events");
+
+ 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: // EVENTS
+ return EVENTS;
+ 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.EVENTS, new org.apache.thrift.meta_data.FieldMetaData("events", 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, ThriftFlumeEvent.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(appendBatch_args.class, metaDataMap);
+ }
+
+ public appendBatch_args() {
+ }
+
+ public appendBatch_args(
+ List<ThriftFlumeEvent> events)
+ {
+ this();
+ this.events = events;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public appendBatch_args(appendBatch_args other) {
+ if (other.isSetEvents()) {
+ List<ThriftFlumeEvent> __this__events = new ArrayList<ThriftFlumeEvent>();
+ for (ThriftFlumeEvent other_element : other.events) {
+ __this__events.add(new ThriftFlumeEvent(other_element));
+ }
+ this.events = __this__events;
+ }
+ }
+
+ public appendBatch_args deepCopy() {
+ return new appendBatch_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.events = null;
+ }
+
+ public int getEventsSize() {
+ return (this.events == null) ? 0 : this.events.size();
+ }
+
+ public java.util.Iterator<ThriftFlumeEvent> getEventsIterator() {
+ return (this.events == null) ? null : this.events.iterator();
+ }
+
+ public void addToEvents(ThriftFlumeEvent elem) {
+ if (this.events == null) {
+ this.events = new ArrayList<ThriftFlumeEvent>();
+ }
+ this.events.add(elem);
+ }
+
+ public List<ThriftFlumeEvent> getEvents() {
+ return this.events;
+ }
+
+ public appendBatch_args setEvents(List<ThriftFlumeEvent> events) {
+ this.events = events;
+ return this;
+ }
+
+ public void unsetEvents() {
+ this.events = null;
+ }
+
+ /** Returns true if field events is set (has been assigned a value) and false otherwise */
+ public boolean isSetEvents() {
+ return this.events != null;
+ }
+
+ public void setEventsIsSet(boolean value) {
+ if (!value) {
+ this.events = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case EVENTS:
+ if (value == null) {
+ unsetEvents();
+ } else {
+ setEvents((List<ThriftFlumeEvent>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case EVENTS:
+ return getEvents();
+
+ }
+ 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 EVENTS:
+ return isSetEvents();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof appendBatch_args)
+ return this.equals((appendBatch_args)that);
+ return false;
+ }
+
+ public boolean equals(appendBatch_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_events = true && this.isSetEvents();
+ boolean that_present_events = true && that.isSetEvents();
+ if (this_present_events || that_present_events) {
+ if (!(this_present_events && that_present_events))
+ return false;
+ if (!this.events.equals(that.events))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_events = true && (isSetEvents());
+ builder.append(present_events);
+ if (present_events)
+ builder.append(events);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(appendBatch_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ appendBatch_args typedOther = (appendBatch_args)other;
+
+ lastComparison = Boolean.valueOf(isSetEvents()).compareTo(typedOther.isSetEvents());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetEvents()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.events, typedOther.events);
+ 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("appendBatch_args(");
+ boolean first = true;
+
+ sb.append("events:");
+ if (this.events == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.events);
+ }
+ 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, 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 appendBatch_argsStandardSchemeFactory implements SchemeFactory {
+ public appendBatch_argsStandardScheme getScheme() {
+ return new appendBatch_argsStandardScheme();
+ }
+ }
+
+ private static class appendBatch_argsStandardScheme extends StandardScheme<appendBatch_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, appendBatch_args 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: // EVENTS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list10 = iprot.readListBegin();
+ struct.events = new ArrayList<ThriftFlumeEvent>(_list10.size);
+ for (int _i11 = 0; _i11 < _list10.size; ++_i11)
+ {
+ ThriftFlumeEvent _elem12; // required
+ _elem12 = new ThriftFlumeEvent();
+ _elem12.read(iprot);
+ struct.events.add(_elem12);
+ }
+ iprot.readListEnd();
+ }
+ struct.setEventsIsSet(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, appendBatch_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.events != null) {
+ oprot.writeFieldBegin(EVENTS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.events.size()));
+ for (ThriftFlumeEvent _iter13 : struct.events)
+ {
+ _iter13.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class appendBatch_argsTupleSchemeFactory implements SchemeFactory {
+ public appendBatch_argsTupleScheme getScheme() {
+ return new appendBatch_argsTupleScheme();
+ }
+ }
+
+ private static class appendBatch_argsTupleScheme extends TupleScheme<appendBatch_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, appendBatch_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetEvents()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetEvents()) {
+ {
+ oprot.writeI32(struct.events.size());
+ for (ThriftFlumeEvent _iter14 : struct.events)
+ {
+ _iter14.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, appendBatch_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list15 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.events = new ArrayList<ThriftFlumeEvent>(_list15.size);
+ for (int _i16 = 0; _i16 < _list15.size; ++_i16)
+ {
+ ThriftFlumeEvent _elem17; // required
+ _elem17 = new ThriftFlumeEvent();
+ _elem17.read(iprot);
+ struct.events.add(_elem17);
+ }
+ }
+ struct.setEventsIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class appendBatch_result implements org.apache.thrift.TBase<appendBatch_result, appendBatch_result._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("appendBatch_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new appendBatch_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new appendBatch_resultTupleSchemeFactory());
+ }
+
+ /**
+ *
+ * @see Status
+ */
+ public Status success; // 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 {
+ /**
+ *
+ * @see Status
+ */
+ SUCCESS((short)0, "success");
+
+ 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 0: // SUCCESS
+ return SUCCESS;
+ 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Status.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(appendBatch_result.class, metaDataMap);
+ }
+
+ public appendBatch_result() {
+ }
+
+ public appendBatch_result(
+ Status success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public appendBatch_result(appendBatch_result other) {
+ if (other.isSetSuccess()) {
+ this.success = other.success;
+ }
+ }
+
+ public appendBatch_result deepCopy() {
+ return new appendBatch_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ /**
+ *
+ * @see Status
+ */
+ public Status getSuccess() {
+ return this.success;
+ }
+
+ /**
+ *
+ * @see Status
+ */
+ public appendBatch_result setSuccess(Status success) {
+ this.success = success;
+ return this;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((Status)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ }
+ 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 SUCCESS:
+ return isSetSuccess();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof appendBatch_result)
+ return this.equals((appendBatch_result)that);
+ return false;
+ }
+
+ public boolean equals(appendBatch_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_success = true && (isSetSuccess());
+ builder.append(present_success);
+ if (present_success)
+ builder.append(success.getValue());
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(appendBatch_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ appendBatch_result typedOther = (appendBatch_result)other;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ 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("appendBatch_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ 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, 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 appendBatch_resultStandardSchemeFactory implements SchemeFactory {
+ public appendBatch_resultStandardScheme getScheme() {
+ return new appendBatch_resultStandardScheme();
+ }
+ }
+
+ private static class appendBatch_resultStandardScheme extends StandardScheme<appendBatch_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, appendBatch_result 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 0: // SUCCESS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.success = Status.findByValue(iprot.readI32());
+ struct.setSuccessIsSet(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, appendBatch_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.success != null) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeI32(struct.success.getValue());
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class appendBatch_resultTupleSchemeFactory implements SchemeFactory {
+ public appendBatch_resultTupleScheme getScheme() {
+ return new appendBatch_resultTupleScheme();
+ }
+ }
+
+ private static class appendBatch_resultTupleScheme extends TupleScheme<appendBatch_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, appendBatch_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetSuccess()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetSuccess()) {
+ oprot.writeI32(struct.success.getValue());
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, appendBatch_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = Status.findByValue(iprot.readI32());
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flume/blob/60da3d86/flume-ng-sdk/src/main/thrift/aslv2
----------------------------------------------------------------------
diff --git a/flume-ng-sdk/src/main/thrift/aslv2 b/flume-ng-sdk/src/main/thrift/aslv2
new file mode 100644
index 0000000..7243427
--- /dev/null
+++ b/flume-ng-sdk/src/main/thrift/aslv2
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
http://git-wip-us.apache.org/repos/asf/flume/blob/60da3d86/flume-ng-sdk/src/main/thrift/flume.thrift
----------------------------------------------------------------------
diff --git a/flume-ng-sdk/src/main/thrift/flume.thrift b/flume-ng-sdk/src/main/thrift/flume.thrift
new file mode 100644
index 0000000..b0f1476
--- /dev/null
+++ b/flume-ng-sdk/src/main/thrift/flume.thrift
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+namespace java org.apache.flume.thrift
+
+struct ThriftFlumeEvent {
+ 1: required map <string, string> headers,
+ 2: required binary body,
+}
+
+enum Status {
+ OK,
+ FAILED,
+ ERROR,
+ UNKNOWN
+}
+
+service ThriftSourceProtocol {
+ Status append(1: ThriftFlumeEvent event),
+ Status appendBatch(1: list<ThriftFlumeEvent> events),
+}
+