T - the configuration typepublic class Bootstrap<T extends Configuration> extends Object
| Constructor and Description |
|---|
Bootstrap(Application<T> application)
Creates a new
Bootstrap for the given application. |
| Modifier and Type | Method and Description |
|---|---|
void |
addBundle(ConfiguredBundle<? super T> bundle)
Adds the given bundle to the bootstrap.
|
void |
addCommand(Command command)
Adds the given command to the bootstrap.
|
void |
addCommand(ConfiguredCommand<T> command)
Adds the given command to the bootstrap.
|
Application<T> |
getApplication()
Returns the bootstrap's
Application. |
ClassLoader |
getClassLoader()
Returns the bootstrap's class loader.
|
List<Command> |
getCommands()
Returns the application's commands.
|
ConfigurationFactoryFactory<T> |
getConfigurationFactoryFactory() |
ConfigurationSourceProvider |
getConfigurationSourceProvider()
Returns the bootstrap's
ConfigurationSourceProvider. |
com.codahale.metrics.health.HealthCheckRegistry |
getHealthCheckRegistry()
returns the health check registry
|
com.codahale.metrics.jmx.JmxReporter |
getJmxReporter()
Returns the
JmxReporter registered with the bootstrap's MetricRegistry. |
com.codahale.metrics.MetricRegistry |
getMetricRegistry()
Returns the application metrics.
|
com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper()
Returns the bootstrap's
ObjectMapper. |
javax.validation.ValidatorFactory |
getValidatorFactory()
Returns the application's validator factory.
|
void |
registerMetrics()
Registers the JVM metrics to the metric registry and start to report
the registry metrics via JMX.
|
void |
run(T configuration,
Environment environment)
Runs the bootstrap's bundles with the given configuration and environment.
|
void |
setClassLoader(ClassLoader classLoader)
Sets the bootstrap's class loader.
|
void |
setConfigurationFactoryFactory(ConfigurationFactoryFactory<T> configurationFactoryFactory) |
void |
setConfigurationSourceProvider(ConfigurationSourceProvider provider)
Sets the bootstrap's
ConfigurationSourceProvider. |
void |
setHealthCheckRegistry(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry) |
void |
setMetricRegistry(com.codahale.metrics.MetricRegistry metricRegistry)
Sets a custom registry for the application metrics.
|
void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Sets the given
ObjectMapper to the bootstrap. |
void |
setValidatorFactory(javax.validation.ValidatorFactory validatorFactory) |
public Bootstrap(Application<T> application)
Bootstrap for the given application.application - a Dropwizard Applicationpublic void registerMetrics()
@Nullable public com.codahale.metrics.jmx.JmxReporter getJmxReporter()
JmxReporter registered with the bootstrap's MetricRegistry.public Application<T> getApplication()
Application.public ConfigurationSourceProvider getConfigurationSourceProvider()
ConfigurationSourceProvider.public void setConfigurationSourceProvider(ConfigurationSourceProvider provider)
ConfigurationSourceProvider.public ClassLoader getClassLoader()
public void setClassLoader(ClassLoader classLoader)
public void addBundle(ConfiguredBundle<? super T> bundle)
bundle - a ConfiguredBundlepublic void addCommand(Command command)
command - a Commandpublic void addCommand(ConfiguredCommand<T> command)
command - a ConfiguredCommandpublic com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
ObjectMapper.public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
ObjectMapper to the bootstrap.
WARNING: The mapper should be created by Jackson.newMinimalObjectMapper()
or Jackson.newObjectMapper(), otherwise it will not work with Dropwizard.
objectMapper - an ObjectMapperpublic void run(T configuration, Environment environment) throws Exception
configuration - the parsed configurationenvironment - the application environmentException - if a bundle throws an exceptionpublic com.codahale.metrics.MetricRegistry getMetricRegistry()
public void setMetricRegistry(com.codahale.metrics.MetricRegistry metricRegistry)
metricRegistry - a custom metric registrypublic javax.validation.ValidatorFactory getValidatorFactory()
public void setValidatorFactory(javax.validation.ValidatorFactory validatorFactory)
public ConfigurationFactoryFactory<T> getConfigurationFactoryFactory()
public void setConfigurationFactoryFactory(ConfigurationFactoryFactory<T> configurationFactoryFactory)
public com.codahale.metrics.health.HealthCheckRegistry getHealthCheckRegistry()
public void setHealthCheckRegistry(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry)
Copyright © 2021. All rights reserved.