Search in sources :

Example 1 with ColumnFamilyDescriptor

use of io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor in project cdap by caskdata.

the class HBase10CDHTableDescriptorUtil method getHTableDescriptor.

public static HTableDescriptor getHTableDescriptor(TableDescriptor descriptor) {
    TableName tableName = TableName.valueOf(descriptor.getNamespace(), descriptor.getName());
    HTableDescriptor htd = new HTableDescriptor(tableName);
    for (Map.Entry<String, ColumnFamilyDescriptor> family : descriptor.getFamilies().entrySet()) {
        htd.addFamily(getHColumnDesciptor(family.getValue()));
    }
    for (Map.Entry<String, CoprocessorDescriptor> coprocessor : descriptor.getCoprocessors().entrySet()) {
        CoprocessorDescriptor cpd = coprocessor.getValue();
        try {
            Path path = cpd.getPath() == null ? null : new Path(cpd.getPath());
            htd.addCoprocessor(cpd.getClassName(), path, cpd.getPriority(), cpd.getProperties());
        } catch (IOException e) {
            LOG.error("Error adding coprocessor.", e);
        }
    }
    for (Map.Entry<String, String> property : descriptor.getProperties().entrySet()) {
        htd.setValue(property.getKey(), property.getValue());
    }
    return htd;
}
Also used : Path(org.apache.hadoop.fs.Path) TableName(org.apache.hadoop.hbase.TableName) IOException(java.io.IOException) ColumnFamilyDescriptor(io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor) CoprocessorDescriptor(io.cdap.cdap.spi.hbase.CoprocessorDescriptor) HashMap(java.util.HashMap) Map(java.util.Map) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor)

Example 2 with ColumnFamilyDescriptor

use of io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor in project cdap by caskdata.

the class HBase10CDHTableDescriptorUtil method getTableDescriptor.

public static TableDescriptor getTableDescriptor(HTableDescriptor descriptor) {
    Set<ColumnFamilyDescriptor> families = new HashSet<>();
    for (HColumnDescriptor family : descriptor.getColumnFamilies()) {
        families.add(getColumnFamilyDescriptor(family));
    }
    Set<CoprocessorDescriptor> coprocessors = new HashSet<>();
    coprocessors.addAll(CoprocessorUtil.getCoprocessors(descriptor).values());
    Map<String, String> properties = CoprocessorUtil.getNonCoprocessorProperties(descriptor);
    // TODO: should add configurations as well
    return new TableDescriptor(descriptor.getTableName().getNamespaceAsString(), descriptor.getTableName().getQualifierAsString(), families, coprocessors, properties);
}
Also used : HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) ColumnFamilyDescriptor(io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor) CoprocessorDescriptor(io.cdap.cdap.spi.hbase.CoprocessorDescriptor) TableDescriptor(io.cdap.cdap.spi.hbase.TableDescriptor) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) HashSet(java.util.HashSet)

Example 3 with ColumnFamilyDescriptor

use of io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor in project cdap by caskdata.

the class HBase12CDH570TableDescriptorUtil method getTableDescriptor.

public static TableDescriptor getTableDescriptor(HTableDescriptor descriptor) {
    Set<ColumnFamilyDescriptor> families = new HashSet<>();
    for (HColumnDescriptor family : descriptor.getColumnFamilies()) {
        families.add(getColumnFamilyDescriptor(family));
    }
    Set<CoprocessorDescriptor> coprocessors = new HashSet<>();
    coprocessors.addAll(CoprocessorUtil.getCoprocessors(descriptor).values());
    Map<String, String> properties = CoprocessorUtil.getNonCoprocessorProperties(descriptor);
    // TODO: should add configurations as well
    return new TableDescriptor(descriptor.getTableName().getNamespaceAsString(), descriptor.getTableName().getQualifierAsString(), families, coprocessors, properties);
}
Also used : HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) ColumnFamilyDescriptor(io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor) CoprocessorDescriptor(io.cdap.cdap.spi.hbase.CoprocessorDescriptor) TableDescriptor(io.cdap.cdap.spi.hbase.TableDescriptor) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) HashSet(java.util.HashSet)

Example 4 with ColumnFamilyDescriptor

use of io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor in project cdap by caskdata.

the class HBase10CDH550TableDescriptorUtil method getTableDescriptor.

public static TableDescriptor getTableDescriptor(HTableDescriptor descriptor) {
    Set<ColumnFamilyDescriptor> families = new HashSet<>();
    for (HColumnDescriptor family : descriptor.getColumnFamilies()) {
        families.add(getColumnFamilyDescriptor(family));
    }
    Set<CoprocessorDescriptor> coprocessors = new HashSet<>();
    coprocessors.addAll(CoprocessorUtil.getCoprocessors(descriptor).values());
    Map<String, String> properties = CoprocessorUtil.getNonCoprocessorProperties(descriptor);
    // TODO: should add configurations as well
    return new TableDescriptor(descriptor.getTableName().getNamespaceAsString(), descriptor.getTableName().getQualifierAsString(), families, coprocessors, properties);
}
Also used : HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) ColumnFamilyDescriptor(io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor) CoprocessorDescriptor(io.cdap.cdap.spi.hbase.CoprocessorDescriptor) TableDescriptor(io.cdap.cdap.spi.hbase.TableDescriptor) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) HashSet(java.util.HashSet)

Example 5 with ColumnFamilyDescriptor

use of io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor in project cdap by caskdata.

the class HBase10CDH550TableDescriptorUtil method getHTableDescriptor.

public static HTableDescriptor getHTableDescriptor(TableDescriptor descriptor) {
    TableName tableName = TableName.valueOf(descriptor.getNamespace(), descriptor.getName());
    HTableDescriptor htd = new HTableDescriptor(tableName);
    for (Map.Entry<String, ColumnFamilyDescriptor> family : descriptor.getFamilies().entrySet()) {
        htd.addFamily(getHColumnDesciptor(family.getValue()));
    }
    for (Map.Entry<String, CoprocessorDescriptor> coprocessor : descriptor.getCoprocessors().entrySet()) {
        CoprocessorDescriptor cpd = coprocessor.getValue();
        try {
            Path path = cpd.getPath() == null ? null : new Path(cpd.getPath());
            htd.addCoprocessor(cpd.getClassName(), path, cpd.getPriority(), cpd.getProperties());
        } catch (IOException e) {
            LOG.error("Error adding coprocessor.", e);
        }
    }
    for (Map.Entry<String, String> property : descriptor.getProperties().entrySet()) {
        htd.setValue(property.getKey(), property.getValue());
    }
    return htd;
}
Also used : Path(org.apache.hadoop.fs.Path) TableName(org.apache.hadoop.hbase.TableName) IOException(java.io.IOException) ColumnFamilyDescriptor(io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor) CoprocessorDescriptor(io.cdap.cdap.spi.hbase.CoprocessorDescriptor) HashMap(java.util.HashMap) Map(java.util.Map) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor)

Aggregations

ColumnFamilyDescriptor (io.cdap.cdap.spi.hbase.ColumnFamilyDescriptor)10 CoprocessorDescriptor (io.cdap.cdap.spi.hbase.CoprocessorDescriptor)10 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)10 TableDescriptor (io.cdap.cdap.spi.hbase.TableDescriptor)5 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 Map (java.util.Map)5 Path (org.apache.hadoop.fs.Path)5 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)5 TableName (org.apache.hadoop.hbase.TableName)5