public GuicedServiceManager() {
this(standardUrls());
}
public GuicedServiceManager(BindingsConfigurationProvider bindingsConfigurationProvider) {
DefaultServiceConfigurationHandler configurationHandler = new DefaultServiceConfigurationHandler();
// Install the default, no-op JMX registry; this is a special case, since we want to use it
// as we start each service.
configurationHandler.bind(JmxRegistryService.class.getName(), NoOpJmxRegistry.class.getName(), null);
// Next, load each element in the provider...
for (BindingsConfigurationLoader loader : bindingsConfigurationProvider.loaders()) {
loader.loadInto(configurationHandler);
}
// ... followed by the configured or default file, if either exists
URL configFile = findServiceConfigFile();
if (configFile != null) {
new YamlBindingsUrl(configFile).loadInto(configurationHandler);
}
// ... followed by any command-line overrides.
new PropertyBindings(System.getProperties()).loadInto(configurationHandler);
Collection<ServiceBinding> bindings = configurationHandler.serviceBindings(false);
BindingsConfigurationLoader pluginsConfigLoader = getPluginsConfigurationLoader(bindings);
pluginsConfigLoader.loadInto(configurationHandler);
bindings = configurationHandler.serviceBindings(true);
try {
guicer = Guicer.forServices(ServiceManager.class, this,
bindings, configurationHandler.priorities(), configurationHandler.getModules());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}