本文整理汇总了Java中com.facebook.presto.spi.connector.Connector类的典型用法代码示例。如果您正苦于以下问题:Java Connector类的具体用法?Java Connector怎么用?Java Connector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Connector类属于com.facebook.presto.spi.connector包,在下文中一共展示了Connector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import com.facebook.presto.spi.connector.Connector; //导入依赖的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.Connector; //导入依赖的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: stop
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
@PreDestroy
public void stop()
{
if (stopped.getAndSet(true)) {
return;
}
for (Map.Entry<String, Connector> entry : connectors.entrySet()) {
Connector connector = entry.getValue();
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(connector.getClass().getClassLoader())) {
connector.shutdown();
}
catch (Throwable t) {
log.error(t, "Error shutting down connector: %s", entry.getKey());
}
}
}
开发者ID:y-lan,项目名称:presto,代码行数:18,代码来源:ConnectorManager.java
示例4: addCatalogConnector
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
private synchronized void addCatalogConnector(String catalogName, String connectorId, ConnectorFactory factory, Map<String, String> properties)
{
Connector connector = createConnector(connectorId, factory, properties);
addConnectorInternal(ConnectorType.STANDARD, catalogName, connectorId, connector);
String informationSchemaId = makeInformationSchemaConnectorId(connectorId);
addConnectorInternal(ConnectorType.INFORMATION_SCHEMA, catalogName, informationSchemaId, new InformationSchemaConnector(catalogName, nodeManager, metadataManager));
String systemId = makeSystemTablesConnectorId(connectorId);
addConnectorInternal(ConnectorType.SYSTEM, catalogName, systemId, new SystemConnector(
systemId,
nodeManager,
connector.getSystemTables(),
transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId)));
// Register session and table properties once per catalog
metadataManager.getSessionPropertyManager().addConnectorSessionProperties(catalogName, connector.getSessionProperties());
metadataManager.getTablePropertyManager().addTableProperties(catalogName, connector.getTableProperties());
}
开发者ID:y-lan,项目名称:presto,代码行数:21,代码来源:ConnectorManager.java
示例5: registerBogusConnector
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
private static void registerBogusConnector(TransactionManager transactionManager, String connectorId)
{
transactionManager.addConnector(connectorId, new Connector()
{
@Override
public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly)
{
// Just return something
return new ConnectorTransactionHandle() {};
}
@Override
public ConnectorMetadata getMetadata(ConnectorTransactionHandle transactionHandle)
{
throw new UnsupportedOperationException();
}
@Override
public ConnectorSplitManager getSplitManager()
{
throw new UnsupportedOperationException();
}
});
}
开发者ID:y-lan,项目名称:presto,代码行数:25,代码来源:TestAccessControlManager.java
示例6: createTestingConnector
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
private static Connector createTestingConnector(String connectorId)
{
return new LegacyTransactionConnector(connectorId, new com.facebook.presto.spi.Connector()
{
private final ConnectorMetadata metadata = new TestingMetadata();
@Override
public ConnectorMetadata getMetadata()
{
return metadata;
}
@Override
public ConnectorSplitManager getSplitManager()
{
throw new UnsupportedOperationException();
}
});
}
开发者ID:y-lan,项目名称:presto,代码行数:20,代码来源:TestAnalyzer.java
示例7: create
import com.facebook.presto.spi.connector.Connector; //导入依赖的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
示例8: createConnector
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
/**
* Build a connector instance from the plug in, supplying the given properties.
*
* This can build a connector with the mock client which is normally done in testing.
* The plug in is created first with createPluginInstance.
*
* @param plugin
* @param properties
* @param withMockClient
* @return
*/
public static KinesisConnector createConnector(KinesisPlugin plugin, Map<String, String> properties, boolean withMockClient)
{
requireNonNull(plugin, "Plugin instance should not be null");
requireNonNull(properties, "Properties map should not be null (can be empty)");
if (withMockClient) {
plugin.setAltProviderClass(KinesisTestClientManager.class);
}
ConnectorFactory factory = plugin.getConnectorFactories().iterator().next();
assertNotNull(factory);
Connector connector = factory.create("kinesis", properties, new TestingConnectorContext() {});
assertTrue(connector instanceof KinesisConnector);
return (KinesisConnector) connector;
}
开发者ID:qubole,项目名称:presto-kinesis,代码行数:28,代码来源:TestUtils.java
示例9: create
import com.facebook.presto.spi.connector.Connector; //导入依赖的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
示例10: create
import com.facebook.presto.spi.connector.Connector; //导入依赖的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
示例11: create
import com.facebook.presto.spi.connector.Connector; //导入依赖的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
示例12: create
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> config)
{
requireNonNull(connectorId, "connectorId is null");
requireNonNull(config, "config is null");
try {
Bootstrap app = new Bootstrap(
new JsonModule(),
new KafkaConnectorModule(),
binder -> {
binder.bind(KafkaConnectorId.class).toInstance(new KafkaConnectorId(connectorId));
binder.bind(TypeManager.class).toInstance(typeManager);
binder.bind(NodeManager.class).toInstance(nodeManager);
if (tableDescriptionSupplier.isPresent()) {
binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KafkaTopicDescription>>>() {}).toInstance(tableDescriptionSupplier.get());
}
else {
binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KafkaTopicDescription>>>() {}).to(KafkaTableDescriptionSupplier.class).in(Scopes.SINGLETON);
}
}
);
Injector injector = app.strictConfig()
.doNotInitializeLogging()
.setRequiredConfigurationProperties(config)
.setOptionalConfigurationProperties(optionalConfig)
.initialize();
return injector.getInstance(KafkaConnector.class);
}
catch (Exception e) {
throw Throwables.propagate(e);
}
}
开发者ID:y-lan,项目名称:presto,代码行数:37,代码来源:KafkaConnectorFactory.java
示例13: testSpinup
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
@Test
public void testSpinup()
{
ConnectorFactory factory = testConnectorExists();
Connector c = factory.create("test-connector", ImmutableMap.<String, String>builder()
.put("kafka.table-names", "test")
.put("kafka.nodes", "localhost:9092")
.build());
assertNotNull(c);
}
开发者ID:y-lan,项目名称:presto,代码行数:11,代码来源:TestKafkaPlugin.java
示例14: create
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> config)
{
try {
Bootstrap app = new Bootstrap(
new JsonModule(),
new MBeanModule(),
binder -> {
CurrentNodeId currentNodeId = new CurrentNodeId(nodeManager.getCurrentNode().getNodeIdentifier());
MBeanServer mbeanServer = new RebindSafeMBeanServer(getPlatformMBeanServer());
binder.bind(MBeanServer.class).toInstance(mbeanServer);
binder.bind(CurrentNodeId.class).toInstance(currentNodeId);
binder.bind(NodeManager.class).toInstance(nodeManager);
binder.bind(PageSorter.class).toInstance(pageSorter);
binder.bind(BlockEncodingSerde.class).toInstance(blockEncodingSerde);
binder.bind(TypeManager.class).toInstance(typeManager);
},
metadataModule,
new BackupModule(backupProviders),
new StorageModule(connectorId),
new RaptorModule(connectorId));
Injector injector = app
.strictConfig()
.doNotInitializeLogging()
.setRequiredConfigurationProperties(config)
.setOptionalConfigurationProperties(optionalConfig)
.initialize();
return injector.getInstance(RaptorConnector.class);
}
catch (Exception e) {
throw Throwables.propagate(e);
}
}
开发者ID:y-lan,项目名称:presto,代码行数:37,代码来源:RaptorConnectorFactory.java
示例15: create
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> requiredConfig)
{
return new BlackHoleConnector(
new BlackHoleMetadata(),
new BlackHoleSplitManager(),
new BlackHolePageSourceProvider(),
new BlackHolePageSinkProvider()
);
}
开发者ID:y-lan,项目名称:presto,代码行数:11,代码来源:BlackHoleConnectorFactory.java
示例16: create
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> properties)
{
return new Connector()
{
@Override
public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly)
{
checkConnectorSupports(READ_COMMITTED, isolationLevel);
return JmxTransactionHandle.INSTANCE;
}
@Override
public ConnectorMetadata getMetadata(ConnectorTransactionHandle transactionHandle)
{
return new JmxMetadata(connectorId, mbeanServer);
}
@Override
public ConnectorSplitManager getSplitManager()
{
return new JmxSplitManager(connectorId, nodeManager);
}
@Override
public ConnectorRecordSetProvider getRecordSetProvider()
{
return new JmxRecordSetProvider(mbeanServer, nodeManager.getCurrentNode().getNodeIdentifier());
}
};
}
开发者ID:y-lan,项目名称:presto,代码行数:32,代码来源:JmxConnectorFactory.java
示例17: getConnectorTransactionMetadata
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
public synchronized ConnectorTransactionMetadata getConnectorTransactionMetadata(String connectorId, Connector connector)
{
checkOpenTransaction();
ConnectorTransactionMetadata transactionMetadata = connectorIdToMetadata.get(connectorId);
if (transactionMetadata == null) {
transactionMetadata = new ConnectorTransactionMetadata(connector, beginTransaction(connector));
// Don't use computeIfAbsent b/c the beginTransaction call might be recursive
checkState(connectorIdToMetadata.put(connectorId, transactionMetadata) == null);
}
return transactionMetadata;
}
开发者ID:y-lan,项目名称:presto,代码行数:12,代码来源:TransactionManager.java
示例18: beginTransaction
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
private ConnectorTransactionHandle beginTransaction(Connector connector)
{
if (connector instanceof InternalConnector) {
return ((InternalConnector) connector).beginTransaction(transactionId, isolationLevel, readOnly);
}
else {
return connector.beginTransaction(isolationLevel, readOnly);
}
}
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:TransactionManager.java
示例19: createConnector
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
private static Connector createConnector(String connectorId, ConnectorFactory factory, Map<String, String> properties)
{
Class<?> factoryClass = factory.getClass();
if (factory instanceof LegacyTransactionConnectorFactory) {
factoryClass = ((LegacyTransactionConnectorFactory) factory).getConnectorFactory().getClass();
}
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(factoryClass.getClassLoader())) {
return factory.create(connectorId, properties);
}
}
开发者ID:y-lan,项目名称:presto,代码行数:12,代码来源:ConnectorManager.java
示例20: testTransactionWorkflow
import com.facebook.presto.spi.connector.Connector; //导入依赖的package包/类
@Test
public void testTransactionWorkflow()
throws Exception
{
try (IdleCheckExecutor executor = new IdleCheckExecutor()) {
TransactionManager transactionManager = TransactionManager.create(new TransactionManagerConfig(), executor.getExecutor(), finishingExecutor);
Connector c1 = new TpchConnectorFactory(new InMemoryNodeManager()).create("c1", ImmutableMap.of());
transactionManager.addConnector("c1", c1);
TransactionId transactionId = transactionManager.beginTransaction(false);
Assert.assertEquals(transactionManager.getAllTransactionInfos().size(), 1);
TransactionInfo transactionInfo = transactionManager.getTransactionInfo(transactionId);
Assert.assertFalse(transactionInfo.isAutoCommitContext());
Assert.assertTrue(transactionInfo.getConnectorIds().isEmpty());
Assert.assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
ConnectorMetadata metadata = transactionManager.getMetadata(transactionId, "c1");
metadata.listSchemaNames(TEST_SESSION.toConnectorSession("c1"));
transactionInfo = transactionManager.getTransactionInfo(transactionId);
Assert.assertEquals(transactionInfo.getConnectorIds(), ImmutableList.of("c1"));
Assert.assertFalse(transactionInfo.getWrittenConnectorId().isPresent());
transactionManager.asyncCommit(transactionId).join();
Assert.assertTrue(transactionManager.getAllTransactionInfos().isEmpty());
}
}
开发者ID:y-lan,项目名称:presto,代码行数:30,代码来源:TestTransactionManager.java
注:本文中的com.facebook.presto.spi.connector.Connector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论