/** * The initial function called by JNI to wire-up the required object graph dependencies * * @param configFilename The path to the configuration file, not null or empty * @param configSchema The path to the schema used to validate the configuration file, not null or empty * @return {@link HandlerProxyFactory} with all dependencies setup */ public static HandlerProxyFactory startup(String configFilename, String configSchema) { Verify.isNotNullOrEmpty(configFilename); Verify.isNotNullOrEmpty(configSchema); ensureLoggingPathsCorrect(); HoneycombConfiguration configuration = ConfigurationParser.parseConfiguration(configFilename, configSchema); Bootstrap bootstrap = new Bootstrap(configuration); Injector injector = Guice.createInjector(bootstrap); return injector.getInstance(HandlerProxyFactory.class); }
@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); } } } } }