Package com.facebook.presto.spi

Examples of com.facebook.presto.spi.ConnectorFactory


    @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"));
    }
View Full Code Here


        }
    }

    public void addConnectorFactory(ConnectorFactory connectorFactory)
    {
        ConnectorFactory existingConnectorFactory = connectorFactories.putIfAbsent(connectorFactory.getName(), connectorFactory);
        checkArgument(existingConnectorFactory == null, "Connector %s is already registered", connectorFactory.getName());
    }
View Full Code Here

        // for now connectorId == catalogName
        String connectorId = catalogName;
        checkState(!connectors.containsKey(connectorId), "A connector %s already exists", connectorId);

        ConnectorFactory connectorFactory = connectorFactories.get(connectorName);
        Preconditions.checkArgument(connectorFactory != null, "No factory for connector %s", connectorName);

        Connector connector = connectorFactory.create(connectorId, properties);
        connectors.put(connectorId, connector);

        addConnector(catalogName, connectorId, connector);
    }
View Full Code Here

        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;
    }
View Full Code Here

    }

    @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);
    }
View Full Code Here

        plugin.setNodeManager(new InMemoryNodeManager());
        plugin.setBlockEncodingSerde(createTestingBlockEncodingManager());
        plugin.setTypeManager(new TypeRegistry());

        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);
        }
    }
View Full Code Here

    @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"));
    }
View Full Code Here

        this.connectorFactories.putAll(connectorFactories);
    }

    public void addConnectorFactory(ConnectorFactory connectorFactory)
    {
        ConnectorFactory existingConnectorFactory = connectorFactories.putIfAbsent(connectorFactory.getName(), connectorFactory);
        checkArgument(existingConnectorFactory == null, "Connector %s is already registered", connectorFactory.getName());
    }
View Full Code Here

    {
        checkNotNull(catalogName, "catalogName is null");
        checkNotNull(connectorName, "connectorName is null");
        checkNotNull(properties, "properties is null");

        ConnectorFactory connectorFactory = connectorFactories.get(connectorName);
        checkArgument(connectorFactory != null, "No factory for connector %s", connectorName);
        try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(connectorFactory.getClass().getClassLoader())) {
            createConnection(catalogName, connectorFactory, properties);
        }
    }
View Full Code Here

        }
    }

    public void addConnectorFactory(ConnectorFactory connectorFactory)
    {
        ConnectorFactory existingConnectorFactory = connectorFactories.putIfAbsent(connectorFactory.getName(), connectorFactory);
        checkArgument(existingConnectorFactory == null, "Connector %s is already registered", connectorFactory.getName());
    }
View Full Code Here

TOP

Related Classes of com.facebook.presto.spi.ConnectorFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.