Example usage for org.apache.thrift.protocol TProtocol writeListBegin

List of usage examples for org.apache.thrift.protocol TProtocol writeListBegin

Introduction

In this page you can find the example usage for org.apache.thrift.protocol TProtocol writeListBegin.

Prototype

public abstract void writeListBegin(TList list) throws TException;

Source Link

Usage

From source file:backtype.storm.generated.ClusterSummary.java

License:Apache License

public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    validate();/*from   ww  w . j a  v  a 2 s  .com*/

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.supervisors != null) {
        oprot.writeFieldBegin(SUPERVISORS_FIELD_DESC);
        {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
                    this.supervisors.size()));
            for (SupervisorSummary _iter43 : this.supervisors) {
                _iter43.write(oprot);
            }
            oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(NIMBUS_UPTIME_SECS_FIELD_DESC);
    oprot.writeI32(this.nimbus_uptime_secs);
    oprot.writeFieldEnd();
    if (this.topologies != null) {
        oprot.writeFieldBegin(TOPOLOGIES_FIELD_DESC);
        {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
                    this.topologies.size()));
            for (TopologySummary _iter44 : this.topologies) {
                _iter44.write(oprot);
            }
            oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}

From source file:backtype.storm.generated.Grouping.java

License:Apache License

@Override
protected void writeValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    switch (setField_) {
    case FIELDS:/*  ww  w . j  a va 2 s.c  o  m*/
        List<String> fields = (List<String>) value_; {
        oprot.writeListBegin(
                new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, fields.size()));
        for (String _iter7 : fields) {
            oprot.writeString(_iter7);
        }
        oprot.writeListEnd();
    }
        return;
    case SHUFFLE:
        NullStruct shuffle = (NullStruct) value_;
        shuffle.write(oprot);
        return;
    case ALL:
        NullStruct all = (NullStruct) value_;
        all.write(oprot);
        return;
    case NONE:
        NullStruct none = (NullStruct) value_;
        none.write(oprot);
        return;
    case DIRECT:
        NullStruct direct = (NullStruct) value_;
        direct.write(oprot);
        return;
    case CUSTOM_OBJECT:
        JavaObject custom_object = (JavaObject) value_;
        custom_object.write(oprot);
        return;
    case CUSTOM_SERIALIZED:
        ByteBuffer custom_serialized = (ByteBuffer) value_;
        oprot.writeBinary(custom_serialized);
        return;
    case LOCAL_OR_SHUFFLE:
        NullStruct local_or_shuffle = (NullStruct) value_;
        local_or_shuffle.write(oprot);
        return;
    default:
        throw new IllegalStateException("Cannot write union with unknown field " + setField_);
    }
}

From source file:backtype.storm.generated.JavaObject.java

License:Apache License

public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    validate();/*from w ww . j a  va2  s .  c o  m*/

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.full_class_name != null) {
        oprot.writeFieldBegin(FULL_CLASS_NAME_FIELD_DESC);
        oprot.writeString(this.full_class_name);
        oprot.writeFieldEnd();
    }
    if (this.args_list != null) {
        oprot.writeFieldBegin(ARGS_LIST_FIELD_DESC);
        {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
                    this.args_list.size()));
            for (JavaObjectArg _iter3 : this.args_list) {
                _iter3.write(oprot);
            }
            oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}

From source file:backtype.storm.generated.StreamInfo.java

License:Apache License

public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    validate();/*from  w w  w  .  jav  a2  s.co  m*/

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.output_fields != null) {
        oprot.writeFieldBegin(OUTPUT_FIELDS_FIELD_DESC);
        {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING,
                    this.output_fields.size()));
            for (String _iter11 : this.output_fields) {
                oprot.writeString(_iter11);
            }
            oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(DIRECT_FIELD_DESC);
    oprot.writeBool(this.direct);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}

From source file:backtype.storm.generated.TopologyInfo.java

License:Apache License

public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    validate();//from  w  w w .j  av a2 s.  c  o  m

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.id != null) {
        oprot.writeFieldBegin(ID_FIELD_DESC);
        oprot.writeString(this.id);
        oprot.writeFieldEnd();
    }
    if (this.name != null) {
        oprot.writeFieldBegin(NAME_FIELD_DESC);
        oprot.writeString(this.name);
        oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(UPTIME_SECS_FIELD_DESC);
    oprot.writeI32(this.uptime_secs);
    oprot.writeFieldEnd();
    if (this.executors != null) {
        oprot.writeFieldBegin(EXECUTORS_FIELD_DESC);
        {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
                    this.executors.size()));
            for (ExecutorSummary _iter155 : this.executors) {
                _iter155.write(oprot);
            }
            oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
    }
    if (this.status != null) {
        oprot.writeFieldBegin(STATUS_FIELD_DESC);
        oprot.writeString(this.status);
        oprot.writeFieldEnd();
    }
    if (this.errors != null) {
        oprot.writeFieldBegin(ERRORS_FIELD_DESC);
        {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING,
                    org.apache.thrift.protocol.TType.LIST, this.errors.size()));
            for (Map.Entry<String, List<ErrorInfo>> _iter156 : this.errors.entrySet()) {
                oprot.writeString(_iter156.getKey());
                {
                    oprot.writeListBegin(new org.apache.thrift.protocol.TList(
                            org.apache.thrift.protocol.TType.STRUCT, _iter156.getValue().size()));
                    for (ErrorInfo _iter157 : _iter156.getValue()) {
                        _iter157.write(oprot);
                    }
                    oprot.writeListEnd();
                }
            }
            oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
    }
    if (this.sched_status != null) {
        if (is_set_sched_status()) {
            oprot.writeFieldBegin(SCHED_STATUS_FIELD_DESC);
            oprot.writeString(this.sched_status);
            oprot.writeFieldEnd();
        }
    }
    if (this.owner != null) {
        if (is_set_owner()) {
            oprot.writeFieldBegin(OWNER_FIELD_DESC);
            oprot.writeString(this.owner);
            oprot.writeFieldEnd();
        }
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}

