Java Code Examples for org.apache.thrift.TException

The following are top voted examples for showing how to use org.apache.thrift.TException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: ditb   File: Hbase.java   Source Code and License 6 votes vote down vote up
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, incrementRows_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 _list453 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
      struct.increments = new ArrayList<TIncrement>(_list453.size);
      TIncrement _elem454;
      for (int _i455 = 0; _i455 < _list453.size; ++_i455)
      {
        _elem454 = new TIncrement();
        _elem454.read(iprot);
        struct.increments.add(_elem454);
      }
    }
    struct.setIncrementsIsSet(true);
  }
}
 
Example 2
Project: ditb   File: Hbase.java   Source Code and License 6 votes vote down vote up
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, scannerOpenWithStopTs_result struct) throws org.apache.thrift.TException {
  TTupleProtocol oprot = (TTupleProtocol) prot;
  BitSet optionals = new BitSet();
  if (struct.isSetSuccess()) {
    optionals.set(0);
  }
  if (struct.isSetIo()) {
    optionals.set(1);
  }
  oprot.writeBitSet(optionals, 2);
  if (struct.isSetSuccess()) {
    oprot.writeI32(struct.success);
  }
  if (struct.isSetIo()) {
    struct.io.write(oprot);
  }
}
 
Example 3
Project: athena   File: Bmv2DeviceThriftClient.java   Source Code and License 6 votes vote down vote up
@Override
public Pair<Long, Long> readCounter(String counterName, int index) throws Bmv2RuntimeException {

    log.debug("Reading table entry counters... > deviceId={}, counterName={}, index={}",
              deviceId, counterName, index);

    try {
        BmCounterValue counterValue = standardClient.bm_counter_read(CONTEXT_ID, counterName, index);
        log.debug("Table entry counters retrieved! >deviceId={}, counterName={}, index={}, bytes={}, packets={}",
                  deviceId, counterName, index, counterValue.bytes, counterValue.packets);
        return Pair.of(counterValue.bytes, counterValue.packets);
    } catch (TException e) {
        log.debug("Exception while reading table counters: {} > deviceId={}, counterName={}, index={}",
                  e.toString(), deviceId);
        throw parseTException(e);
    }
}
 
Example 4
Project: ditb   File: Hbase.java   Source Code and License 6 votes vote down vote up
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, isTableEnabled_result struct) throws org.apache.thrift.TException {
  TTupleProtocol oprot = (TTupleProtocol) prot;
  BitSet optionals = new BitSet();
  if (struct.isSetSuccess()) {
    optionals.set(0);
  }
  if (struct.isSetIo()) {
    optionals.set(1);
  }
  oprot.writeBitSet(optionals, 2);
  if (struct.isSetSuccess()) {
    oprot.writeBool(struct.success);
  }
  if (struct.isSetIo()) {
    struct.io.write(oprot);
  }
}
 
