本文整理汇总了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;未经允许,请勿转载。 |
请发表评论