Search in sources :

Example 1 with StorageModule

use of com.facebook.presto.raptor.storage.StorageModule in project presto by prestodb.

the class RaptorConnectorFactory method create.

@Override
public Connector create(String connectorId, Map<String, String> config, ConnectorContext context) {
    NodeManager nodeManager = context.getNodeManager();
    try {
        Bootstrap app = new Bootstrap(new JsonModule(), new MBeanModule(), binder -> {
            MBeanServer mbeanServer = new RebindSafeMBeanServer(getPlatformMBeanServer());
            binder.bind(MBeanServer.class).toInstance(mbeanServer);
            binder.bind(NodeManager.class).toInstance(nodeManager);
            binder.bind(PageSorter.class).toInstance(context.getPageSorter());
            binder.bind(TypeManager.class).toInstance(context.getTypeManager());
        }, metadataModule, new BackupModule(backupProviders), new StorageModule(connectorId), new RaptorModule(connectorId));
        Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        return injector.getInstance(RaptorConnector.class);
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
Also used : MBeanModule(org.weakref.jmx.guice.MBeanModule) StorageModule(com.facebook.presto.raptor.storage.StorageModule) BackupModule(com.facebook.presto.raptor.backup.BackupModule) JsonModule(io.airlift.json.JsonModule) NodeManager(com.facebook.presto.spi.NodeManager) RebindSafeMBeanServer(com.facebook.presto.raptor.util.RebindSafeMBeanServer) Injector(com.google.inject.Injector) Bootstrap(io.airlift.bootstrap.Bootstrap) PageSorter(com.facebook.presto.spi.PageSorter) TypeManager(com.facebook.presto.spi.type.TypeManager) ManagementFactory.getPlatformMBeanServer(java.lang.management.ManagementFactory.getPlatformMBeanServer) RebindSafeMBeanServer(com.facebook.presto.raptor.util.RebindSafeMBeanServer) MBeanServer(javax.management.MBeanServer)

Aggregations

BackupModule (com.facebook.presto.raptor.backup.BackupModule)1 StorageModule (com.facebook.presto.raptor.storage.StorageModule)1 RebindSafeMBeanServer (com.facebook.presto.raptor.util.RebindSafeMBeanServer)1 NodeManager (com.facebook.presto.spi.NodeManager)1 PageSorter (com.facebook.presto.spi.PageSorter)1 TypeManager (com.facebook.presto.spi.type.TypeManager)1 Injector (com.google.inject.Injector)1 Bootstrap (io.airlift.bootstrap.Bootstrap)1 JsonModule (io.airlift.json.JsonModule)1 ManagementFactory.getPlatformMBeanServer (java.lang.management.ManagementFactory.getPlatformMBeanServer)1 MBeanServer (javax.management.MBeanServer)1 MBeanModule (org.weakref.jmx.guice.MBeanModule)1