Example usage for io.vertx.core.impl VertxFactoryImpl VertxFactoryImpl

List of usage examples for io.vertx.core.impl VertxFactoryImpl VertxFactoryImpl

Introduction

In this page you can find the example usage for io.vertx.core.impl VertxFactoryImpl VertxFactoryImpl.

Prototype

VertxFactoryImpl

Source Link

Usage

From source file:net.udidb.server.driver.ServerModule.java

License:Open Source License

@Override
protected void configure() {
    // JSON configuration
    SimpleModule simpleModule = new SimpleModule();
    simpleModule.addSerializer(ExpressionValue.class, new ExpressionValueSerializer());

    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.addMixInAnnotations(VoidResult.class, VoidResultMixIn.class);
    objectMapper.addMixInAnnotations(DeferredResult.class, DeferredResultMixIn.class);
    objectMapper.addMixInAnnotations(TableResult.class, TableResultMixIn.class);
    objectMapper.addMixInAnnotations(ValueResult.class, ValueResultMixIn.class);
    objectMapper.addMixInAnnotations(TableRow.class, TableRowMixIn.class);
    objectMapper.registerModule(simpleModule);
    bind(ObjectMapper.class).toInstance(objectMapper);

    // REST API configuration
    Vertx vertx = new VertxFactoryImpl().vertx();
    bind(Vertx.class).toInstance(vertx);

    // Engine configuration
    bind(String[].class).annotatedWith(Names.named("OP_PACKAGES"))
            .toInstance(new String[] { "net.udidb.engine.ops.impls" });

    bind(DebuggeeContextManager.class).to(DebuggeeContextManagerImpl.class);

    bind(HelpMessageProvider.class).asEagerSingleton();

    bind(UdiProcessManager.class).toInstance(new UdiProcessManagerImpl());

    bind(BinaryReader.class).toInstance(new CrossPlatformBinaryReader());

    bind(ExpressionCompiler.class).toInstance(new ExpressionCompilerDelegate());

    bind(SourceLineRowFactory.class).toInstance(new InMemorySourceLineRowFactory());

    bind(ServerEngine.class).to(ServerEngineImpl.class);

    bind(OperationResultVisitor.class).to(OperationEngine.class);

    bind(ServerEventDispatcher.class).asEagerSingleton();

    bind(EventPump.class).asEagerSingleton();

    bind(EventSink.class).to(ServerEventDispatcher.class);

    WampRouter wampRouter = configureWampRouter();
    bind(WampRouter.class).toInstance(wampRouter);

    bind(WampClient.class).toInstance(configureWampClient(wampRouter));

}