Exemplo n.º 1
0
 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;
 }
Exemplo n.º 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()));
 }
Exemplo n.º 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);
    }
  }
Exemplo n.º 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());
 }
Exemplo n.º 5
0
 public int compareTo(PluginMetadata other) {
   return name.compareTo(other.getName());
 }