Package org.sonar.core.plugins

Examples of org.sonar.core.plugins.DefaultPluginMetadata


    }
  }

  private void loadInstalledPlugins() {
    for (File file : fs.getUserPlugins()) {
      DefaultPluginMetadata metadata = installer.extractMetadata(file, false);
      if (StringUtils.isNotBlank(metadata.getKey())) {
        loadInstalledPlugin(metadata);
      }
    }
  }
View Full Code Here


  }

  private void copyBundledPlugins() {
    if (serverUpgradeStatus.isFreshInstall()) {
      for (File sourceFile : fs.getBundledPlugins()) {
        DefaultPluginMetadata metadata = installer.extractMetadata(sourceFile, false);
        // lib/bundled-plugins should be copied only if the plugin is not already
        // available in extensions/plugins
        if (!pluginByKeys.containsKey(metadata.getKey())) {
          overridePlugin(sourceFile, false);
        }
      }
    }
  }
View Full Code Here

    } catch (IOException e) {
      LOG.error(String.format("Fail to move or copy plugin: %s to %s",
        sourceFile.getAbsolutePath(), destFile.getAbsolutePath()), e);
    }

    DefaultPluginMetadata metadata = installer.extractMetadata(destFile, false);
    if (StringUtils.isNotBlank(metadata.getKey())) {
      PluginMetadata existing = pluginByKeys.put(metadata.getKey(), metadata);
      if (existing != null) {
        if (!existing.getFile().getName().equals(destFile.getName())) {
          FileUtils.deleteQuietly(existing.getFile());
        }
        LOG.info("Plugin " + metadata.getKey() + " replaced by new version");
      }
    }
  }
View Full Code Here

    }
  }

  private void loadCorePlugins() {
    for (File file : fs.getCorePlugins()) {
      DefaultPluginMetadata metadata = installer.extractMetadata(file, true);
      PluginMetadata existing = pluginByKeys.put(metadata.getKey(), metadata);
      if (existing != null) {
        throw new IllegalStateException("Found two plugins with the same key '" + metadata.getKey() + "': " + metadata.getFile().getName() + " and "
          + existing.getFile().getName());
      }
    }
  }
View Full Code Here

  public BatchPluginJarInstaller(FileCache cache) {
    this.cache = cache;
  }

  public DefaultPluginMetadata installToCache(File pluginFile, boolean isCore) {
    DefaultPluginMetadata metadata = extractMetadata(pluginFile, isCore);
    install(metadata, null, pluginFile);
    return metadata;
  }
View Full Code Here

  }

  @Test
  public void should_copy_and_extract_dependencies() throws IOException {
    File fileFromCache = getFileFromCache("sonar-checkstyle-plugin-2.8.jar");
    DefaultPluginMetadata metadata = extractor.installToCache(fileFromCache, true);

    assertThat(metadata.getKey()).isEqualTo("checkstyle");
    assertThat(new File(fileFromCache.getParent(), "sonar-checkstyle-plugin-2.8.jar")).exists();
    assertThat(new File(fileFromCache.getParent(), "sonar-checkstyle-plugin-2.8.jar_unzip/META-INF/lib/checkstyle-5.1.jar")).exists();
  }
View Full Code Here

TOP

Related Classes of org.sonar.core.plugins.DefaultPluginMetadata

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.