Example 5
Project: Cobweb   File: LocalWorkerCrawlerServiceBase.java   Source Code and License 6 votes vote down vote up
public void write(org.apache.thrift.protocol.TProtocol oprot, updateTaskProgressRate_args struct) throws TException {
    struct.validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (struct.taskId != null) {
        oprot.writeFieldBegin(TASK_ID_FIELD_DESC);
        oprot.writeString(struct.taskId);
        oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(NEW_PROGRESS_RATE_FIELD_DESC);
    oprot.writeI32(struct.newProgressRate);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(MARKUP_FIELD_DESC);
    oprot.writeI32(struct.markup);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(STATUS_FIELD_DESC);
    oprot.writeByte(struct.status);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}
 
Example 6
Project: java-benchmark   File: DeserThrift.java   Source Code and License 6 votes vote down vote up
@Setup(Level.Trial)
public void benchSetup(BenchmarkParams params) throws TException {
    testObject = new ThriftTestObject();
    testObject.addToField1(31.415926);
    testObject.addToField1(61.415923);
    testObject.addToField1(31.415269);
    testObject.addToField1(53.141926);
    testObject.addToField1(13.145926);
    testObject.addToField1(43.115926);
    testObject.addToField1(31.419265);
    testObject.addToField1(23.141596);
    testObject.addToField1(43.161592);
    testObject.addToField1(0.112);
    serializer = new TSerializer(new TCompactProtocol.Factory());
    deserializer = new TDeserializer(new TCompactProtocol.Factory());
    testData = serializer.serialize(testObject);
}
 
Example 7
Project: fresco_floodlight   File: VersionedValue.java   Source Code and License 6 votes vote down vote up
public void write(org.apache.thrift.protocol.TProtocol oprot, VersionedValue struct) throws org.apache.thrift.TException {
  struct.validate();

  oprot.writeStructBegin(STRUCT_DESC);
  if (struct.value != null) {
    if (struct.isSetValue()) {
      oprot.writeFieldBegin(VALUE_FIELD_DESC);
      oprot.writeBinary(struct.value);
      oprot.writeFieldEnd();
    }
  }
  if (struct.version != null) {
    oprot.writeFieldBegin(VERSION_FIELD_DESC);
    struct.version.write(oprot);
    oprot.writeFieldEnd();
  }
  oprot.writeFieldStop();
  oprot.writeStructEnd();
}
 
Example 8
Project: ditb   File: TIllegalArgument.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 9
Project: ditb   File: Hbase.java   Source Code and License 5 votes vote down vote up
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, getRows_args struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  BitSet incoming = iprot.readBitSet(3);
  if (incoming.get(0)) {
    struct.tableName = iprot.readBinary();
    struct.setTableNameIsSet(true);
  }
  if (incoming.get(1)) {
    {
      org.apache.thrift.protocol.TList _list237 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
      struct.rows = new ArrayList<ByteBuffer>(_list237.size);
      ByteBuffer _elem238;
      for (int _i239 = 0; _i239 < _list237.size; ++_i239)
      {
        _elem238 = iprot.readBinary();
        struct.rows.add(_elem238);
      }
    }
    struct.setRowsIsSet(true);
  }
  if (incoming.get(2)) {
    {
      org.apache.thrift.protocol.TMap _map240 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
      struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map240.size);
      ByteBuffer _key241;
      ByteBuffer _val242;
      for (int _i243 = 0; _i243 < _map240.size; ++_i243)
      {
        _key241 = iprot.readBinary();
        _val242 = iprot.readBinary();
        struct.attributes.put(_key241, _val242);
      }
    }
    struct.setAttributesIsSet(true);
  }
}
 
Example 10
Project: ditb   File: THBaseService.java   Source Code and License 5 votes vote down vote up
public void read(org.apache.thrift.protocol.TProtocol iprot, deleteSingle_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 1: // IO
        if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
          struct.io = new TIOError();
          struct.io.read(iprot);
          struct.setIoIsSet(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();
}
 
Example 11
Project: iotdb-jdbc   File: TSQueryDataSet.java   Source Code and License 5 votes vote down vote up
public void write(org.apache.thrift.protocol.TProtocol oprot, TSQueryDataSet struct) throws org.apache.thrift.TException {
  struct.validate();

  oprot.writeStructBegin(STRUCT_DESC);
  if (struct.keys != null) {
    oprot.writeFieldBegin(KEYS_FIELD_DESC);
    {
      oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.keys.size()));
      for (String _iter122 : struct.keys)
      {
        oprot.writeString(_iter122);
      }
      oprot.writeListEnd();
    }
    oprot.writeFieldEnd();
  }
  if (struct.values != null) {
    oprot.writeFieldBegin(VALUES_FIELD_DESC);
    {
      oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.values.size()));
      for (TSDynamicOneColumnData _iter123 : struct.values)
      {
        _iter123.write(oprot);
      }
      oprot.writeListEnd();
    }
    oprot.writeFieldEnd();
  }
  oprot.writeFieldStop();
  oprot.writeStructEnd();
}
 
Example 12
Project: ditb   File: ThriftHBaseServiceHandler.java   Source Code and License 5 votes vote down vote up
@Override
public void mutateRow(ByteBuffer table, TRowMutations rowMutations) throws TIOError, TException {
  Table htable = getTable(table);
  try {
    htable.mutateRow(rowMutationsFromThrift(rowMutations));
  } catch (IOException e) {
    throw getTIOError(e);
  } finally {
    closeTable(htable);
  }
}
 
