本文整理汇总了Java中com.facebook.presto.spi.connector.ConnectorFactory类的典型用法代码示例。如果您正苦于以下问题:Java ConnectorFactory类的具体用法?Java ConnectorFactory怎么用?Java ConnectorFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectorFactory类属于com.facebook.presto.spi.connector包,在下文中一共展示了ConnectorFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getServices
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Override
public <T> List<T> getServices(Class<T> type)
{
checkState(nodeManager != null, "NodeManager has not been set");
checkState(blockEncodingSerde != null, "BlockEncodingSerde has not been set");
checkState(typeManager != null, "TypeManager has not been set");
if (type == ConnectorFactory.class) {
return ImmutableList.of(type.cast(new RaptorConnectorFactory(
name,
metadataModule,
backupProviders,
optionalConfig,
nodeManager,
pageSorter,
blockEncodingSerde,
typeManager)));
}
return ImmutableList.of();
}
开发者ID:y-lan,项目名称:presto,代码行数:21,代码来源:RaptorPlugin.java
示例2: createLocalQueryRunner
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
public static LocalQueryRunner createLocalQueryRunner()
{
Session session = testSessionBuilder()
.setCatalog("raptor")
.setSchema("benchmark")
.build();
LocalQueryRunner localQueryRunner = new LocalQueryRunner(session);
// add tpch
InMemoryNodeManager nodeManager = localQueryRunner.getNodeManager();
localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(nodeManager, 1), ImmutableMap.<String, String>of());
// add raptor
ConnectorFactory raptorConnectorFactory = createRaptorConnectorFactory(TPCH_CACHE_DIR, nodeManager);
localQueryRunner.createCatalog("raptor", raptorConnectorFactory, ImmutableMap.of());
if (!localQueryRunner.tableExists(session, "orders")) {
localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch.sf1.orders");
}
if (!localQueryRunner.tableExists(session, "lineitem")) {
localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch.sf1.lineitem");
}
return localQueryRunner;
}
开发者ID:y-lan,项目名称:presto,代码行数:25,代码来源:RaptorBenchmarkQueryRunner.java
示例3: addCatalogConnector
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的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
示例4: testConnectorExists
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Test
public ConnectorFactory testConnectorExists()
{
KinesisPlugin plugin = TestUtils.createPluginInstance();
// Create factory manually to double check everything is done right
Iterable<ConnectorFactory> iter = plugin.getConnectorFactories();
List<ConnectorFactory> factories = new ArrayList<>();
for (ConnectorFactory cf : iter) {
factories.add(cf);
}
assertNotNull(factories);
assertEquals(factories.size(), 1);
ConnectorFactory factory = factories.get(0);
assertNotNull(factory);
return factory;
}
开发者ID:qubole,项目名称:presto-kinesis,代码行数:19,代码来源:TestKinesisPlugin.java
示例5: createConnector
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的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
示例6: getConnectorFactories
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Override
public Iterable<ConnectorFactory> getConnectorFactories()
{
return ImmutableList.of(new RestConnectorFactory(
"slack", config -> new SlackRest(config.get("token"))
));
}
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:8,代码来源:SlackPlugin.java
示例7: getConnectorFactories
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Override
public Iterable<ConnectorFactory> getConnectorFactories()
{
return ImmutableList.of(new RestConnectorFactory(
"github", config -> new GithubRest(config.get("token"))
));
}
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:8,代码来源:GithubPlugin.java
示例8: getConnectorFactories
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Override
public Iterable<ConnectorFactory> getConnectorFactories()
{
return ImmutableList.of(new RestConnectorFactory(
"twitter",
config -> new TwitterRest(
config.get("customer_key"),
config.get("customer_secret"),
config.get("token"),
config.get("secret"))
));
}
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:13,代码来源:TwitterPlugin.java
示例9: getServices
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Override
public synchronized <T> List<T> getServices(Class<T> type)
{
if (type == ConnectorFactory.class) {
return ImmutableList.of(type.cast(new KafkaConnectorFactory(typeManager, nodeManager, tableDescriptionSupplier, optionalConfig)));
}
return ImmutableList.of();
}
开发者ID:y-lan,项目名称:presto,代码行数:9,代码来源:KafkaPlugin.java
示例10: testConnectorExists
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Test
public ConnectorFactory testConnectorExists()
{
KafkaPlugin plugin = new KafkaPlugin();
plugin.setTypeManager(new TestingTypeManager());
plugin.setNodeManager(new TestingNodeManager());
List<ConnectorFactory> factories = plugin.getServices(ConnectorFactory.class);
assertNotNull(factories);
assertEquals(factories.size(), 1);
ConnectorFactory factory = factories.get(0);
assertNotNull(factory);
return factory;
}
开发者ID:y-lan,项目名称:presto,代码行数:15,代码来源:TestKafkaPlugin.java
示例11: testSpinup
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的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
示例12: createRaptorConnectorFactory
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
private static ConnectorFactory createRaptorConnectorFactory(String cacheDir, NodeManager nodeManager)
{
try {
File dataDir = new File(cacheDir);
File databaseDir = new File(dataDir, "db");
Map<String, String> config = ImmutableMap.<String, String>builder()
.put("metadata.db.type", "h2")
.put("metadata.db.filename", databaseDir.getAbsolutePath())
.put("storage.data-directory", dataDir.getAbsolutePath())
.put("storage.compress", "false")
.build();
TypeManager typeManager = new TypeRegistry();
BlockEncodingSerde blockEncodingSerde = new BlockEncodingManager(typeManager);
RaptorPlugin plugin = new RaptorPlugin();
plugin.setOptionalConfig(config);
plugin.setNodeManager(nodeManager);
plugin.setBlockEncodingSerde(blockEncodingSerde);
plugin.setTypeManager(typeManager);
return getOnlyElement(plugin.getServices(ConnectorFactory.class));
}
catch (Exception e) {
throw Throwables.propagate(e);
}
}
开发者ID:y-lan,项目名称:presto,代码行数:30,代码来源:RaptorBenchmarkQueryRunner.java
示例13: testPlugin
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Test
public void testPlugin()
throws Exception
{
RaptorPlugin plugin = loadPlugin(RaptorPlugin.class);
plugin.setNodeManager(new InMemoryNodeManager());
TypeRegistry typeRegistry = new TypeRegistry();
plugin.setTypeManager(typeRegistry);
plugin.setBlockEncodingSerde(new BlockEncodingManager(typeRegistry));
plugin.setPageSorter(new PagesIndexPageSorter());
List<ConnectorFactory> factories = plugin.getServices(ConnectorFactory.class);
ConnectorFactory factory = getOnlyElement(factories);
assertInstanceOf(factory, RaptorConnectorFactory.class);
File tmpDir = Files.createTempDir();
try {
Map<String, String> config = ImmutableMap.<String, String>builder()
.put("metadata.db.type", "h2")
.put("metadata.db.filename", tmpDir.getAbsolutePath())
.put("storage.data-directory", tmpDir.getAbsolutePath())
.build();
factory.create("test", config);
}
finally {
FileUtils.deleteRecursively(tmpDir);
}
}
开发者ID:y-lan,项目名称:presto,代码行数:33,代码来源:TestRaptorPlugin.java
示例14: getServices
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Override
public <T> List<T> getServices(Class<T> type)
{
if (type == ConnectorFactory.class) {
return ImmutableList.of(type.cast(new BlackHoleConnectorFactory()));
}
return ImmutableList.of();
}
开发者ID:y-lan,项目名称:presto,代码行数:9,代码来源:BlackHolePlugin.java
示例15: getServices
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Override
public <T> List<T> getServices(Class<T> type)
{
if (type == ConnectorFactory.class) {
requireNonNull(nodeManager, "nodeManager is null");
return ImmutableList.of(type.cast(new IndexedTpchConnectorFactory(nodeManager, indexSpec, 4)));
}
return ImmutableList.of();
}
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:IndexedTpchPlugin.java
示例16: getServices
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Override
public synchronized <T> List<T> getServices(Class<T> type)
{
if (type == ConnectorFactory.class) {
return ImmutableList.of(type.cast(new JmxConnectorFactory(mBeanServer, nodeManager)));
}
return ImmutableList.of();
}
开发者ID:y-lan,项目名称:presto,代码行数:9,代码来源:JmxPlugin.java
示例17: addConnectorFactory
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
public void addConnectorFactory(ConnectorFactory connectorFactory)
{
checkState(!stopped.get(), "ConnectorManager is stopped");
ConnectorFactory existingConnectorFactory = connectorFactories.putIfAbsent(connectorFactory.getName(), connectorFactory);
checkArgument(existingConnectorFactory == null, "Connector %s is already registered", connectorFactory.getName());
handleResolver.addConnectorName(connectorFactory.getName(), connectorFactory.getHandleResolver());
}
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:ConnectorManager.java
示例18: createConnection
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
public void createConnection(String catalogName, String connectorName, Map<String, String> properties)
{
requireNonNull(connectorName, "connectorName is null");
ConnectorFactory connectorFactory = connectorFactories.get(connectorName);
checkArgument(connectorFactory != null, "No factory for connector %s", connectorName);
createConnection(catalogName, connectorFactory, properties);
}
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:ConnectorManager.java
示例19: createConnector
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的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: createCatalog
import com.facebook.presto.spi.connector.ConnectorFactory; //导入依赖的package包/类
@Deprecated
public void createCatalog(String catalogName, com.facebook.presto.spi.ConnectorFactory connectorFactory, Map<String, String> properties)
{
nodeManager.addCurrentNodeDatasource(catalogName);
connectorManager.addConnectorFactory(connectorFactory);
connectorManager.createConnection(catalogName, connectorFactory.getName(), properties);
}
开发者ID:y-lan,项目名称:presto,代码行数:8,代码来源:LocalQueryRunner.java
注:本文中的com.facebook.presto.spi.connector.ConnectorFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论