< prev index next >

src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java

Print this page




  76 
  77         List<String> seen = new ArrayList<>();
  78         // split into categories and check for plugin with same name.
  79         for (Plugin plug : pluginsConfiguration.getPlugins()) {
  80             if (seen.contains(plug.getName())) {
  81                 throw new Exception("Plugin " + plug.getName()
  82                         + " added more than once to stack ");
  83             }
  84             seen.add(plug.getName());
  85             Category category = plug.getType();
  86             if (category == null) {
  87                 throw new PluginException("Invalid category for "
  88                         + plug.getName());
  89             }
  90             List<Plugin> lst = plugins.get(category);
  91             lst.add(plug);
  92         }
  93 
  94         List<Plugin> orderedPlugins = new ArrayList<>();
  95         plugins.entrySet().stream().forEach((entry) -> {
  96             // Sort according to plugin constraints
  97             orderedPlugins.addAll(PluginOrderingGraph.sort(entry.getValue()));
  98         });
  99         Plugin lastSorter = null;
 100         for (Plugin plugin : orderedPlugins) {
 101             if (plugin.getName().equals(pluginsConfiguration.getLastSorterPluginName())) {
 102                 lastSorter = plugin;
 103                 break;
 104             }
 105         }
 106         if (pluginsConfiguration.getLastSorterPluginName() != null && lastSorter == null) {
 107             throw new IOException("Unknown last plugin "
 108                     + pluginsConfiguration.getLastSorterPluginName());
 109         }
 110         ImageBuilder builder = pluginsConfiguration.getImageBuilder();
 111         if (builder == null) {
 112             // This should be the case for jimage only creation or post-install.
 113             builder = new ImageBuilder() {
 114 
 115                 @Override
 116                 public DataOutputStream getJImageOutputStream() {
 117                     throw new PluginException("No directory setup to store files");


  76 
  77         List<String> seen = new ArrayList<>();
  78         // split into categories and check for plugin with same name.
  79         for (Plugin plug : pluginsConfiguration.getPlugins()) {
  80             if (seen.contains(plug.getName())) {
  81                 throw new Exception("Plugin " + plug.getName()
  82                         + " added more than once to stack ");
  83             }
  84             seen.add(plug.getName());
  85             Category category = plug.getType();
  86             if (category == null) {
  87                 throw new PluginException("Invalid category for "
  88                         + plug.getName());
  89             }
  90             List<Plugin> lst = plugins.get(category);
  91             lst.add(plug);
  92         }
  93 
  94         List<Plugin> orderedPlugins = new ArrayList<>();
  95         plugins.entrySet().stream().forEach((entry) -> {
  96             orderedPlugins.addAll(entry.getValue());

  97         });
  98         Plugin lastSorter = null;
  99         for (Plugin plugin : orderedPlugins) {
 100             if (plugin.getName().equals(pluginsConfiguration.getLastSorterPluginName())) {
 101                 lastSorter = plugin;
 102                 break;
 103             }
 104         }
 105         if (pluginsConfiguration.getLastSorterPluginName() != null && lastSorter == null) {
 106             throw new IOException("Unknown last plugin "
 107                     + pluginsConfiguration.getLastSorterPluginName());
 108         }
 109         ImageBuilder builder = pluginsConfiguration.getImageBuilder();
 110         if (builder == null) {
 111             // This should be the case for jimage only creation or post-install.
 112             builder = new ImageBuilder() {
 113 
 114                 @Override
 115                 public DataOutputStream getJImageOutputStream() {
 116                     throw new PluginException("No directory setup to store files");
< prev index next >