io.gravitee.plugin.core.api.Plugin类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中io.gravitee.plugin.core.api.Plugin类的一些代码示例,展示了Plugin类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin类的具体详情如下:
包路径:io.gravitee.plugin.core.api.Plugin
类名称:Plugin

Plugin介绍

暂无

代码示例

代码示例来源:origin: gravitee-io/gravitee-gateway

ClassLoader classloader = pluginClassLoaderFactory.getOrCreateClassLoader(plugin, this.getClass().getClassLoader());
final Class<?> repositoryClass = classloader.loadClass(plugin.clazz());
LOGGER.info("Register a new repository plugin: {} [{}]", plugin.id(), plugin.clazz());

代码示例来源:origin: gravitee-io/gravitee-gateway

public Set<Plugin> plugins() {
  return pluginRegistry.plugins().stream().map(regPlugin -> {
    Plugin plugin = new Plugin();
    plugin.setId(regPlugin.id());
    plugin.setName(regPlugin.manifest().name());
    plugin.setDescription(regPlugin.manifest().description());
    plugin.setVersion(regPlugin.manifest().version());
    plugin.setType(regPlugin.type().name().toLowerCase());
    plugin.setPlugin(regPlugin.clazz());
    return plugin;
  }).collect(Collectors.toSet());
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-resource

@Override
public Path path() {
  return plugin.path();
}

代码示例来源:origin: io.gravitee.management/gravitee-management-api-service

private FetcherEntity convert(FetcherPlugin fetcherPlugin, boolean withPlugin) {
    FetcherEntity entity = new FetcherEntity();

    entity.setId(fetcherPlugin.id());
    entity.setDescription(fetcherPlugin.manifest().description());
    entity.setName(fetcherPlugin.manifest().name());
    entity.setVersion(fetcherPlugin.manifest().version());

    if (withPlugin) {
      // Plugin information
      Plugin plugin = fetcherPlugin;
      PluginEntity pluginEntity = new PluginEntity();

      pluginEntity.setPlugin(plugin.clazz());
      pluginEntity.setPath(plugin.path().toString());
      pluginEntity.setType(plugin.type().toString().toLowerCase());
      pluginEntity.setDependencies(plugin.dependencies());

      entity.setPlugin(pluginEntity);
    }

    return entity;
  }
}

代码示例来源:origin: gravitee-io/gravitee-gateway

@Override
public boolean canHandle(Plugin plugin) {
  return plugin.type() == PluginType.REPOSITORY;
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-fetcher

@Override
  public void handle(Plugin plugin) {
    try {
      URLClassLoader fetcherClassLoader = new URLClassLoader(plugin.dependencies(),
          this.getClass().getClassLoader());

      Class<?> pluginClass = ClassUtils.forName(plugin.clazz(), fetcherClassLoader);

      LOGGER.info("Register a new fetcher: {} [{}]", plugin.id(), pluginClass.getName());
      FetcherPluginImpl fetcher = new FetcherPluginImpl(plugin, pluginClass);
      fetcher.setConfiguration(new FetcherConfigurationClassFinder().lookupFirst(pluginClass, fetcherClassLoader));
      fetcherPluginManager.register(fetcher);
    } catch (Exception iae) {
      LOGGER.error("Unexpected error while creating fetcher instance", iae);
    }
  }
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-resource

@Override
public String id() {
  return plugin.id();
}

代码示例来源:origin: io.gravitee.management/gravitee-management-api-service

private PluginEntity convert(Plugin plugin) {
    PluginEntity entity = new PluginEntity();

    entity.setId(plugin.id());
    entity.setDescription(plugin.manifest().description());
    entity.setName(plugin.manifest().name());
    entity.setVersion(plugin.manifest().version());

    return entity;
  }
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-service-discovery

@Override
public String clazz() {
  return plugin.clazz();
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-service-discovery

@Override
public PluginManifest manifest() {
  return plugin.manifest();
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-policy

@Override
public URL[] dependencies() {
  return plugin.dependencies();
}

代码示例来源:origin: gravitee-io/gravitee-management-rest-api

private FetcherEntity convert(FetcherPlugin fetcherPlugin, boolean withPlugin) {
    FetcherEntity entity = new FetcherEntity();

    entity.setId(fetcherPlugin.id());
    entity.setDescription(fetcherPlugin.manifest().description());
    entity.setName(fetcherPlugin.manifest().name());
    entity.setVersion(fetcherPlugin.manifest().version());

    if (withPlugin) {
      // Plugin information
      Plugin plugin = fetcherPlugin;
      PluginEntity pluginEntity = new PluginEntity();

      pluginEntity.setPlugin(plugin.clazz());
      pluginEntity.setPath(plugin.path().toString());
      pluginEntity.setType(plugin.type().toString().toLowerCase());
      pluginEntity.setDependencies(plugin.dependencies());

      entity.setPlugin(pluginEntity);
    }

    return entity;
  }
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-policy

@Override
public boolean canHandle(Plugin plugin) {
  return plugin.type() == PluginType.POLICY;
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-service-discovery

@Override
  public void handle(Plugin plugin) {
    URLClassLoader serviceDiscoveryClassLoader = null;
    try {
      serviceDiscoveryClassLoader = new URLClassLoader(plugin.dependencies(),
          this.getClass().getClassLoader());

      Class<?> pluginClass = ClassUtils.forName(plugin.clazz(), serviceDiscoveryClassLoader);

      LOGGER.info("Register a new service discovery: {} [{}]", plugin.id(), pluginClass.getName());
      ServiceDiscoveryPluginImpl serviceDiscovery = new ServiceDiscoveryPluginImpl(plugin, pluginClass);
      serviceDiscovery.setConfiguration(new ServiceDiscoveryConfigurationClassFinder().lookupFirst(pluginClass, serviceDiscoveryClassLoader));
      serviceDiscoveryPluginManager.register(serviceDiscovery);
    } catch (Exception iae) {
      LOGGER.error("Unexpected error while creating service discovery instance", iae);
    }
  }
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-service-discovery

@Override
public String id() {
  return plugin.id();
}

代码示例来源:origin: io.gravitee.management/gravitee-management-api-service

private PluginEntity convert(Plugin plugin) {
    PluginEntity entity = new PluginEntity();

    entity.setId(plugin.id());
    entity.setDescription(plugin.manifest().description());
    entity.setName(plugin.manifest().name());
    entity.setVersion(plugin.manifest().version());

    return entity;
  }
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-fetcher

@Override
public String clazz() {
  return plugin.clazz();
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-resource

@Override
public PluginManifest manifest() {
  return plugin.manifest();
}

代码示例来源:origin: io.gravitee.plugin/gravitee-plugin-resource

@Override
public URL[] dependencies() {
  return plugin.dependencies();
}

代码示例来源:origin: io.gravitee.am.gateway/gravitee-am-gateway-services-core

@Override
  public void handle(Plugin plugin) {
    try {
      pluginClassLoaderFactory.getOrCreateClassLoader(plugin, this.getClass().getClassLoader());

      LOGGER.info("Register a new service: {} [{}]", plugin.id(), plugin.clazz());
      ApplicationContext context = pluginContextFactory.create(plugin);
      serviceManager.register((AbstractService) context.getBean(plugin.clazz()));

    } catch (Exception iae) {
      LOGGER.error("Unexpected error while create service instance", iae);
      // Be sure that the context does not exist anymore.
      pluginContextFactory.remove(plugin);
    }
  }
}

相关文章