本文整理汇总了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();
}
}
示例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());
}
示例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());
}
示例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());
}
示例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"));
}
示例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);
}
}
示例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"));
}
示例8: installPlugin
import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
public void installPlugin(Plugin plugin)
{
server.installPlugin(plugin);
}
示例9: installPlugin
import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
public void installPlugin(Plugin plugin)
{
pluginManager.installPlugin(plugin);
}
示例10: installPlugin
import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
@Override
public void installPlugin(Plugin plugin)
{
throw new UnsupportedOperationException();
}
示例11: installPlugin
import com.facebook.presto.spi.Plugin; //导入依赖的package包/类
void installPlugin(Plugin plugin);