Java 类com.facebook.presto.spi.ConnectorFactory 实例源码

项目:presto    文件:ExamplePlugin.java   
@Override
public synchronized <T> List<T> getServices(Class<T> type)
{
    if (type == ConnectorFactory.class) {
        return ImmutableList.of(type.cast(new ExampleConnectorFactory(typeManager, getOptionalConfig())));
    }
    return ImmutableList.of();
}
项目:presto    文件:RedisPlugin.java   
@Override
public synchronized <T> List<T> getServices(Class<T> type)
{
    if (type == ConnectorFactory.class) {
        return ImmutableList.of(type.cast(new RedisConnectorFactory(typeManager, nodeManager, tableDescriptionSupplier, optionalConfig)));
    }
    return ImmutableList.of();
}
项目:presto    文件:TestRedisPlugin.java   
@Test
public ConnectorFactory testConnectorExists()
{
    RedisPlugin plugin = new RedisPlugin();
    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;
}
项目:presto    文件:TestRedisPlugin.java   
@Test
public void testStartup()
{
    ConnectorFactory factory = testConnectorExists();
    Connector c = factory.create("test-connector", ImmutableMap.<String, String>builder()
            .put("redis.table-names", "test")
            .put("redis.nodes", "localhost:6379")
            .build());
    assertNotNull(c);
}
项目:presto    文件:TestPostgreSqlPlugin.java   
@Test
public void testCreateConnector()
        throws Exception
{
    Plugin plugin = new PostgreSqlPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getServices(ConnectorFactory.class));
    factory.create("test", ImmutableMap.of("connection-url", "test"));
}
项目:presto    文件:JdbcPlugin.java   
@Override
public <T> List<T> getServices(Class<T> type)
{
    if (type == ConnectorFactory.class) {
        return ImmutableList.of(type.cast(new JdbcConnectorFactory(name, module, optionalConfig, getClassLoader())));
    }
    return ImmutableList.of();
}
项目:presto    文件:TestMySqlPlugin.java   
@Test
public void testCreateConnector()
        throws Exception
{
    Plugin plugin = new MySqlPlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getServices(ConnectorFactory.class));
    factory.create("test", ImmutableMap.of("connection-url", "test"));
}
项目:presto    文件:HivePlugin.java   
@Override
public <T> List<T> getServices(Class<T> type)
{
    if (type == ConnectorFactory.class) {
        return ImmutableList.of(type.cast(new HiveConnectorFactory(name, optionalConfig, getClassLoader(), metastore, typeManager, pageIndexerFactory)));
    }
    return ImmutableList.of();
}
项目:presto-riak    文件:RiakPlugin.java   
@Override
public <T> List<T> getServices(Class<T> type) {
    if (type == ConnectorFactory.class) {
        return ImmutableList.of(type.cast(new RiakConnectorFactory(typeManager, getOptionalConfig())));
    }
    return ImmutableList.of();
}
项目:presto-kafka-connector    文件:KafkaPlugin.java   
@Override
public <T> List<T> getServices(Class<T> type)
{
    if (type == ConnectorFactory.class)
    {
        return ImmutableList.of(type.cast(new KafkaConnectorFactory(
                "kafka", optionalConfig, getClassLoader())));
    }
    return ImmutableList.of();
}
项目:cloudata    文件:SqlEngine.java   
public SqlEngine(StructuredStore store, ExecutorService executor) {
    this.store = store;
    this.executor = executor;
    MetadataManager metadataManager = new MetadataManager();

    SplitManager splitManager = new SplitManager(Sets.<ConnectorSplitManager> newHashSet());

    this.dataStreamManager = new DataStreamManager();
    HandleResolver handleResolver = new HandleResolver();
    Map<String, ConnectorFactory> connectorFactories = Maps.newHashMap();
    Map<String, Connector> globalConnectors = Maps.newHashMap();

    RecordSinkManager recordSinkManager = new RecordSinkManager();
    Map<String, ConnectorOutputHandleResolver> handleIdResolvers = Maps.newHashMap();
    OutputTableHandleResolver outputTableHandleResolver = new OutputTableHandleResolver(handleIdResolvers);

    this.connectorManager = new ConnectorManager(metadataManager, splitManager, dataStreamManager,
            recordSinkManager, handleResolver, outputTableHandleResolver, connectorFactories, globalConnectors);

    // NodeManager nodeManager = new InMemoryNodeManager();
    PlanOptimizersFactory planOptimizersFactory = new PlanOptimizersFactory(metadataManager, splitManager);
    List<PlanOptimizer> planOptimizers = planOptimizersFactory.get();

    this.metadataManager = metadataManager;
    this.planOptimizers = planOptimizers;
    this.periodicImportManager = new StubPeriodicImportManager();
    this.storageManager = new StubStorageManager();

    NodeManager nodeManager = new InMemoryNodeManager();
    CloudataConnectorFactory cloudataConnectorFactory = new CloudataConnectorFactory(nodeManager,
            Maps.<String, String> newHashMap(), store);

    connectorManager.addConnectorFactory(cloudataConnectorFactory);

    connectorManager.createConnection(catalogName, CloudataConnectorFactory.PROVIDER_ID,
            Maps.<String, String> newHashMap());

    this.cloudataConnector = cloudataConnectorFactory.get(catalogName);
}