Package com.alibaba.wasp.meta

Examples of com.alibaba.wasp.meta.FTable


  }

  @Override
  public boolean checkTableNotExists(String tableName, boolean fetch)
      throws IOException {
    FTable table = reader.getSchema(tableName);
    if (table == null) {
      if (fetch) {
        table = TableSchemaCacheReader.getService(reader.getConf()).getTable(
            tableName);
      }
View Full Code Here


   * @throws java.io.IOException
   */
  @Override
  public String getColumnFamily(String fTableName, String columnName)
      throws IOException {
    FTable table = reader.getSchema(fTableName);
    if (table == null) {
      throw new UnsupportedException(fTableName + " is not exists!");
    }
    Field column = table.getColumn(columnName);
    if (column != null) {
      return column.getFamily();
    }
    throw new UnsupportedException(fTableName + " don't have column '" + columnName
        + "'");
View Full Code Here

    public boolean isTableAvailable(final byte[] tableName) throws IOException {
      if (!isTableEnabled(tableName)) {
        return false;
      }
      try {
        FTable fTable = this.getFTableDescriptor(tableName);
        byte[] rootTableName = null;
        if (fTable != null) {
          rootTableName = fTable.isRootTable() ? tableName : Bytes
              .toBytes(fTable.getParentName());
        }
        if (rootTableName == null || !isTableEnabled(rootTableName)) {
          return false;
        }
        return this
View Full Code Here

      if (tableName == null || tableName.length == 0) {
        throw new IllegalArgumentException(
            "table name cannot be null or zero length");
      }
      ensureZookeeperTrackers();
      FTable table = TableSchemaCacheReader.getInstance(this.conf).getSchema(
          Bytes.toString(tableName));
      if (table.isRootTable()) {
        // entityGroup not in the cache - have to go to read the meta table
        return locateEntityGroupInMeta(tableName, row, useCache,
            entityGroupLock);
      } else {
        return locateEntityGroupInMeta(Bytes.toBytes(table.getParentName()),
            row, useCache, entityGroupLock);
      }
    }
View Full Code Here

    }
    return ret;
  }

  public static FTable convertITableSchema(MasterMonitorProtos.ITableSchema proto) {
    FTable table = FTable.convert(proto.getTableSchema());
    LinkedHashMap<String, Index> indexs = new LinkedHashMap<String, Index>();
    for (MetaProtos.IndexSchema indexSchema : proto.getIndexSchemaList()) {
      Index index = Index.convert(indexSchema);
      indexs.put(index.getIndexName(), index);
    }
    table.setIndex(indexs);
    return table;
  }
View Full Code Here

  }

  @Override
  public CreateTableResponse createTable(RpcController controller,
      CreateTableRequest req) throws ServiceException {
    FTable tableDescriptor = FTable.convert(req.getTableSchema());
    byte[][] splitKeys = ProtobufUtil.getSplitKeysArray(req);
    try {
      createTable(tableDescriptor, splitKeys);
    } catch (IOException ioe) {
      throw new ServiceException(ioe);
View Full Code Here

  @Override
  public ModifyTableResponse modifyTable(RpcController controller,
      ModifyTableRequest req) throws ServiceException {
    final byte[] tableName = req.getTableName().toByteArray();
    FTable table = FTable.convert(req.getTableSchema());
    try {
      checkInitialized();
      TableEventHandler tblHandle = new ModifyTableHandler(tableName, table,
          this, this);
      this.executorService.submit(tblHandle);
View Full Code Here

          }
        }
      }
    } else {
      for (String s : req.getTableNamesList()) {
        FTable table = null;
        try {
          table = FMetaReader.getTable(this.conf, s);
        } catch (IOException e) {
          LOG.warn("Failed getting descriptor for " + s, e);
        }
View Full Code Here

   *          Table to check.
   * @return True if table exists already.
   * @throws java.io.IOException
   */
  public boolean tableExists(final byte[] tableName) throws IOException {
    FTable ftable = getTableDescriptor(tableName);
    return ftable == null ? false : true;
  }
View Full Code Here

   * @return - returns an array of Table
   * @throws java.io.IOException
   *           if a remote or network exception occurs
   */
  public Index[] listIndexes(final String tableName) throws IOException {
    FTable ftable = getTableDescriptor(Bytes.toBytes(tableName));
    LinkedHashMap<String, Index> indexMap = ftable.getIndex();
    Collection<Index> indexes = indexMap.values();
    return indexes.toArray(new Index[0]);
  }
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.meta.FTable

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.