public TableDescriptor build() { return new TableDescriptor(namespace, tableName, families, coprocessors, properties); } }
public ColumnFamilyDescriptor build() { return new ColumnFamilyDescriptor(name, maxVersions, compressionType, bloomType, properties); } }
public TableDescriptorBuilder(TableDescriptor descriptor) { this.namespace = descriptor.getNamespace(); this.tableName = descriptor.getName(); this.properties = descriptor.getProperties(); this.families.addAll(descriptor.getFamilies().values()); this.coprocessors.addAll(descriptor.getCoprocessors().values()); }
private static HColumnDescriptor getHColumnDesciptor(ColumnFamilyDescriptor descriptor) { HColumnDescriptor hFamily = new HColumnDescriptor(descriptor.getName()); hFamily.setMaxVersions(descriptor.getMaxVersions()); hFamily.setCompressionType(Compression.Algorithm.valueOf(descriptor.getCompressionType().name())); hFamily.setBloomFilterType(org.apache.hadoop.hbase.regionserver.BloomType.valueOf( descriptor.getBloomType().name())); for (Map.Entry<String, String> property : descriptor.getProperties().entrySet()) { hFamily.setValue(property.getKey(), property.getValue()); } return hFamily; }
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()); }
public TableDescriptor(String namespace, String name, Set<ColumnFamilyDescriptor> families, Set<CoprocessorDescriptor> coprocessors, Map<String, String> properties) { this.namespace = namespace; this.name = name; this.families = new HashMap<>(); for (ColumnFamilyDescriptor family : families) { this.families.put(family.getName(), family); } this.coprocessors = new HashMap<>(); for (CoprocessorDescriptor coprocessor : coprocessors) { this.coprocessors.put(coprocessor.getClassName(), coprocessor); } this.properties = properties == null ? Collections.<String, String>emptyMap() : Collections.unmodifiableMap(properties); }
@Override public void deleteTable(HBaseDDLExecutor ddlExecutor, TableId tableId) throws IOException { Preconditions.checkArgument(ddlExecutor != null, "HBaseDDLExecutor should not be null"); Preconditions.checkArgument(tableId != null, "Table Id should not be null."); TableName tableName = HTableNameConverter.toTableName(tablePrefix, tableId); ddlExecutor.deleteTableIfExists(tableName.getNamespaceAsString(), tableName.getQualifierAsString()); }
/** * Disables and deletes a table. * @param ddlExecutor the {@link HBaseDDLExecutor} to use to communicate with HBase * @param tableId {@link TableId} for the specified table * @throws IOException */ public void dropTable(HBaseDDLExecutor ddlExecutor, TableId tableId) throws IOException { TableName tableName = HTableNameConverter.toTableName(getTablePrefix(cConf), tableId); ddlExecutor.disableTableIfEnabled(tableName.getNamespaceAsString(), tableName.getQualifierAsString()); deleteTable(ddlExecutor, tableId); }
@Override public void initialize(HBaseDDLExecutorContext context) { try { this.admin = new HBaseAdmin((Configuration) context.getConfiguration()); } catch (Exception e) { throw new RuntimeException("Failed to create HBaseAdmin.", e); } }
/** * Truncates a table. * @param ddlExecutor the {@link HBaseDDLExecutor} to use to communicate with HBase * @param tableId {@link TableId} for the specified table * @throws IOException */ public void truncateTable(HBaseDDLExecutor ddlExecutor, TableId tableId) throws IOException { TableName tableName = HTableNameConverter.toTableName(getTablePrefix(cConf), tableId); ddlExecutor.truncateTable(tableName.getNamespaceAsString(), tableName.getQualifierAsString()); }
private static HColumnDescriptor getHColumnDesciptor(ColumnFamilyDescriptor descriptor) { HColumnDescriptor hFamily = new HColumnDescriptor(descriptor.getName()); hFamily.setMaxVersions(descriptor.getMaxVersions()); hFamily.setCompressionType(Compression.Algorithm.valueOf(descriptor.getCompressionType().name())); hFamily.setBloomFilterType(org.apache.hadoop.hbase.regionserver.BloomType.valueOf( descriptor.getBloomType().name())); for (Map.Entry<String, String> property : descriptor.getProperties().entrySet()) { hFamily.setValue(property.getKey(), property.getValue()); } return hFamily; }
public TableDescriptorBuilder(TableDescriptor descriptor) { this.namespace = descriptor.getNamespace(); this.tableName = descriptor.getName(); this.properties = descriptor.getProperties(); this.families.addAll(descriptor.getFamilies().values()); this.coprocessors.addAll(descriptor.getCoprocessors().values()); }
public TableDescriptor build() { return new TableDescriptor(namespace, tableName, families, coprocessors, properties); } }
public ColumnFamilyDescriptor build() { return new ColumnFamilyDescriptor(name, maxVersions, compressionType, bloomType, properties); } }
@Override public void initialize(HBaseDDLExecutorContext context) { try { this.admin = new HBaseAdmin((Configuration) context.getConfiguration()); } catch (Exception e) { throw new RuntimeException("Failed to create HBaseAdmin.", e); } }
private static HColumnDescriptor getHColumnDesciptor(ColumnFamilyDescriptor descriptor) { HColumnDescriptor hFamily = new HColumnDescriptor(descriptor.getName()); hFamily.setMaxVersions(descriptor.getMaxVersions()); hFamily.setCompressionType(Compression.Algorithm.valueOf(descriptor.getCompressionType().name())); hFamily.setBloomFilterType(org.apache.hadoop.hbase.regionserver.BloomType.valueOf( descriptor.getBloomType().name())); for (Map.Entry<String, String> property : descriptor.getProperties().entrySet()) { hFamily.setValue(property.getKey(), property.getValue()); } return hFamily; }
private static HColumnDescriptor getHColumnDesciptor(ColumnFamilyDescriptor descriptor) { HColumnDescriptor hFamily = new HColumnDescriptor(descriptor.getName()); hFamily.setMaxVersions(descriptor.getMaxVersions()); hFamily.setCompressionType(Compression.Algorithm.valueOf(descriptor.getCompressionType().name())); hFamily.setBloomFilterType(org.apache.hadoop.hbase.regionserver.BloomType.valueOf( descriptor.getBloomType().name())); for (Map.Entry<String, String> property : descriptor.getProperties().entrySet()) { hFamily.setValue(property.getKey(), property.getValue()); } return hFamily; }
private static HColumnDescriptor getHColumnDesciptor(ColumnFamilyDescriptor descriptor) { HColumnDescriptor hFamily = new HColumnDescriptor(descriptor.getName()); hFamily.setMaxVersions(descriptor.getMaxVersions()); hFamily.setCompressionType(Compression.Algorithm.valueOf(descriptor.getCompressionType().name())); hFamily.setBloomFilterType(org.apache.hadoop.hbase.regionserver.BloomType.valueOf( descriptor.getBloomType().name())); for (Map.Entry<String, String> property : descriptor.getProperties().entrySet()) { hFamily.setValue(property.getKey(), property.getValue()); } return hFamily; }
private static HColumnDescriptor getHColumnDesciptor(ColumnFamilyDescriptor descriptor) { HColumnDescriptor hFamily = new HColumnDescriptor(descriptor.getName()); hFamily.setMaxVersions(descriptor.getMaxVersions()); hFamily.setCompressionType(Compression.Algorithm.valueOf(descriptor.getCompressionType().name())); hFamily.setBloomFilterType(org.apache.hadoop.hbase.regionserver.BloomType.valueOf( descriptor.getBloomType().name())); for (Map.Entry<String, String> property : descriptor.getProperties().entrySet()) { hFamily.setValue(property.getKey(), property.getValue()); } return hFamily; }
private static HColumnDescriptor getHColumnDesciptor(ColumnFamilyDescriptor descriptor) { HColumnDescriptor hFamily = new HColumnDescriptor(descriptor.getName()); hFamily.setMaxVersions(descriptor.getMaxVersions()); hFamily.setCompressionType(Compression.Algorithm.valueOf(descriptor.getCompressionType().name())); hFamily.setBloomFilterType(org.apache.hadoop.hbase.regionserver.BloomType.valueOf( descriptor.getBloomType().name())); for (Map.Entry<String, String> property : descriptor.getProperties().entrySet()) { hFamily.setValue(property.getKey(), property.getValue()); } return hFamily; }