Example 13
Project: ditb   File: THBaseService.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 14
Project: ditb   File: TColumn.java   Source Code and License 5 votes vote down vote up
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TColumn struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  struct.family = iprot.readBinary();
  struct.setFamilyIsSet(true);
  BitSet incoming = iprot.readBitSet(2);
  if (incoming.get(0)) {
    struct.qualifier = iprot.readBinary();
    struct.setQualifierIsSet(true);
  }
  if (incoming.get(1)) {
    struct.timestamp = iprot.readI64();
    struct.setTimestampIsSet(true);
  }
}
 
Example 15
Project: Cobweb   File: LocalWorkerCrawlerServiceBase.java   Source Code and License 5 votes vote down vote up
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException {
    prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("finishTask", org.apache.thrift.protocol.TMessageType.CALL, 0));
    finishTask_args args = new finishTask_args();
    args.setTaskId(taskId);
    args.write(prot);
    prot.writeMessageEnd();
}
 
Example 16
Project: dremio-oss   File: HiveClient.java   Source Code and License 5 votes vote down vote up
List<String> getDatabases(boolean ignoreAuthzErrors) throws TException{
  return doCommand(new RetryableClientCommand<List<String>>(){
    @Override
    public List<String> run(HiveMetaStoreClient client) throws TException {
      return client.getAllDatabases();
    }});
}
 
Example 17
Project: waggle-dance   File: FederatedHMSHandler.java   Source Code and License 5 votes vote down vote up
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
@Override
public boolean delete_table_column_statistics(String db_name, String tbl_name, String col_name)
  throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException, TException {
  DatabaseMapping mapping = checkWritePermissions(db_name);
  return mapping.getClient().delete_table_column_statistics(mapping.transformInboundDatabaseName(db_name), tbl_name,
      col_name);
}
 
Example 18
Project: Cobweb   File: LocalWorkerCrawlerServiceBase.java   Source Code and License 5 votes vote down vote up
public void read(org.apache.thrift.protocol.TProtocol iprot, finishTask_result struct) throws 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.BOOL) {
                    struct.success = iprot.readBool();
                    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();
}
 
Example 19
Project: ditb   File: Hbase.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 20
Project: iotdb-jdbc   File: TSGetOperationStatusResp.java   Source Code and License 5 votes vote down vote up
public void write(org.apache.thrift.protocol.TProtocol oprot, TSGetOperationStatusResp struct) throws org.apache.thrift.TException {
  struct.validate();

  oprot.writeStructBegin(STRUCT_DESC);
  if (struct.status != null) {
    oprot.writeFieldBegin(STATUS_FIELD_DESC);
    struct.status.write(oprot);
    oprot.writeFieldEnd();
  }
  oprot.writeFieldStop();
  oprot.writeStructEnd();
}
 
Example 21
Project: ditb   File: Hbase.java   Source Code and License 5 votes vote down vote up
public void recv_disableTable() throws IOError, org.apache.thrift.TException
{
  disableTable_result result = new disableTable_result();
  receiveBase(result, "disableTable");
  if (result.io != null) {
    throw result.io;
  }
  return;
}
 
Example 22
Project: fresco_floodlight   File: SwitchPortTuple.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 23
Project: Cobweb   File: LocalWorkerCrawlerServiceBase.java   Source Code and License 5 votes vote down vote up
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
        // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
        __isset_bitfield = 0;
        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (TException te) {
        throw new java.io.IOException(te);
    }
}
 
Example 24
Project: ditb   File: Hbase.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 25
Project: ditb   File: Hbase.java   Source Code and License 5 votes vote down vote up
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
  try {
    // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
    __isset_bitfield = 0;
    read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
  } catch (org.apache.thrift.TException te) {
    throw new java.io.IOException(te);
  }
}
 
