use of com.espertech.esper.client.Configuration in project meteo by pierre.
the class RealtimeSystemModule method configure.
/**
* Contributes bindings and other configurations for this module to {@code binder}.
* <p/>
* <p><strong>Do not invoke this method directly</strong> to install submodules. Instead use
* {@link com.google.inject.Binder#install(com.google.inject.Module)}, which ensures that {@link com.google.inject.Provides provider methods} are
* discovered.
*/
@Override
public void configure(final Binder binder) {
// JMX
binder.bind(MBeanServer.class).toInstance(ManagementFactory.getPlatformMBeanServer());
// Jetty/Jersey stuff
binder.bind(JacksonJsonProvider.class).asEagerSingleton();
// Main configuration file
final RealtimeSystemConfig config = new ConfigurationObjectFactory(System.getProperties()).build(RealtimeSystemConfig.class);
binder.bind(RealtimeSystemConfig.class).toInstance(config);
// Configure Esper
final Configuration configuration = new Configuration();
if (!config.getEsperConfigurationFile().equals("")) {
configuration.configure(new File(config.getEsperConfigurationFile()));
}
binder.bind(EPServiceProvider.class).toInstance(EPServiceProviderManager.getDefaultProvider(configuration));
// Configure the routes
configureFromFile(binder, config.getConfigurationFile());
}
Aggregations