.add(new MBeanModule()) .add(new TestingJmxModule()) .add(new EventModule()) .add(new TraceTokenModule()) .add(new ServerSecurityModule())
public static void start(Module... extraModules) { Bootstrap app = new Bootstrap(ImmutableList.<Module>builder() .add(new NodeModule()) .add(new HttpServerModule()) .add(new JsonModule()) .add(new JaxrsModule(true)) .add(new MBeanModule()) .add(new JmxModule()) .add(new LogJmxModule()) .add(new TraceTokenModule()) .add(new EventModule()) .add(new ProxyModule()) .add(extraModules) .build()); Logger log = Logger.get(PrestoProxy.class); try { app.strictConfig().initialize(); log.info("======== SERVER STARTED ========"); } catch (Throwable t) { log.error(t); System.exit(1); } }
new EventModule(), new MBeanModule(), new JsonModule(),
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(InMemoryEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(InMemoryEventClient.class)).in(Scopes.SINGLETON); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(InMemoryEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(InMemoryEventClient.class)).in(Scopes.SINGLETON); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(InMemoryEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(InMemoryEventClient.class)).in(Scopes.SINGLETON); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(InMemoryEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(InMemoryEventClient.class)).in(Scopes.SINGLETON); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(JsonEventWriter.class).in(Scopes.SINGLETON); binder.bind(HttpEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(HttpEventClient.class)).in(Scopes.SINGLETON); newExporter(binder).export(EventClient.class).withGeneratedName(); discoveryBinder(binder).bindHttpSelector("collector"); // bind the http client httpClientBinder(binder).bindHttpClient("event", ForEventClient.class); // Kick off the binding of Set<EventTypeMetadata> in case no events are bound newSetBinder(binder, new TypeLiteral<EventTypeMetadata<?>>() {}); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(JsonEventWriter.class).in(Scopes.SINGLETON); binder.bind(HttpEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(HttpEventClient.class)).in(Scopes.SINGLETON); newExporter(binder).export(EventClient.class).withGeneratedName(); discoveryBinder(binder).bindHttpSelector("collector"); // bind the http client httpClientBinder(binder).bindHttpClient("event", ForEventClient.class); // Kick off the binding of Set<EventTypeMetadata> in case no events are bound newSetBinder(binder, new TypeLiteral<EventTypeMetadata<?>>() {}); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(JsonEventWriter.class).in(Scopes.SINGLETON); binder.bind(HttpEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(HttpEventClient.class)).in(Scopes.SINGLETON); newExporter(binder).export(EventClient.class).withGeneratedName(); discoveryBinder(binder).bindHttpSelector("collector"); // bind the http client httpClientBinder(binder).bindHttpClient("event", ForEventClient.class); // Kick off the binding of Set<EventTypeMetadata> in case no events are bound newSetBinder(binder, new TypeLiteral<EventTypeMetadata<?>>() {}); } }
@Override public void configure(Binder binder) { // for backwards compatibility binder.install(new EventModule()); binder.bind(JsonEventWriter.class).in(Scopes.SINGLETON); binder.bind(HttpEventClient.class).in(Scopes.SINGLETON); newSetBinder(binder, EventClient.class).addBinding().to(Key.get(HttpEventClient.class)).in(Scopes.SINGLETON); newExporter(binder).export(EventClient.class).withGeneratedName(); discoveryBinder(binder).bindHttpSelector("collector"); // bind the http client httpClientBinder(binder).bindAsyncHttpClient("event", ForEventClient.class); // Kick off the binding of Set<EventTypeMetadata> in case no events are bound newSetBinder(binder, new TypeLiteral<EventTypeMetadata<?>>() {}); } }
.add(new MBeanModule()) .add(new TestingJmxModule()) .add(new EventModule()) .add(new TraceTokenModule()) .add(new ServerSecurityModule())
.add(new MBeanModule()) .add(new TestingJmxModule()) .add(new EventModule()) .add(new TraceTokenModule()) .add(new ServerMainModule(new SqlParserOptions()))
.add(new MBeanModule()) .add(new TestingJmxModule()) .add(new EventModule()) .add(new TraceTokenModule()) .add(new ServerSecurityModule())
public static void start(Module... extraModules) { Bootstrap app = new Bootstrap(ImmutableList.<Module>builder() .add(new NodeModule()) .add(new HttpServerModule()) .add(new JsonModule()) .add(new JaxrsModule(true)) .add(new MBeanModule()) .add(new JmxModule()) .add(new LogJmxModule()) .add(new TraceTokenModule()) .add(new EventModule()) .add(new ProxyModule()) .add(extraModules) .build()); Logger log = Logger.get(PrestoProxy.class); try { app.strictConfig().initialize(); log.info("======== SERVER STARTED ========"); } catch (Throwable t) { log.error(t); System.exit(1); } }
@Test public void testCanConstructServer() throws Exception { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("node.environment", "test") .put("http-server.http.port", "0") .put("http-server.log.path", new File(tempDir, "http-request.log").getAbsolutePath()) .build(); ConfigurationFactory configFactory = new ConfigurationFactory(properties); Injector injector = Guice.createInjector(new HttpServerModule(), new TestingNodeModule(), new ConfigurationModule(configFactory), new EventModule(), binder -> binder.bind(Servlet.class).annotatedWith(TheServlet.class).to(DummyServlet.class)); HttpServer server = injector.getInstance(HttpServer.class); assertNotNull(server); }
@Test public void testCanConstructServer() throws Exception { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("node.environment", "test") .put("http-server.http.port", "0") .put("http-server.log.path", new File(tempDir, "http-request.log").getAbsolutePath()) .build(); ConfigurationFactory configFactory = new ConfigurationFactory(properties); Injector injector = Guice.createInjector(new HttpServerModule(), new NodeModule(), new ConfigurationModule(configFactory), new EventModule(), new Module() { @Override public void configure(Binder binder) { binder.bind(Servlet.class).annotatedWith(TheServlet.class).to(DummyServlet.class); } }); HttpServer server = injector.getInstance(HttpServer.class); assertNotNull(server); }
new TestingNodeModule(), new ConfigurationModule(configFactory), new EventModule(), binder -> binder.bind(Servlet.class).annotatedWith(TheServlet.class).to(DummyServlet.class));
new EventModule(), new MBeanModule(), new ConnectorObjectNameGeneratorModule(catalogName),
new NodeModule(), new ConfigurationModule(configFactory), new EventModule(), new Module()