Package org.sonar.api

Examples of org.sonar.api.Plugin


      .setMainClass("org.sonar.plugins.checkstyle.CheckstylePlugin")
      .addDeployedFile(getFile("sonar-checkstyle-plugin-2.8.jar"));

    Map<String, Plugin> map = classloaders.init(Arrays.<PluginMetadata>asList(checkstyle));

    Plugin checkstyleEntryPoint = map.get("checkstyle");
    ClassRealm checkstyleRealm = (ClassRealm) checkstyleEntryPoint.getClass().getClassLoader();
    assertThat(checkstyleRealm.getId()).isEqualTo("checkstyle");
  }
View Full Code Here


      .setMainClass("com.mycompany.sonar.checkstyle.CheckstyleExtensionsPlugin")
      .addDeployedFile(getFile("sonar-checkstyle-extensions-plugin-0.1-SNAPSHOT.jar"));

    Map<String, Plugin> map = classloaders.init(Arrays.<PluginMetadata>asList(checkstyle, checkstyleExt));

    Plugin checkstyleEntryPoint = map.get("checkstyle");
    Plugin checkstyleExtEntryPoint = map.get("checkstyle-ext");

    assertThat(checkstyleEntryPoint.getClass().getClassLoader().equals(checkstyleExtEntryPoint.getClass().getClassLoader())).isTrue();
  }
View Full Code Here

  public void installExtensions(ComponentContainer container) {
    ListMultimap<PluginMetadata, Object> installedExtensionsByPlugin = ArrayListMultimap.create();

    for (PluginMetadata pluginMetadata : pluginRepository.getMetadata()) {
      Plugin plugin = pluginRepository.getPlugin(pluginMetadata.getKey());
      container.addExtension(pluginMetadata, plugin);

      for (Object extension : plugin.getExtensions()) {
        if (installExtension(container, pluginMetadata, extension, true) != null) {
          installedExtensionsByPlugin.put(pluginMetadata, extension);
        } else {
          container.declareExtension(pluginMetadata, extension);
        }
View Full Code Here

      contributingPluginKeyToClassLoader = Maps.newTreeMap();
      // Add default model
      contributingPluginKeyToClassLoader.put(DEFAULT_MODEL, getClass().getClassLoader());
      for (PluginMetadata metadata : pluginRepository.getMetadata()) {
        String pluginKey = metadata.getKey();
        Plugin plugin = pluginRepository.getPlugin(pluginKey);
        if (plugin != null) {
          ClassLoader classLoader = plugin.getClass().getClassLoader();
          if (classLoader.getResource(getXMLFilePath(pluginKey)) != null) {
            contributingPluginKeyToClassLoader.put(pluginKey, classLoader);
          }
        }
      }
View Full Code Here

    LOG.info("Deploy Ruby on Rails applications");
    File appsDir = prepareRailsDirectory();

    for (PluginMetadata pluginMetadata : pluginRepository.getMetadata()) {
      String pluginKey = pluginMetadata.getKey();
      Plugin plugin = pluginRepository.getPlugin(pluginKey);
      if (plugin != null) {
        try {
          deployRailsApp(appsDir, pluginKey, plugin.getClass().getClassLoader());
        } catch (Exception e) {
          throw new IllegalStateException("Fail to deploy Ruby on Rails application: " + pluginKey, e);
        }
      }
    }
View Full Code Here

class I18nClassloader extends URLClassLoader {

  private static List<ClassLoader> classLoadersFromPlugin(PluginRepository pluginRepository) {
    List<ClassLoader> list = Lists.newArrayList();
    for (PluginMetadata metadata : pluginRepository.getMetadata()) {
      Plugin plugin = pluginRepository.getPlugin(metadata.getKey());
      list.add(plugin.getClass().getClassLoader());
    }
    return list;
  }
View Full Code Here

    }

    // plugin extensions
    for (Map.Entry<PluginMetadata, Plugin> entry : pluginRepository.getPluginsByMetadata().entrySet()) {
      PluginMetadata metadata = entry.getKey();
      Plugin plugin = entry.getValue();
      for (Object extension : plugin.getExtensions()) {
        doInstall(container, matcher, metadata, extension);
      }
    }
    List<ExtensionProvider> providers = container.getComponentsByType(ExtensionProvider.class);
    for (ExtensionProvider provider : providers) {
View Full Code Here

  }

  private void installPlugins() {
    for (Map.Entry<PluginMetadata, Plugin> entry : getComponentByType(BatchPluginRepository.class).getPluginsByMetadata().entrySet()) {
      PluginMetadata metadata = entry.getKey();
      Plugin plugin = entry.getValue();
      addExtension(metadata, plugin);
    }
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.Plugin

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.