Example 26
Project: iotdb-jdbc   File: TSIService.java   Source Code and License 5 votes vote down vote up
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
  prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("executeStatement", org.apache.thrift.protocol.TMessageType.CALL, 0));
  executeStatement_args args = new executeStatement_args();
  args.setReq(req);
  args.write(prot);
  prot.writeMessageEnd();
}
 
Example 27
Project: fresco_floodlight   File: PacketStreamer.java   Source Code and License 5 votes vote down vote up
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, pushMessageSync_args struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  BitSet incoming = iprot.readBitSet(1);
  if (incoming.get(0)) {
    struct.packet = new Message();
    struct.packet.read(iprot);
    struct.setPacketIsSet(true);
  }
}
 
Example 28
Project: iTAP-controller   File: SyncError.java   Source Code and License 5 votes vote down vote up
public void write(org.apache.thrift.protocol.TProtocol oprot, SyncError struct) throws org.apache.thrift.TException {
  struct.validate();

  oprot.writeStructBegin(STRUCT_DESC);
  oprot.writeFieldBegin(ERROR_CODE_FIELD_DESC);
  oprot.writeI32(struct.errorCode);
  oprot.writeFieldEnd();
  if (struct.message != null) {
    oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
    oprot.writeString(struct.message);
    oprot.writeFieldEnd();
  }
  oprot.writeFieldStop();
  oprot.writeStructEnd();
}
 
Example 29
Project: ditb   File: Hbase.java   Source Code and License 5 votes vote down vote up
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
  try {
    // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
    __isset_bitfield = 0;
    read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
  } catch (org.apache.thrift.TException te) {
    throw new java.io.IOException(te);
  }
}
 
Example 30
Project: scheduler   File: SchedulerService.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 31
Project: ditb   File: Hbase.java   Source Code and License 5 votes vote down vote up
public getTableNames_result getResult(I iface, getTableNames_args args) throws org.apache.thrift.TException {
  getTableNames_result result = new getTableNames_result();
  try {
    result.success = iface.getTableNames();
  } catch (IOError io) {
    result.io = io;
  }
  return result;
}
 
Example 32
Project: ditb   File: THBaseService.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 33
Project: waggle-dance   File: FederatedHMSHandler.java   Source Code and License 5 votes vote down vote up
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
@Override
public Partition add_partition(Partition new_part)
  throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  DatabaseMapping mapping = checkWritePermissions(new_part.getDbName());
  Partition result = mapping.getClient().add_partition(mapping.transformInboundPartition(new_part));
  return mapping.transformOutboundPartition(result);
}
 
Example 34
Project: ditb   File: THBaseService.java   Source Code and License 5 votes vote down vote up
public TResult getResult() throws TIOError, 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_increment();
}
 
Example 35
Project: ditb   File: THBaseService.java   Source Code and License 5 votes vote down vote up
public int getResult() throws TIOError, 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_openScanner();
}
 
Example 36
Project: iotdb-jdbc   File: TS_Status.java   Source Code and License 5 votes vote down vote up
public void validate() throws org.apache.thrift.TException {
  // check for required fields
  if (statusCode == null) {
    throw new org.apache.thrift.protocol.TProtocolException("Required field 'statusCode' was not present! Struct: " + toString());
  }
  // check for sub-struct validity
}
 
Example 37
Project: ditb   File: TRowResult.java   Source Code and License 5 votes vote down vote up
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TRowResult struct) throws org.apache.thrift.TException {
  TTupleProtocol oprot = (TTupleProtocol) prot;
  BitSet optionals = new BitSet();
  if (struct.isSetRow()) {
    optionals.set(0);
  }
  if (struct.isSetColumns()) {
    optionals.set(1);
  }
  if (struct.isSetSortedColumns()) {
    optionals.set(2);
  }
  oprot.writeBitSet(optionals, 3);
  if (struct.isSetRow()) {
    oprot.writeBinary(struct.row);
  }
  if (struct.isSetColumns()) {
    {
      oprot.writeI32(struct.columns.size());
      for (Map.Entry<ByteBuffer, TCell> _iter17 : struct.columns.entrySet())
      {
        oprot.writeBinary(_iter17.getKey());
        _iter17.getValue().write(oprot);
      }
    }
  }
  if (struct.isSetSortedColumns()) {
    {
      oprot.writeI32(struct.sortedColumns.size());
      for (TColumn _iter18 : struct.sortedColumns)
      {
        _iter18.write(oprot);
      }
    }
  }
}
 
