Search in sources :

Example 1 with Configuration

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());
}
Also used : Configuration(com.espertech.esper.client.Configuration) EPServiceProvider(com.espertech.esper.client.EPServiceProvider) JacksonJsonProvider(org.codehaus.jackson.jaxrs.JacksonJsonProvider) ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory) File(java.io.File) MBeanServer(javax.management.MBeanServer)

Aggregations

Configuration (com.espertech.esper.client.Configuration)1 EPServiceProvider (com.espertech.esper.client.EPServiceProvider)1 File (java.io.File)1 MBeanServer (javax.management.MBeanServer)1 JacksonJsonProvider (org.codehaus.jackson.jaxrs.JacksonJsonProvider)1 ConfigurationObjectFactory (org.skife.config.ConfigurationObjectFactory)1