Package io.teknek.hiveunit.client

Source Code of io.teknek.hiveunit.client.ServiceHiveClient

package io.teknek.hiveunit.client;

import io.teknek.hiveunit.ServiceHive;
import io.teknek.hiveunit.common.Response;
import org.apache.thrift.TException;

/**
* HiveClient implementation for connecting to some running Hive.
*/
public class ServiceHiveClient implements HiveClient {
  private ServiceHive hive;

  public ServiceHiveClient(ServiceHive hive) {
    this.hive = hive;
  }

  @Override
  public Response execute(String command) {
    try {
      hive.client.execute(command);
      return new Response(hive.client.getStatus().getValue(), hive.client.fetchAll());
    } catch (TException e) {
      throw new RuntimeException(e);
    }
  }

  @Override
  public void close() {
    hive.transport.close();
  }
}
TOP

Related Classes of io.teknek.hiveunit.client.ServiceHiveClient

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.