From source file:com.bigdata.dastor.thrift.KeySlice.java

License:Apache License

public void write(TProtocol oprot) throws TException {
    validate();//from w w  w.ja  va  2  s.  c o m

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.key != null) {
        oprot.writeFieldBegin(KEY_FIELD_DESC);
        oprot.writeString(this.key);
        oprot.writeFieldEnd();
    }
    if (this.columns != null) {
        oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
        {
            oprot.writeListBegin(new TList(TType.STRUCT, this.columns.size()));
            for (ColumnOrSuperColumn _iter11 : this.columns) {
                _iter11.write(oprot);
            }
            oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}

From source file:com.bigdata.dastor.thrift.SlicePredicate.java

License:Apache License

public void write(TProtocol oprot) throws TException {
    validate();//from  w  w  w  .  ja v a2s.co m

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.column_names != null) {
        if (isSetColumn_names()) {
            oprot.writeFieldBegin(COLUMN_NAMES_FIELD_DESC);
            {
                oprot.writeListBegin(new TList(TType.STRING, this.column_names.size()));
                for (byte[] _iter7 : this.column_names) {
                    oprot.writeBinary(_iter7);
                }
                oprot.writeListEnd();
            }
            oprot.writeFieldEnd();
        }
    }
    if (this.slice_range != null) {
        if (isSetSlice_range()) {
            oprot.writeFieldBegin(SLICE_RANGE_FIELD_DESC);
            this.slice_range.write(oprot);
            oprot.writeFieldEnd();
        }
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}

From source file:com.bigdata.dastor.thrift.SuperColumn.java

License:Apache License

public void write(TProtocol oprot) throws TException {
    validate();//from  w  ww.j av a2s. c  o  m

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.name != null) {
        oprot.writeFieldBegin(NAME_FIELD_DESC);
        oprot.writeBinary(this.name);
        oprot.writeFieldEnd();
    }
    if (this.columns != null) {
        oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
        {
            oprot.writeListBegin(new TList(TType.STRUCT, this.columns.size()));
            for (Column _iter3 : this.columns) {
                _iter3.write(oprot);
            }
            oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}

From source file:com.bigdata.dastor.thrift.TokenRange.java

License:Apache License

public void write(TProtocol oprot) throws TException {
    validate();//from  w  w  w.  ja v a  2  s .c om

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.start_token != null) {
        oprot.writeFieldBegin(START_TOKEN_FIELD_DESC);
        oprot.writeString(this.start_token);
        oprot.writeFieldEnd();
    }
    if (this.end_token != null) {
        oprot.writeFieldBegin(END_TOKEN_FIELD_DESC);
        oprot.writeString(this.end_token);
        oprot.writeFieldEnd();
    }
    if (this.endpoints != null) {
        oprot.writeFieldBegin(ENDPOINTS_FIELD_DESC);
        {
            oprot.writeListBegin(new TList(TType.STRING, this.endpoints.size()));
            for (String _iter15 : this.endpoints) {
                oprot.writeString(_iter15);
            }
            oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}

From source file:com.ebay.nest.io.sede.dynamic_type.DynamicSerDeTypeList.java

License:Apache License

@Override
public void serialize(Object o, ObjectInspector oi, TProtocol oprot)
        throws TException, SerDeException, NoSuchFieldException, IllegalAccessException {
    ListObjectInspector loi = (ListObjectInspector) oi;
    ObjectInspector elementObjectInspector = loi.getListElementObjectInspector();
    DynamicSerDeTypeBase mt = getElementType();

    WriteNullsProtocol nullProtocol = (oprot instanceof WriteNullsProtocol) ? (WriteNullsProtocol) oprot : null;

    if (o instanceof List) {
        List<?> list = (List<?>) o;
        oprot.writeListBegin(new TList(mt.getType(), list.size()));
        for (Object element : list) {
            if (element == null) {
                assert (nullProtocol != null);
                nullProtocol.writeNull();
            } else {
                mt.serialize(element, elementObjectInspector, oprot);
            }/*from w w w . j  ava  2s.  c o m*/
        }
    } else {
        Object[] list = (Object[]) o;
        oprot.writeListBegin(new TList(mt.getType(), list.length));
        for (Object element : list) {
            if (element == null && nullProtocol != null) {
                assert (nullProtocol != null);
                nullProtocol.writeNull();
            } else {
                mt.serialize(element, elementObjectInspector, oprot);
            }
        }
    }
    // in theory, the below call isn't needed in non thrift_mode, but let's not
    // get too crazy
    oprot.writeListEnd();
}