use of org.forgerock.openam.sm.datalayer.api.DataLayerConnectionModule in project OpenAM by OpenRock.
the class DataLayerGuiceModule method configure.
@Override
protected void configure() {
bind(TokenIdGenerator.class).to(ThreadSafeTokenIdGenerator.class);
install(new FactoryModuleBuilder().implement(JavaBeanAdapter.class, JavaBeanAdapter.class).build(JavaBeanAdapterFactory.class));
Key<Map<ConnectionType, LdapDataLayerConfiguration>> connectionMapKey = Key.get(new TypeLiteral<Map<ConnectionType, LdapDataLayerConfiguration>>() {
});
binder().bind(connectionMapKey).toProvider(ConfigurationMapProvider.class).in(Singleton.class);
for (ConnectionType connectionType : ConnectionType.values()) {
if (connectionType != ConnectionType.UMA_LABELS) {
try {
DataLayerConnectionModule module = connectionType.getConfigurationClass().newInstance();
module.setConnectionType(connectionType);
binder().install(module);
} catch (Exception e) {
throw new IllegalStateException("Could not initialise connection module for " + connectionType, e);
}
}
}
}
Aggregations