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

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

Introduction

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

Prototype

public abstract TList readListBegin() throws TException;

Source Link

Usage

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

License:Apache License

public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();//from   www .  ja  va  2 s  . c  o  m
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == org.apache.thrift.protocol.TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // SUPERVISORS
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
                {
                    org.apache.thrift.protocol.TList _list37 = iprot.readListBegin();
                    this.supervisors = new ArrayList<SupervisorSummary>(_list37.size);
                    for (int _i38 = 0; _i38 < _list37.size; ++_i38) {
                        SupervisorSummary _elem39; // required
                        _elem39 = new SupervisorSummary();
                        _elem39.read(iprot);
                        this.supervisors.add(_elem39);
                    }
                    iprot.readListEnd();
                }
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // NIMBUS_UPTIME_SECS
            if (field.type == org.apache.thrift.protocol.TType.I32) {
                this.nimbus_uptime_secs = iprot.readI32();
                set_nimbus_uptime_secs_isSet(true);
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 3: // TOPOLOGIES
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
                {
                    org.apache.thrift.protocol.TList _list40 = iprot.readListBegin();
                    this.topologies = new ArrayList<TopologySummary>(_list40.size);
                    for (int _i41 = 0; _i41 < _list40.size; ++_i41) {
                        TopologySummary _elem42; // required
                        _elem42 = new TopologySummary();
                        _elem42.read(iprot);
                        this.topologies.add(_elem42);
                    }
                    iprot.readListEnd();
                }
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
}

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

License:Apache License

