use of com.nearinfinity.honeycomb.config.AdapterType in project honeycomb by altamiracorp.
the class StoreFactoryTest method createFactory.
private StoreFactory createFactory() {
HoneycombConfiguration configurationHolder = new HoneycombConfiguration(adapterConfigs, "hbase");
Map<AdapterType, Provider<Store>> map = Maps.newHashMap();
map.put(AdapterType.HBASE, storeProvider);
when(storeProvider.get()).thenReturn(store);
return new StoreFactory(map, configurationHolder);
}
use of com.nearinfinity.honeycomb.config.AdapterType in project honeycomb by altamiracorp.
the class Bootstrap method configure.
@Override
protected void configure() {
bind(HoneycombConfiguration.class).toInstance(configuration);
for (AdapterType adapter : AdapterType.values()) {
if (configuration.isAdapterConfigured(adapter)) {
try {
Class<?> moduleClass = Class.forName(adapter.getModuleClass());
Constructor<?> moduleCtor = moduleClass.getConstructor(Map.class);
Object module = moduleCtor.newInstance(configuration.getAdapterOptions(adapter));
install((Module) module);
} catch (ClassNotFoundException e) {
logger.error("The " + adapter.getName() + " adapter is" + " configured, but could not be found on the classpath.");
throw new StorageBackendCreationException(adapter.getName(), e);
} catch (Exception e) {
logger.error("Exception while attempting to reflect on the " + adapter.getName() + " adapter.", e);
throw new StorageBackendCreationException(adapter.getName(), e);
}
}
}
}
use of com.nearinfinity.honeycomb.config.AdapterType 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));
}
Aggregations