}
catch (ErraiBootstrapFailure e) {
throw e;
}
catch (Exception e) {
throw new ErraiBootstrapFailure("cannot configure authentication adapter", e);
}
}
/*** Dispatcher ***/
RequestDispatcher dispatcher = createInjector(new AbstractModule() {
@Override
protected void configure() {
Class<? extends RequestDispatcher> dispatcherImplementation = SimpleDispatcher.class;
if (config.hasProperty(ErraiServiceConfigurator.ERRAI_DISPATCHER_IMPLEMENTATION)) {
try {
dispatcherImplementation = Class.forName(config.getProperty(ErraiServiceConfigurator.ERRAI_DISPATCHER_IMPLEMENTATION))
.asSubclass(RequestDispatcher.class);
}
catch (Exception e) {
throw new ErraiBootstrapFailure("could not load request dispatcher implementation class", e);
}
}
log.info("using dispatcher implementation: " + dispatcherImplementation.getName());
bind(RequestDispatcher.class).to(dispatcherImplementation);
bind(ErraiService.class).toInstance(context.getService());
bind(MessageBus.class).toInstance(context.getBus());
bind(ErraiServiceConfigurator.class).toInstance(config);
}
}).getInstance(RequestDispatcher.class);
context.getService().setDispatcher(dispatcher);
/*** Session Provider ***/
SessionProvider sessionProvider = createInjector(new AbstractModule() {
@Override
protected void configure() {
Class<? extends SessionProvider> sessionProviderImplementation = HttpSessionProvider.class;
if (config.hasProperty(ErraiServiceConfigurator.ERRAI_SESSION_PROVIDER_IMPLEMENTATION)) {
try {
sessionProviderImplementation = Class.forName(config.getProperty(ErraiServiceConfigurator.ERRAI_SESSION_PROVIDER_IMPLEMENTATION))
.asSubclass(SessionProvider.class);
}
catch (Exception e) {
throw new ErraiBootstrapFailure("could not load session provider implementation class", e);
}
}
log.info("using session provider implementation: " + sessionProviderImplementation.getName());