Example 38
Project: scheduler   File: AgentService.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 39
Project: ditb   File: Hbase.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 40
Project: ditb   File: THBaseService.java   Source Code and License 5 votes vote down vote up
public increment_result getResult(I iface, increment_args args) throws org.apache.thrift.TException {
  increment_result result = new increment_result();
  try {
    result.success = iface.increment(args.table, args.tincrement);
  } catch (TIOError io) {
    result.io = io;
  }
  return result;
}
 
Example 41
Project: circus-train   File: Replica.java   Source Code and License 5 votes vote down vote up
public ReplicaLocationManager getLocationManager(
    TableType tableType,
    String targetTableLocation,
    String eventId,
    SourceLocationManager sourceLocationManager)
  throws TException {
  return new FullReplicationReplicaLocationManager(sourceLocationManager, targetTableLocation, eventId, tableType,
      housekeepingListener, replicaCatalogListener);
}
 
Example 42
Project: ditb   File: THBaseService.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 43
Project: iotdb-jdbc   File: TSCloseOperationReq.java   Source Code and License 5 votes vote down vote up
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TSCloseOperationReq struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  struct.operationHandle = new TSOperationHandle();
  struct.operationHandle.read(iprot);
  struct.setOperationHandleIsSet(true);
}
 
Example 44
Project: java-benchmark   File: DeserThrift.java   Source Code and License 5 votes vote down vote up
@Setup(Level.Trial)
public void benchSetup(BenchmarkParams params) throws TException {
    testObject = new ThriftTestObject();
    testObject.setField1("1");
    testObject.setField2("2");
    testObject.setField3("3");
    testObject.setField4("4");
    testObject.setField5("5");
    testObject.setField6("6");
    testObject.setField7("7");
    testObject.setField8("8");
    testObject.setField9("9");
    testObject.setField10("10");
    serializer = new TSerializer(new TCompactProtocol.Factory());
    deserializer = new TDeserializer(new TCompactProtocol.Factory());
    testData = serializer.serialize(testObject);
}
 
Example 45
Project: scheduler   File: AgentService.java   Source Code and License 5 votes vote down vote up
public void read(org.apache.thrift.protocol.TProtocol iprot, instructionInvokeSync_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: // INS
        if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
          struct.ins = new Instruct();
          struct.ins.read(iprot);
          struct.setInsIsSet(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();
}
 
Example 46
Project: Cobweb   File: LocalWorkerCrawlerService.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 47
Project: waggle-dance   File: FederatedHMSHandlerTest.java   Source Code and License 5 votes vote down vote up
@Test
public void get_partitions_pspec() throws NoSuchObjectException, MetaException, TException {
  List<PartitionSpec> partitionSpecs = Lists.newArrayList();
  List<PartitionSpec> outbound = Lists.newArrayList();
  when(primaryMapping.transformInboundDatabaseName(DB_P)).thenReturn("inbound");
  when(primaryClient.get_partitions_pspec("inbound", "table", (short) 10)).thenReturn(partitionSpecs);
  when(primaryMapping.transformOutboundPartitionSpecs(partitionSpecs)).thenReturn(outbound);
  List<PartitionSpec> result = handler.get_partitions_pspec(DB_P, "table", (short) 10);
  assertThat(result, is(outbound));
  verify(primaryMapping, never()).checkWritePermissions(DB_P);
}
 
Example 48
Project: Cobweb   File: LocalWorkerCrawlerService.java   Source Code and License 5 votes vote down vote up
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
  prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("updateTaskProgressRate", org.apache.thrift.protocol.TMessageType.CALL, 0));
  updateTaskProgressRate_args args = new updateTaskProgressRate_args();
  args.setTaskId(taskId);
  args.setNewProgressRate(newProgressRate);
  args.setMarkup(markup);
  args.setStatus(status);
  args.write(prot);
  prot.writeMessageEnd();
}
 
