• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConnectorContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.facebook.presto.spi.connector.ConnectorContext的典型用法代码示例。如果您正苦于以下问题:Java ConnectorContext类的具体用法?Java ConnectorContext怎么用?Java ConnectorContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConnectorContext类属于com.facebook.presto.spi.connector包,在下文中一共展示了ConnectorContext类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: create

import com.facebook.presto.spi.connector.ConnectorContext; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(config, "config is null");

    try {
        Bootstrap app = new Bootstrap(
                new JsonModule(),
                new HDFSModule(connectorId, context.getTypeManager())
        );

        Injector injector = app
                .strictConfig()
                .doNotInitializeLogging()
                .setRequiredConfigurationProperties(config)
                .initialize();

        return injector.getInstance(HDFSConnector.class);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:dbiir,项目名称:paraflow,代码行数:25,代码来源:HDFSConnectorFactory.java


示例2: create

import com.facebook.presto.spi.connector.ConnectorContext; //导入依赖的package包/类
@Override
public Connector create(final String connectorId, Map<String, String> requiredConfig, ConnectorContext context)
{
    requireNonNull(requiredConfig, "config is null");

    try {
        Bootstrap app = new Bootstrap(
                binder -> binder.bind(NodeManager.class).toInstance(context.getNodeManager()),
                new KuduModule(connectorId));

        Injector injector = app
                .strictConfig()
                .doNotInitializeLogging()
                .setRequiredConfigurationProperties(requiredConfig)
                .initialize();

        return injector.getInstance(KuduConnector.class);
    }
    catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:trackingio,项目名称:presto-kudu,代码行数:23,代码来源:KuduConnectorFactory.java


示例3: create

import com.facebook.presto.spi.connector.ConnectorContext; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> config, ConnectorContext context) {
  Path basePath = new Path(config.get(BASEPATH));
  String spreadsheetSubDir = config.get(SUBDIR);
  String useFileCacheStr = config.get(USE_FILE_CACHE);
  String proxyUserStr = config.get(PROXY_USER);
  boolean proxyUser = false;
  if (proxyUserStr != null) {
    proxyUser = Boolean.parseBoolean(proxyUserStr);
  }
  boolean useFileCache = true;
  if (useFileCacheStr != null) {
    useFileCache = Boolean.parseBoolean(useFileCacheStr);
  }
  try {
    return new SpreadsheetConnector(UserGroupInformation.getCurrentUser(), _configuration, basePath,
        spreadsheetSubDir, useFileCache, proxyUser);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:fortitudetec,项目名称:presto-plugins,代码行数:22,代码来源:SpreadsheetConnectorFactory.java


示例4: create

import com.facebook.presto.spi.connector.ConnectorContext; //导入依赖的package包/类
@Override
public Connector create(String s, Map<String, String> config, ConnectorContext context)
{
    NodeManager nodeManager = context.getNodeManager();

    return new RestConnector(nodeManager, restFactory.create(config));
}
 
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:8,代码来源:RestConnectorFactory.java


示例5: create

import com.facebook.presto.spi.connector.ConnectorContext; //导入依赖的package包/类
@Override
    public Connector create(String connectorId, Map<String, String> config, ConnectorContext context) {
        requireNonNull(connectorId, "connectorId is null");
        requireNonNull(config, "config is null");

        try {
            Bootstrap app = new Bootstrap(
//                    new JsonModule(),
                    new EthereumConnectorModule(),
                    binder -> {
                        binder.bind(EthereumConnectorId.class).toInstance(new EthereumConnectorId(connectorId));
                        binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                        binder.bind(NodeManager.class).toInstance(context.getNodeManager());
                    }
            );

            Injector injector = app.strictConfig()
                    .doNotInitializeLogging()
                    .setRequiredConfigurationProperties(config)
                    .initialize();

            return injector.getInstance(EthereumConnector.class);
        }
        catch (Exception e) {
            throw Throwables.propagate(e);
        }
    }
 
开发者ID:xiaoyao1991,项目名称:presto-ethereum,代码行数:28,代码来源:EthereumConnectorFactory.java


示例6: create

import com.facebook.presto.spi.connector.ConnectorContext; //导入依赖的package包/类
public Connector create(final String connectorId, Map<String, String> requiredConfig,
                        ConnectorContext context) {
  requireNonNull(requiredConfig, "requiredConfig is null");

  final String
      locator_host =
      requiredConfig
          .getOrDefault(MonarchProperties.LOCATOR_HOST, MonarchProperties.LOCATOR_HOST_DEFAULT);
  final int
      locator_port =
      Integer.parseInt(requiredConfig
          .getOrDefault(MonarchProperties.LOCATOR_PORT, MonarchProperties.LOCATOR_PORT_DEFAULT));

  // Create a client that connects to the Ampool cluster via a locator (that is already running!).
  final Properties props = new Properties();
  props.setProperty(Constants.MClientCacheconfig.MONARCH_CLIENT_LOG, requiredConfig
      .getOrDefault(MonarchProperties.MONARCH_CLIENT_LOG, MonarchProperties.MONARCH_CLIENT_LOG_DEFAULT_LOCATION));
  final AmpoolClient aClient = new AmpoolClient(locator_host, locator_port, props);
  log.info("INFORMATION: AmpoolClient created successfully.");

  try {
    Bootstrap
        app =
        new Bootstrap(new AmpoolModule(connectorId, aClient, context.getTypeManager()));

    Injector injector = app
        .doNotInitializeLogging()
        .setRequiredConfigurationProperties(requiredConfig)
        .initialize();

    log.info("INFORMATION: Injector initialized successfully.");
    return injector.getInstance(AmpoolConnector.class);
  } catch (Exception e) {
    throw Throwables.propagate(e);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:37,代码来源:AmpoolConnectorFactory.java


示例7: create

import com.facebook.presto.spi.connector.ConnectorContext; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> config, ConnectorContext context)
{
    log.info("In connector factory create method.  Connector id: " + connectorId);
    requireNonNull(connectorId, "connectorId is null");
    requireNonNull(config, "config is null");

    try {
        Bootstrap app = new Bootstrap(
                new JsonModule(),
                new KinesisConnectorModule(),
                binder -> {
                    binder.bindConstant().annotatedWith(Names.named("connectorId")).to(connectorId);
                    binder.bind(ConnectorId.class).toInstance(new ConnectorId(connectorId));
                    binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                    binder.bind(NodeManager.class).toInstance(context.getNodeManager());
                    // Note: moved creation from KinesisConnectorModule because connector manager accesses it earlier!
                    binder.bind(KinesisHandleResolver.class).toInstance(new KinesisHandleResolver(connectorName));

                    // Moved creation here from KinesisConnectorModule to make it easier to parameterize
                    if (altProviderClass.isPresent()) {
                        binder.bind(KinesisClientProvider.class).to(altProviderClass.get()).in(Scopes.SINGLETON);
                    }
                    else {
                        binder.bind(KinesisClientProvider.class).to(KinesisClientManager.class).in(Scopes.SINGLETON);
                    }

                    if (tableDescriptionSupplier.isPresent()) {
                        binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KinesisStreamDescription>>>() {}).toInstance(tableDescriptionSupplier.get());
                    }
                    else {
                        binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KinesisStreamDescription>>>() {}).to(KinesisTableDescriptionSupplier.class).in(Scopes.SINGLETON);
                    }
                }
        );

        this.injector = app.strictConfig()
                    .doNotInitializeLogging()
                    .setRequiredConfigurationProperties(config)
                    .setOptionalConfigurationProperties(optionalConfig)
                    .initialize();

        KinesisConnector connector = this.injector.getInstance(KinesisConnector.class);

        // Register objects for shutdown, at the moment only KinesisTableDescriptionSupplier
        if (!tableDescriptionSupplier.isPresent()) {
            // This will shutdown related dependent objects as well:
            KinesisTableDescriptionSupplier supp = getTableDescSupplier(this.injector);
            connector.registerShutdownObject(supp);
        }

        log.info("Done with injector.  Returning the connector itself.");
        return connector;
    }
    catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:qubole,项目名称:presto-kinesis,代码行数:59,代码来源:KinesisConnectorFactory.java



注:本文中的com.facebook.presto.spi.connector.ConnectorContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Rule类代码示例发布时间:2022-05-23
下一篇:
Java TkWithType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap