Search in sources :

Example 1 with Store

use of com.nearinfinity.honeycomb.Store in project honeycomb by altamiracorp.

the class StoreFactoryTest method testDefaultTablespaceIsUsed.

@Test
public void testDefaultTablespaceIsUsed() {
    StoreFactory factory = createFactory();
    Store returnedStore = factory.createStore(tableName);
    assertEquals(returnedStore, this.store);
}
Also used : Store(com.nearinfinity.honeycomb.Store) Test(org.junit.Test)

Example 2 with Store

use of com.nearinfinity.honeycomb.Store in project honeycomb by altamiracorp.

the class HandlerProxy method dropTable.

/**
     * Drop the table with the given specifications.  The table is not open when
     * this is called.
     *
     * @param tableName Name of the table to be dropped
     */
public void dropTable(String tableName) {
    Verify.isNotNullOrEmpty(tableName);
    Store store = storeFactory.createStore(tableName);
    Table table = store.openTable(tableName);
    table.deleteAllRows();
    Util.closeQuietly(table);
    store.deleteTable(tableName);
}
Also used : Table(com.nearinfinity.honeycomb.Table) Store(com.nearinfinity.honeycomb.Store)

Example 3 with Store

use of com.nearinfinity.honeycomb.Store in project honeycomb by altamiracorp.

the class HBaseModule method configure.

@Override
protected void configure() {
    final MapBinder<AdapterType, Store> storeMapBinder = MapBinder.newMapBinder(binder(), AdapterType.class, Store.class);
    storeMapBinder.addBinding(AdapterType.HBASE).to(HBaseStore.class);
    install(new FactoryModuleBuilder().implement(Table.class, HBaseTable.class).build(HBaseTableFactory.class));
    bind(HTableProvider.class).toInstance(hTableProvider);
    bind(HTableInterface.class).toProvider(hTableProvider);
    bind(Long.class).annotatedWith(Names.named(ConfigConstants.WRITE_BUFFER)).toInstance(configuration.getLong(ConfigConstants.WRITE_BUFFER, ConfigConstants.DEFAULT_WRITE_BUFFER));
    bind(String.class).annotatedWith(Names.named(ConfigConstants.COLUMN_FAMILY)).toInstance(configuration.get(ConfigConstants.COLUMN_FAMILY));
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder) AdapterType(com.nearinfinity.honeycomb.config.AdapterType) Store(com.nearinfinity.honeycomb.Store) HTableInterface(org.apache.hadoop.hbase.client.HTableInterface)

Example 4 with Store

use of com.nearinfinity.honeycomb.Store in project honeycomb by altamiracorp.

the class HandlerProxy method renameTable.

/**
     * Updates the existing SQL table name representation in the underlying
     * {@link Store} implementation to the specified new table name.  The table
     * is not open when this is called.
     *
     * @param originalName The existing name of the table, not null or empty
     * @param newName      The new table name to represent, not null or empty
     */
public void renameTable(final String originalName, final String newName) {
    Verify.isNotNullOrEmpty(originalName, "Original table name must have value.");
    Verify.isNotNullOrEmpty(newName, "New table name must have value.");
    checkArgument(!originalName.equals(newName), "New table name must be different than original.");
    Store store = storeFactory.createStore(originalName);
    store.renameTable(originalName, newName);
    tableName = newName;
}
Also used : Store(com.nearinfinity.honeycomb.Store)

Aggregations

Store (com.nearinfinity.honeycomb.Store)4 FactoryModuleBuilder (com.google.inject.assistedinject.FactoryModuleBuilder)1 Table (com.nearinfinity.honeycomb.Table)1 AdapterType (com.nearinfinity.honeycomb.config.AdapterType)1 HTableInterface (org.apache.hadoop.hbase.client.HTableInterface)1 Test (org.junit.Test)1