use of io.cdap.cdap.spi.hbase.CoprocessorDescriptor in project cdap by caskdata.
the class HBase11TableDescriptorUtil 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);
}
use of io.cdap.cdap.spi.hbase.CoprocessorDescriptor in project cdap by caskdata.
the class HBase11TableDescriptorUtil 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;
}
use of io.cdap.cdap.spi.hbase.CoprocessorDescriptor in project cdap by caskdata.
the class AbstractHBaseDataSetAdmin method addCoprocessor.
protected void addCoprocessor(HTableDescriptorBuilder tableDescriptor, Class<? extends Coprocessor> coprocessor, Integer priority) throws IOException {
CoprocessorDescriptor descriptor = coprocessorManager.getCoprocessorDescriptor(coprocessor, priority);
Path path = descriptor.getPath() == null ? null : new Path(descriptor.getPath());
tableDescriptor.addCoprocessor(descriptor.getClassName(), path, descriptor.getPriority(), descriptor.getProperties());
}
use of io.cdap.cdap.spi.hbase.CoprocessorDescriptor in project cdap by caskdata.
the class HBase12CDH570TableDescriptorUtil 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;
}
Aggregations