Package com.alibaba.wasp.client

Examples of com.alibaba.wasp.client.MasterAdminKeepAliveConnection


        } else {
          throw new ServiceException(
              "The instance of Plan is not supported. SQL:" + sql);
        }
      } else if (executePlan instanceof DDLPlan) {
        MasterAdminKeepAliveConnection masterAdminKeepAliveConnection = this.connection
            .getKeepAliveMasterAdmin();

        if(executePlan instanceof NotingTodoPlan) {
          return ResponseConverter.buildNotExecuteResponse();
        } else if (executePlan instanceof AlterTablePlan) {
          FTable hTableDesc = ((AlterTablePlan) executePlan).getNewTable();
          return modifyTable(masterAdminKeepAliveConnection, hTableDesc);
        } else if (executePlan instanceof CreateTablePlan) {
          CreateTablePlan createTable = (CreateTablePlan) executePlan;
          MasterAdminProtos.CreateTableResponse response = masterAdminKeepAliveConnection
              .createTable(
                  null,
                  RequestConverter.buildCreateTableRequest(
                      createTable.getTable(), createTable.getSplitKeys()));
          return ResponseConverter.buildExecuteResponse(response);
        } else if (executePlan instanceof CreateIndexPlan) {
          CreateIndexPlan createIndexPlan = (CreateIndexPlan) executePlan;
          Index index = createIndexPlan.getIndex();
          MasterAdminProtos.CreateIndexRequest request = RequestConverter
              .buildCreateIndexRequest(index);
          return ResponseConverter
              .buildExecuteResponse(masterAdminKeepAliveConnection.createIndex(
                  null, request));
        } else if (executePlan instanceof DropIndexPlan) {
          DropIndexPlan dropIndexPlan = (DropIndexPlan) executePlan;
          MasterAdminProtos.DropIndexRequest request = RequestConverter.buildDropIndexRequest(
              dropIndexPlan.getTableName(), dropIndexPlan.getIndexName());
          return ResponseConverter
              .buildExecuteResponse(masterAdminKeepAliveConnection.deleteIndex(
                  null, request));
        } else if (executePlan instanceof DropTablePlan) {
          List<DeleteTableResponse> responses = new ArrayList<DeleteTableResponse>();
          for (String tableName : ((DropTablePlan) executePlan).getTableNames()) {
            byte[] byteName = Bytes.toBytes(tableName);
            if (this.connection.isTableDisabled(byteName)) {
              MasterAdminProtos.DeleteTableRequest request = RequestConverter
                  .buildDeleteTableRequest(byteName);
              responses.add(masterAdminKeepAliveConnection.deleteTable(null,
                  request));
            } else {
              throw new TableNotDisabledException(tableName);
            }
          }
          return ResponseConverter.buildListExecuteResponse(responses);
        } else if (executePlan instanceof TruncateTablePlan) {
          List<TruncateTableResponse> responses = new ArrayList<TruncateTableResponse>();
          for (String tableName : ((TruncateTablePlan) executePlan)
              .getTableNames()) {
            byte[] byteName = Bytes.toBytes(tableName);
            if (this.connection.isTableDisabled(byteName)) {
              MasterAdminProtos.TruncateTableRequest request = RequestConverter
                  .buildTruncateTableRequest(byteName);
              responses.add(masterAdminKeepAliveConnection.truncateTable(null,
                  request));
            } else {
              throw new TableNotDisabledException(tableName);
            }
          }
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.client.MasterAdminKeepAliveConnection

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.