@Override @SuppressWarnings("unchecked") public void run(Bootstrap<?> wildcardBootstrap, Namespace namespace) throws Exception { final Bootstrap<T> bootstrap = (Bootstrap<T>) wildcardBootstrap; configuration = parseConfiguration(bootstrap.getConfigurationFactoryFactory(), bootstrap.getConfigurationSourceProvider(), bootstrap.getValidatorFactory().getValidator(), namespace.getString("file"), getConfigurationClass(), bootstrap.getObjectMapper()); try { if (configuration != null) { configuration.getLoggingFactory().configure(bootstrap.getMetricRegistry(), bootstrap.getApplication().getName()); } run(bootstrap, namespace, configuration); } finally { if (!asynchronous) { cleanup(); } } }
@Override protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception { final Environment environment = new Environment(bootstrap.getApplication().getName(), bootstrap.getObjectMapper(), bootstrap.getValidatorFactory(), bootstrap.getMetricRegistry(), bootstrap.getClassLoader(), bootstrap.getHealthCheckRegistry()); configuration.getMetricsFactory().configure(environment.lifecycle(), bootstrap.getMetricRegistry()); configuration.getServerFactory().configure(environment); bootstrap.run(configuration, environment); application.run(configuration, environment); run(environment, namespace, configuration); }
@Override @SuppressWarnings("unchecked") public void run(Bootstrap<?> wildcardBootstrap, Namespace namespace) throws Exception { final Bootstrap<T> bootstrap = (Bootstrap<T>) wildcardBootstrap; configuration = parseConfiguration(bootstrap.getConfigurationFactoryFactory(), bootstrap.getConfigurationSourceProvider(), bootstrap.getValidatorFactory().getValidator(), namespace.getString("file"), getConfigurationClass(), bootstrap.getObjectMapper()); try { if (configuration != null) { configuration.getLoggingFactory().configure(bootstrap.getMetricRegistry(), bootstrap.getApplication().getName()); } run(bootstrap, namespace, configuration); } finally { if (!asynchronous) { cleanup(); } } }
@Override protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception { final Environment environment = new Environment(bootstrap.getApplication().getName(), bootstrap.getObjectMapper(), bootstrap.getValidatorFactory().getValidator(), bootstrap.getMetricRegistry(), bootstrap.getClassLoader(), bootstrap.getHealthCheckRegistry()); configuration.getMetricsFactory().configure(environment.lifecycle(), bootstrap.getMetricRegistry()); configuration.getServerFactory().configure(environment); bootstrap.run(configuration, environment); application.run(configuration, environment); run(environment, namespace, configuration); }
protected T loadConfiguration(Bootstrap bootstrap) { if (config == null) { try { config = (T) bootstrap.getConfigurationFactoryFactory().create( bootstrap.getApplication().getConfigurationClass(), bootstrap.getValidatorFactory().getValidator(), bootstrap.getObjectMapper(), "") .build(new File(configurationPath)); } catch (Exception e) { throw new RobeRuntimeException("Can't load configuration :" + configurationPath, e); } } return config; }
@Override public void initialize(Bootstrap<?> bootstrap) { ConfigurationFactory<T> cf = new DefaultConfigurationFactoryFactory<T>().create(extensionConfigurationClass, bootstrap.getValidatorFactory().getValidator(), bootstrap.getObjectMapper(), "dw"); if (extensionConfigurationPath != null && !extensionConfigurationPath.isEmpty()) { try { extensionConfiguration = (T) cf.build(bootstrap.getConfigurationSourceProvider(), extensionConfigurationPath); initialize(extensionConfiguration); } catch (Exception e) { handleInitializationException(e); } } else { throw new RuntimeException("Server extension " + name + " has no configuration."); } }