Example 49
Project: iotdb-jdbc   File: TSGetOperationStatusResp.java   Source Code and License 5 votes vote down vote up
public void read(org.apache.thrift.protocol.TProtocol iprot, TSGetOperationStatusResp 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: // STATUS
        if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
          struct.status = new TS_Status();
          struct.status.read(iprot);
          struct.setStatusIsSet(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();
}
 
Example 50
Project: ditb   File: Hbase.java   Source Code and License 5 votes vote down vote up
public List<TCell> recv_append() throws IOError, org.apache.thrift.TException
{
  append_result result = new append_result();
  receiveBase(result, "append");
  if (result.isSetSuccess()) {
    return result.success;
  }
  if (result.io != null) {
    throw result.io;
  }
  throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "append failed: unknown result");
}
 
Example 51
Project: Cobweb   File: LocalWorkerCrawlerServiceBase.java   Source Code and License 5 votes vote down vote up
public void write(org.apache.thrift.protocol.TProtocol oprot, getLastProgressRate_result struct) throws TException {
    struct.validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (struct.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI32(struct.success);
        oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
}
 
Example 52
Project: iotdb-jdbc   File: TSIService.java   Source Code and License 5 votes vote down vote up
public TSFetchMetadataResp 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_fetchMetadata();
}
 
Example 53
Project: iTAP-controller   File: SwitchPortTuple.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 54
Project: ditb   File: Hbase.java   Source Code and License 5 votes vote down vote up
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);
  }
}
 
Example 55
Project: ditb   File: THBaseService.java   Source Code and License 5 votes vote down vote up
public void send_append(ByteBuffer table, TAppend tappend) throws org.apache.thrift.TException
{
  append_args args = new append_args();
  args.setTable(table);
  args.setTappend(tappend);
  sendBase("append", args);
}
 
Example 56
Project: fresco_floodlight   File: ClockEntry.java   Source Code and License 4 votes vote down vote up
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
  schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
 
Example 57
Project: iTAP-controller   File: EchoRequestMessage.java   Source Code and License 4 votes vote down vote up
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
  schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
 
Example 58
Project: ditb   File: Hbase.java   Source Code and License 4 votes vote down vote up
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, scannerOpenTs_args struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  BitSet incoming = iprot.readBitSet(5);
  if (incoming.get(0)) {
    struct.tableName = iprot.readBinary();
    struct.setTableNameIsSet(true);
  }
  if (incoming.get(1)) {
    struct.startRow = iprot.readBinary();
    struct.setStartRowIsSet(true);
  }
  if (incoming.get(2)) {
    {
      org.apache.thrift.protocol.TList _list541 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
      struct.columns = new ArrayList<ByteBuffer>(_list541.size);
      ByteBuffer _elem542;
      for (int _i543 = 0; _i543 < _list541.size; ++_i543)
      {
        _elem542 = iprot.readBinary();
        struct.columns.add(_elem542);
      }
    }
    struct.setColumnsIsSet(true);
  }
  if (incoming.get(3)) {
    struct.timestamp = iprot.readI64();
    struct.setTimestampIsSet(true);
  }
  if (incoming.get(4)) {
    {
      org.apache.thrift.protocol.TMap _map544 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
      struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map544.size);
      ByteBuffer _key545;
      ByteBuffer _val546;
      for (int _i547 = 0; _i547 < _map544.size; ++_i547)
      {
        _key545 = iprot.readBinary();
        _val546 = iprot.readBinary();
        struct.attributes.put(_key545, _val546);
      }
    }
    struct.setAttributesIsSet(true);
  }
}
 
Example 59
Project: Cobweb   File: HelloWorldService.java   Source Code and License 4 votes vote down vote up
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
 
Example 60
Project: beeju   File: HiveMetaStoreJUnitRuleTest.java   Source Code and License 4 votes vote down vote up
@Test(expected = AlreadyExistsException.class)
public void createExistingDatabase() throws TException {
  hiveDefaultName.createDatabase(hiveDefaultName.databaseName());
}