@Inject public DruidAvaticaHandler( final DruidMeta druidMeta, @Self final DruidNode druidNode, final AvaticaMonitor avaticaMonitor ) { super(new LocalService(druidMeta), avaticaMonitor); setServerRpcMetadata(new Service.RpcMetadataResponse(druidNode.getHostAndPortToUse())); }
private void setHandler(String[] args, HttpServer.Builder<Server> builder) throws Exception { Class<? extends PhoenixMetaFactory> factoryClass = getConf().getClass( QueryServices.QUERY_SERVER_META_FACTORY_ATTRIB, PhoenixMetaFactoryImpl.class, PhoenixMetaFactory.class); PhoenixMetaFactory factory = factoryClass.getDeclaredConstructor(Configuration.class).newInstance(getConf()); Meta meta = factory.create(Arrays.asList(args)); Service service = new LocalService(meta); builder.withHandler(service, getSerialization(getConf())); }
private void checkAndEnableJdbc(Map<String, String> conf) throws SQLException { if (Boolean.parseBoolean(conf.getOrDefault(StorageEngine.ENABLE_JDBC, ConfigConstants.FALSE))) { JdbcMeta meta = new JdbcMeta( "jdbc:calcite:schemaFactory=com.srotya.sidewinder.core.sql.calcite.SidewinderSchemaFactory;"); Service service = new LocalService(meta); jdbc = new HttpServer( Integer.parseInt(conf.getOrDefault(StorageEngine.JDBC_PORT, StorageEngine.DEFAULT_JDBC_PORT)), new AvaticaJsonHandler(service)); jdbc.start(); } }
@Inject public DruidAvaticaHandler( final DruidMeta druidMeta, @Self final DruidNode druidNode, final AvaticaMonitor avaticaMonitor ) { super(new LocalService(druidMeta), avaticaMonitor); setServerRpcMetadata(new Service.RpcMetadataResponse(druidNode.getHostAndPortToUse())); }
/** * Creates and starts an {@link HttpServer} using the given factory to create the Handler. * * <p>Arguments are as follows: * <ul> * <li>args[0]: the {@link org.apache.calcite.avatica.Meta.Factory} class * name * <li>args[1+]: arguments passed along to * {@link org.apache.calcite.avatica.Meta.Factory#create(java.util.List)} * </ul> * * @param args Command-line arguments * @param port Server port to bind * @param handlerFactory Factory to create the handler used by the server */ public static HttpServer start(String[] args, int port, HandlerFactory handlerFactory) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { String factoryClassName = args[0]; @SuppressWarnings("unchecked") Class<Meta.Factory> factoryClass = (Class<Meta.Factory>) Class.forName(factoryClassName); Meta.Factory factory = factoryClass.getConstructor().newInstance(); Meta meta = factory.create(Arrays.asList(args).subList(1, args.length)); Service service = new LocalService(meta); HttpServer server = new HttpServer(port, HttpServer.wrapJettyHandler(handlerFactory.createHandler(service))); server.start(); return server; } }
public void run(String[] args) throws Exception { logJVMInfo(); try { Class<? extends Meta.Factory> factoryClass = QuarkMetaFactoryImpl.class; Meta.Factory factory = factoryClass.getDeclaredConstructor().newInstance(); Meta meta = factory.create(Arrays.asList(args)); int port = 8765; if (QuarkMetaFactoryImpl.serverConfig.port != 0) { port = QuarkMetaFactoryImpl.serverConfig.port; } LOG.debug("Listening on port " + port); final HandlerFactory handlerFactory = new HandlerFactory(); Service service = new LocalService(meta); server = new HttpServer(port, getHandler(service, handlerFactory)); Class.forName("com.qubole.quark.fatjdbc.QuarkDriver"); server.start(); runningLatch.countDown(); server.join(); } catch (Throwable t) { LOG.fatal("Unrecoverable service error. Shutting down.", t); this.t = t; } }
@Override public Service create(AvaticaConnection connection) { try { Connection conn = JdbcFrontLinqBackTest.makeConnection(); final CalciteMetaImpl meta = new CalciteMetaImpl( conn.unwrap(CalciteConnectionImpl.class)); return new LocalService(meta); } catch (Exception e) { throw new RuntimeException(e); } } }
/** * Creates and starts an {@link HttpServer} using the given factory to create the Handler. * * <p>Arguments are as follows: * <ul> * <li>args[0]: the {@link org.apache.calcite.avatica.Meta.Factory} class * name * <li>args[1+]: arguments passed along to * {@link org.apache.calcite.avatica.Meta.Factory#create(java.util.List)} * </ul> * * @param args Command-line arguments * @param port Server port to bind * @param handlerFactory Factory to create the handler used by the server */ public static HttpServer start(String[] args, int port, HandlerFactory handlerFactory) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { String factoryClassName = args[0]; @SuppressWarnings("unchecked") Class<Meta.Factory> factoryClass = (Class<Meta.Factory>) Class.forName(factoryClassName); Meta.Factory factory = factoryClass.getConstructor().newInstance(); Meta meta = factory.create(Arrays.asList(args).subList(1, args.length)); Service service = new LocalService(meta); HttpServer server = new HttpServer(port, HttpServer.wrapJettyHandler(handlerFactory.createHandler(service))); server.start(); return server; } }
@Override public Service create(AvaticaConnection connection) { try { Connection conn = makeConnection(); final CalciteMetaImpl meta = new CalciteMetaImpl(conn.unwrap(CalciteConnectionImpl.class)); return new LocalService(meta); } catch (Exception e) { throw new RuntimeException(e); } } }
public Service create(AvaticaConnection connection) { try { Connection localConnection = CalciteAssert.hr().connect(); final Meta meta = CalciteConnectionImpl.TROJAN .getMeta((CalciteConnectionImpl) localConnection); return new LocalJsonService(new LocalService(meta)); } catch (Exception e) { throw new RuntimeException(e); } } }
@Override public Service create(AvaticaConnection connection) { try { Connection conn = makeConnection(); final CalciteMetaImpl meta = new CalciteMetaImpl(conn.unwrap(CalciteConnectionImpl.class)); return new LocalService(meta); } catch (Exception e) { throw new RuntimeException(e); } } }
@Override public Service create(AvaticaConnection connection) { try { Connection conn = JdbcFrontLinqBackTest.makeConnection(); final CalciteMetaImpl meta = new CalciteMetaImpl( conn.unwrap(CalciteConnectionImpl.class)); return new LocalService(meta); } catch (Exception e) { throw new RuntimeException(e); } } }
public Service create(AvaticaConnection connection) { try { Connection localConnection = CalciteAssert.hr().connect(); final Meta meta = CalciteConnectionImpl.TROJAN .getMeta((CalciteConnectionImpl) localConnection); return new LocalJsonService(new LocalService(meta)); } catch (Exception e) { throw new RuntimeException(e); } } }
public void start() { if (null != server) { LOG.error("The server was already started"); Unsafe.systemExit(ExitCodes.ALREADY_STARTED.ordinal()); return; } try { JdbcMeta meta = new JdbcMeta(url); LocalService service = new LocalService(meta); // Construct the server this.server = new HttpServer.Builder() .withHandler(service, serialization) .withPort(port) .build(); // Then start it server.start(); LOG.info("Started Avatica server on port {} with serialization {}", server.getPort(), serialization); } catch (Exception e) { LOG.error("Failed to start Avatica server", e); Unsafe.systemExit(ExitCodes.START_FAILED.ordinal()); } }
public void start() { if (null != server) { LOG.error("The server was already started"); Unsafe.systemExit(ExitCodes.ALREADY_STARTED.ordinal()); return; } try { JdbcMeta meta = new JdbcMeta(url); LocalService service = new LocalService(meta); // Construct the server this.server = new HttpServer.Builder() .withHandler(service, serialization) .withPort(port) .build(); // Then start it server.start(); LOG.info("Started Avatica server on port {} with serialization {}", server.getPort(), serialization); } catch (Exception e) { LOG.error("Failed to start Avatica server", e); Unsafe.systemExit(ExitCodes.START_FAILED.ordinal()); } }