Exemplo n.º 1
0
 void doStart(List<RemotePlugin> remotePlugins) {
   PluginFilter filter = new PluginFilter(settings, analysisMode);
   metadataByKey = Maps.newHashMap();
   for (RemotePlugin remote : remotePlugins) {
     if (filter.accepts(remote.getKey())) {
       File pluginFile = pluginDownloader.downloadPlugin(remote);
       PluginMetadata metadata = pluginInstaller.installToCache(pluginFile, remote.isCore());
       if (StringUtils.isBlank(metadata.getBasePlugin())
           || filter.accepts(metadata.getBasePlugin())) {
         metadataByKey.put(metadata.getKey(), metadata);
       } else {
         LOG.debug("Excluded plugin: " + metadata.getKey());
       }
     }
   }
   classLoaders = new PluginClassloaders(Thread.currentThread().getContextClassLoader());
   pluginsByKey = classLoaders.init(metadataByKey.values());
 }
Exemplo n.º 2
0
  void writeIndex(File indexFile) throws IOException {
    FileUtils.forceMkdir(indexFile.getParentFile());
    FileWriter writer = new FileWriter(indexFile, false);
    try {
      for (PluginMetadata metadata : repository.getMetadata()) {
        if (!repository.isDisabled(metadata.getKey())) {
          writer.append(RemotePlugin.create((DefaultPluginMetadata) metadata).marshal());
          writer.append(CharUtils.LF);
        }
      }
      writer.flush();

    } finally {
      IOUtils.closeQuietly(writer);
    }
  }