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;
 }
Example #2
0
 @VisibleForTesting
 void doStart(ClassLoader classloader) {
   this.classloader = classloader;
   propertyToBundles = Maps.newHashMap();
   Collection<PluginMetadata> metadata = pluginRepository.getMetadata();
   if (metadata.isEmpty()) {
     addPlugin("core");
   } else {
     for (PluginMetadata plugin : pluginRepository.getMetadata()) {
       addPlugin(plugin.getKey());
     }
   }
   LOG.debug(String.format("Loaded %d properties from l10n bundles", propertyToBundles.size()));
 }
Example #3
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);
    }
  }
Example #4
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());
 }
 public int compareTo(PluginMetadata other) {
   return name.compareTo(other.getName());
 }