当前位置: 首页>>代码示例>>Java>>正文


Java Plugin类代码示例

本文整理汇总了Java中com.facebook.presto.spi.Plugin的典型用法代码示例。如果您正苦于以下问题:Java Plugin类的具体用法?Java Plugin怎么用?Java Plugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Plugin类属于com.facebook.presto.spi包,在下文中一共展示了Plugin类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
public void run()
        throws Exception
{
    try (TestingPrestoServer server = new TestingPrestoServer()) {
        for (String pluginClass : options.getPluginClassNames()) {
            Plugin plugin = (Plugin) Class.forName(pluginClass).newInstance();
            server.installPlugin(plugin);
        }

        for (Catalog catalog : options.getCatalogs()) {
            server.createCatalog(catalog.getCatalogName(), catalog.getConnectorName());
        }

        System.out.println(server.getAddress());
        waitForInterruption();
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:18,代码来源:TestingPrestoServerLauncher.java

示例2: discoverPlugins

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
public static Set<String> discoverPlugins(Artifact artifact, ClassLoader classLoader)
        throws IOException
{
    if (!artifact.getExtension().equals("presto-plugin")) {
        throw new RuntimeException("Unexpected extension for main artifact: " + artifact);
    }

    File file = artifact.getFile();
    if (!file.getPath().endsWith("/target/classes")) {
        throw new RuntimeException("Unexpected file for main artifact: " + file);
    }
    if (!file.isDirectory()) {
        throw new RuntimeException("Main artifact file is not a directory: " + file);
    }

    if (new File(file, SERVICES_FILE).exists()) {
        return ImmutableSet.of();
    }

    return listClasses(file.toPath()).stream()
            .filter(name -> classInterfaces(name, classLoader).contains(Plugin.class.getName()))
            .collect(toImmutableSet());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:24,代码来源:PluginDiscovery.java

示例3: loadPlugin

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T extends Plugin> T loadPlugin(Class<T> clazz)
{
    for (Plugin plugin : ServiceLoader.load(Plugin.class)) {
        if (clazz.isInstance(plugin)) {
            return (T) plugin;
        }
    }
    throw new AssertionError("did not find plugin: " + clazz.getName());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:11,代码来源:TestRaptorPlugin.java

示例4: installPlugin

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
@Override
public void installPlugin(Plugin plugin)
{
    long start = System.nanoTime();
    for (TestingPrestoServer server : servers) {
        server.installPlugin(plugin);
    }
    log.info("Installed plugin %s in %s", plugin.getClass().getSimpleName(), nanosSince(start).convertToMostSuccinctTimeUnit());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:10,代码来源:DistributedQueryRunner.java

示例5: testCreateConnector

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
@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"));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:9,代码来源:TestPostgreSqlPlugin.java

示例6: loadPlugin

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
private void loadPlugin(URLClassLoader pluginClassLoader)
        throws Exception
{
    ServiceLoader<Plugin> serviceLoader = ServiceLoader.load(Plugin.class, pluginClassLoader);
    List<Plugin> plugins = ImmutableList.copyOf(serviceLoader);

    if (plugins.isEmpty()) {
        log.warn("No service providers of type %s", Plugin.class.getName());
    }

    for (Plugin plugin : plugins) {
        log.info("Installing %s", plugin.getClass().getName());
        installPlugin(plugin);
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:16,代码来源:PluginManager.java

示例7: testCreateConnector

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
@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"));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:9,代码来源:TestMySqlPlugin.java

示例8: installPlugin

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
public void installPlugin(Plugin plugin)
{
    server.installPlugin(plugin);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:5,代码来源:StandaloneQueryRunner.java

示例9: installPlugin

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
public void installPlugin(Plugin plugin)
{
    pluginManager.installPlugin(plugin);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:5,代码来源:TestingPrestoServer.java

示例10: installPlugin

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
@Override
public void installPlugin(Plugin plugin)
{
    throw new UnsupportedOperationException();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:6,代码来源:LocalQueryRunner.java

示例11: installPlugin

import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
void installPlugin(Plugin plugin); 
开发者ID:y-lan,项目名称:presto,代码行数:2,代码来源:QueryRunner.java


注:本文中的com.facebook.presto.spi.Plugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。