@Override
protected Object readValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field)
        throws org.apache.thrift.TException {
    _Fields setField = _Fields.findByThriftId(field.id);
    if (setField != null) {
        switch (setField) {
        case FIELDS:
            if (field.type == FIELDS_FIELD_DESC.type) {
                List<String> fields;
                {//from  w ww  .j av  a2 s  .  c o  m
                    org.apache.thrift.protocol.TList _list4 = iprot.readListBegin();
                    fields = new ArrayList<String>(_list4.size);
                    for (int _i5 = 0; _i5 < _list4.size; ++_i5) {
                        String _elem6; // required
                        _elem6 = iprot.readString();
                        fields.add(_elem6);
                    }
                    iprot.readListEnd();
                }
                return fields;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case SHUFFLE:
            if (field.type == SHUFFLE_FIELD_DESC.type) {
                NullStruct shuffle;
                shuffle = new NullStruct();
                shuffle.read(iprot);
                return shuffle;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case ALL:
            if (field.type == ALL_FIELD_DESC.type) {
                NullStruct all;
                all = new NullStruct();
                all.read(iprot);
                return all;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case NONE:
            if (field.type == NONE_FIELD_DESC.type) {
                NullStruct none;
                none = new NullStruct();
                none.read(iprot);
                return none;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case DIRECT:
            if (field.type == DIRECT_FIELD_DESC.type) {
                NullStruct direct;
                direct = new NullStruct();
                direct.read(iprot);
                return direct;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case CUSTOM_OBJECT:
            if (field.type == CUSTOM_OBJECT_FIELD_DESC.type) {
                JavaObject custom_object;
                custom_object = new JavaObject();
                custom_object.read(iprot);
                return custom_object;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case CUSTOM_SERIALIZED:
            if (field.type == CUSTOM_SERIALIZED_FIELD_DESC.type) {
                ByteBuffer custom_serialized;
                custom_serialized = iprot.readBinary();
                return custom_serialized;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case LOCAL_OR_SHUFFLE:
            if (field.type == LOCAL_OR_SHUFFLE_FIELD_DESC.type) {
                NullStruct local_or_shuffle;
                local_or_shuffle = new NullStruct();
                local_or_shuffle.read(iprot);
                return local_or_shuffle;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        default:
            throw new IllegalStateException(
                    "setField wasn't null, but didn't match any of the case statements!");
        }
    } else {
        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        return null;
    }
}

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

License:Apache License

public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();/*from  w  w w .jav a 2s  .  c  o m*/
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == org.apache.thrift.protocol.TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // FULL_CLASS_NAME
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
                this.full_class_name = iprot.readString();
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // ARGS_LIST
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
                {
                    org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                    this.args_list = new ArrayList<JavaObjectArg>(_list0.size);
                    for (int _i1 = 0; _i1 < _list0.size; ++_i1) {
                        JavaObjectArg _elem2; // required
                        _elem2 = new JavaObjectArg();
                        _elem2.read(iprot);
                        this.args_list.add(_elem2);
                    }
                    iprot.readListEnd();
                }
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
}

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

License:Apache License

public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();/*from  w w w  . j  a  v a2 s  .c o m*/
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == org.apache.thrift.protocol.TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // OUTPUT_FIELDS
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
                {
                    org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
                    this.output_fields = new ArrayList<String>(_list8.size);
                    for (int _i9 = 0; _i9 < _list8.size; ++_i9) {
                        String _elem10; // required
                        _elem10 = iprot.readString();
                        this.output_fields.add(_elem10);
                    }
                    iprot.readListEnd();
                }
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // DIRECT
            if (field.type == org.apache.thrift.protocol.TType.BOOL) {
                this.direct = iprot.readBool();
                set_direct_isSet(true);
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
}

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

License:Apache License

public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();//from  w  w  w  .j  a v  a 2  s  .c o m
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == org.apache.thrift.protocol.TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // ID
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
                this.id = iprot.readString();
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // NAME
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
                this.name = iprot.readString();
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 3: // UPTIME_SECS
            if (field.type == org.apache.thrift.protocol.TType.I32) {
                this.uptime_secs = iprot.readI32();
                set_uptime_secs_isSet(true);
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 4: // EXECUTORS
            if (field.type == org.apache.thrift.protocol.TType.LIST) {
                {
                    org.apache.thrift.protocol.TList _list145 = iprot.readListBegin();
                    this.executors = new ArrayList<ExecutorSummary>(_list145.size);
                    for (int _i146 = 0; _i146 < _list145.size; ++_i146) {
                        ExecutorSummary _elem147; // required
                        _elem147 = new ExecutorSummary();
                        _elem147.read(iprot);
                        this.executors.add(_elem147);
                    }
                    iprot.readListEnd();
                }
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 5: // STATUS
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
                this.status = iprot.readString();
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 6: // ERRORS
            if (field.type == org.apache.thrift.protocol.TType.MAP) {
                {
                    org.apache.thrift.protocol.TMap _map148 = iprot.readMapBegin();
                    this.errors = new HashMap<String, List<ErrorInfo>>(2 * _map148.size);
                    for (int _i149 = 0; _i149 < _map148.size; ++_i149) {
                        String _key150; // required
                        List<ErrorInfo> _val151; // required
                        _key150 = iprot.readString();
                        {
                            org.apache.thrift.protocol.TList _list152 = iprot.readListBegin();
                            _val151 = new ArrayList<ErrorInfo>(_list152.size);
                            for (int _i153 = 0; _i153 < _list152.size; ++_i153) {
                                ErrorInfo _elem154; // required
                                _elem154 = new ErrorInfo();
                                _elem154.read(iprot);
                                _val151.add(_elem154);
                            }
                            iprot.readListEnd();
                        }
                        this.errors.put(_key150, _val151);
                    }
                    iprot.readMapEnd();
                }
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 513: // SCHED_STATUS
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
                this.sched_status = iprot.readString();
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 514: // OWNER
            if (field.type == org.apache.thrift.protocol.TType.STRING) {
                this.owner = iprot.readString();
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
}

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

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;// w w w .  j a v  a 2 s  .c  om
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // KEY
            if (field.type == TType.STRING) {
                this.key = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // COLUMNS
            if (field.type == TType.LIST) {
                {
                    TList _list8 = iprot.readListBegin();
                    this.columns = new ArrayList<ColumnOrSuperColumn>(_list8.size);
                    for (int _i9 = 0; _i9 < _list8.size; ++_i9) {
                        ColumnOrSuperColumn _elem10;
                        _elem10 = new ColumnOrSuperColumn();
                        _elem10.read(iprot);
                        this.columns.add(_elem10);
                    }
                    iprot.readListEnd();
                }
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
}

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

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;//from   w  w w.  j  a v  a  2s.  c  o  m
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // COLUMN_NAMES
            if (field.type == TType.LIST) {
                {
                    TList _list4 = iprot.readListBegin();
                    this.column_names = new ArrayList<byte[]>(_list4.size);
                    for (int _i5 = 0; _i5 < _list4.size; ++_i5) {
                        byte[] _elem6;
                        _elem6 = iprot.readBinary();
                        this.column_names.add(_elem6);
                    }
                    iprot.readListEnd();
                }
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // SLICE_RANGE
            if (field.type == TType.STRUCT) {
                this.slice_range = new SliceRange();
                this.slice_range.read(iprot);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
}

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

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;//from   w w  w  .  jav  a2 s .  c  om
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // NAME
            if (field.type == TType.STRING) {
                this.name = iprot.readBinary();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // COLUMNS
            if (field.type == TType.LIST) {
                {
                    TList _list0 = iprot.readListBegin();
                    this.columns = new ArrayList<Column>(_list0.size);
                    for (int _i1 = 0; _i1 < _list0.size; ++_i1) {
                        Column _elem2;
                        _elem2 = new Column();
                        _elem2.read(iprot);
                        this.columns.add(_elem2);
                    }
                    iprot.readListEnd();
                }
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
}

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

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;/*from  w  ww. j a va  2  s .c om*/
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // START_TOKEN
            if (field.type == TType.STRING) {
                this.start_token = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // END_TOKEN
            if (field.type == TType.STRING) {
                this.end_token = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 3: // ENDPOINTS
            if (field.type == TType.LIST) {
                {
                    TList _list12 = iprot.readListBegin();
                    this.endpoints = new ArrayList<String>(_list12.size);
                    for (int _i13 = 0; _i13 < _list12.size; ++_i13) {
                        String _elem14;
                        _elem14 = iprot.readString();
                        this.endpoints.add(_elem14);
                    }
                    iprot.readListEnd();
                }
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
}

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

License:Apache License

@Override
public ArrayList<Object> deserialize(Object reuse, TProtocol iprot)
        throws SerDeException, TException, IllegalAccessException {
    TList thelist = iprot.readListBegin();
    if (thelist == null) {
        return null;
    }/* w ww .  j  a v a  2s .  c o m*/

    ArrayList<Object> deserializeReuse;
    if (reuse != null) {
        deserializeReuse = (ArrayList<Object>) reuse;
        // Trim to the size needed
        while (deserializeReuse.size() > thelist.size) {
            deserializeReuse.remove(deserializeReuse.size() - 1);
        }
    } else {
        deserializeReuse = new ArrayList<Object>();
    }
    deserializeReuse.ensureCapacity(thelist.size);
    for (int i = 0; i < thelist.size; i++) {
        if (i + 1 > deserializeReuse.size()) {
            deserializeReuse.add(getElementType().deserialize(null, iprot));
        } else {
            deserializeReuse.set(i, getElementType().deserialize(deserializeReuse.get(i), iprot));
        }
    }
    // in theory, the below call isn't needed in non thrift_mode, but let's not
    // get too crazy
    iprot.readListEnd();
    return deserializeReuse;
}