Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HConnection


 
  public ReturnMsg execute(final Configuration conf) {
    if (this.tableName == null)
      return new ReturnMsg(0, "Syntax error : Please check 'Describe' syntax");
    try {
      HConnection conn = HConnectionManager.getConnection(conf);
      if (!conn.tableExists(this.tableName)) {
        return new ReturnMsg(0, "Table not found");
      }
      HTableDescriptor [] tables = conn.listTables();
      HColumnDescriptor [] columns = null;
      for (int i = 0; i < tables.length; i++) {
        if (tables[i].getName().equals(this.tableName)) {
          columns = tables[i].getFamilies().values().
            toArray(new HColumnDescriptor [] {});
View Full Code Here


  public ReturnMsg execute(HBaseConfiguration conf) {
    if (columnList == null) {
      throw new IllegalArgumentException("Column list is null");
    }
    try {
      HConnection conn = HConnectionManager.getConnection(conf);
      if (!conn.tableExists(tableName)) {
        return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
      }

      HBaseAdmin admin = new HBaseAdmin(conf);
      HTable hTable = new HTable(conf, tableName);
View Full Code Here

  public ReturnMsg execute(final HBaseConfiguration conf) {
    if (tableName == null)
      return new ReturnMsg(0, "Syntax error : Please check 'Describe' syntax.");
    try {
      HConnection conn = HConnectionManager.getConnection(conf);
      if (!conn.tableExists(tableName)) {
        return new ReturnMsg(0, "Table not found.");
      }
      HTableDescriptor[] tables = conn.listTables();
      HColumnDescriptor[] columns = null;
      for (int i = 0; i < tables.length; i++) {
        if (tables[i].getName().equals(tableName)) {
          columns = tables[i].getFamilies().values().toArray(
              new HColumnDescriptor[] {});
View Full Code Here

      throw new IllegalArgumentException("List of tables is null.");
    }

    try {
      HBaseAdmin admin = new HBaseAdmin(conf);
      HConnection conn = HConnectionManager.getConnection(conf);

      int count = 0;
      for (String table : tableList) {
        if (!conn.tableExists(new Text(table))) {
          println("'" + table + "' table not found.");
        } else {
          println("Dropping " + table + "... Please wait.");
          admin.deleteTable(new Text(table));
          count++;
View Full Code Here

  public ReturnMsg execute(HBaseConfiguration conf) {
    if (tableName == null || values == null || rowKey == null)
      return new ReturnMsg(0, "Syntax error : Please check 'Insert' syntax.");

    HConnection conn = HConnectionManager.getConnection(conf);
    if (!conn.tableExists(tableName)) {
      return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
    }

    if (columnfamilies.size() != values.size())
      return new ReturnMsg(0,
View Full Code Here

    super(o);
  }

  public ReturnMsg execute(HBaseConfiguration conf) {
    try {
      HConnection conn = HConnectionManager.getConnection(conf);
      if (conn.tableExists(tableName)) {
        return new ReturnMsg(0, "'" + tableName + "' table already exist.");
      }

      HBaseAdmin admin = new HBaseAdmin(conf);
      HTableDescriptor tableDesc = new HTableDescriptor(tableName.toString());
View Full Code Here

  }

  public ReturnMsg execute(HBaseConfiguration conf) {
    assert tableName != null;
    try {
      HConnection conn = HConnectionManager.getConnection(conf);
      if (!conn.tableExists(new Text(tableName))) {
        return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
      }

      HBaseAdmin admin = new HBaseAdmin(conf);
      admin.enableTable(new Text(tableName));
View Full Code Here

  public ReturnMsg execute(final HBaseConfiguration conf) {
    if (tableName.equals("") || rowKey == null || columns.size() == 0) {
      return new ReturnMsg(0, "Syntax error : Please check 'Select' syntax.");
    }
    try {
      HConnection conn = HConnectionManager.getConnection(conf);
      if (!conn.tableExists(tableName) && !isMetaTable()) {
        return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
      }

      HTable table = new HTable(conf, tableName);
      HBaseAdmin admin = new HBaseAdmin(conf);
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public ReturnMsg execute(HBaseConfiguration conf) {
    try {
      HConnection conn = HConnectionManager.getConnection(conf);
      if (!conn.tableExists(new Text(this.tableName))) {
        return new ReturnMsg(0, "'" + this.tableName + "'" + TABLE_NOT_FOUND);
      }

      HBaseAdmin admin = new HBaseAdmin(conf);
      Set<String> columns = null;
View Full Code Here

  public ReturnMsg execute(HBaseConfiguration conf) {
    assert tableName != null;

    try {
      HConnection conn = HConnectionManager.getConnection(conf);
      if (!conn.tableExists(new Text(tableName))) {
        return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
      }

      HBaseAdmin admin = new HBaseAdmin(conf);
      admin.disableTable(new Text(tableName));
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.HConnection

Copyright © 2018 www.massapicom. 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.