@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { int len = in.readInt(); byte[] bytes = new byte[len]; in.readFully(bytes); Map<String, PluginWithLocation> plugins = getGson().fromJson(new InputStreamReader(new ByteArrayInputStream(bytes), StandardCharsets.UTF_8), PLUGINS_TYPE); extraPlugins.putAll(plugins); for (PluginWithLocation plugin : plugins.values()) { pluginInstantiator.addArtifact(plugin.getArtifactLocation(), plugin.getPlugin().getArtifactId()); } }
/** * Returns the {@link Plugin} information for the given plugin id that were configured via this context. */ private Plugin getExtraPlugin(String pluginId) { // Get the map of plugins from either the configurer (handler method) or the extra plugins map (executor) Map<String, PluginWithLocation> plugins = pluginConfigurer == null ? extraPlugins : pluginConfigurer.getPlugins(); PluginWithLocation plugin = plugins.get(pluginId); if (plugin == null) { throw new IllegalArgumentException("Plugin with id " + pluginId + " does not exist"); } return plugin.getPlugin(); }
if (existing != null) { throw new IllegalArgumentException(String.format("Plugin of type %s, name %s was already added as id %s.", existing.getPlugin().getPluginClass().getType(), existing.getPlugin().getPluginClass().getName(), pluginId)); Plugin plugin = FindPluginHelper.getPlugin(Iterables.transform(parents, ArtifactId::toApiArtifactId), pluginEntry, properties, pluginType, pluginName, pluginInstantiator); plugins.put(pluginId, new PluginWithLocation(plugin, pluginEntry.getKey().getLocation())); return plugin; } catch (PluginNotExistsException e) {
/** * Returns the {@link Plugin} information for the given plugin id that were configured via this context. */ private Plugin getExtraPlugin(String pluginId) { // Get the map of plugins from either the configurer (handler method) or the extra plugins map (executor) Map<String, PluginWithLocation> plugins = pluginConfigurer == null ? extraPlugins : pluginConfigurer.getPlugins(); PluginWithLocation plugin = plugins.get(pluginId); if (plugin == null) { throw new IllegalArgumentException("Plugin with id " + pluginId + " does not exist"); } return plugin.getPlugin(); }
if (existing != null) { throw new IllegalArgumentException(String.format("Plugin of type %s, name %s was already added as id %s.", existing.getPlugin().getPluginClass().getType(), existing.getPlugin().getPluginClass().getName(), pluginId)); Plugin plugin = FindPluginHelper.getPlugin(Iterables.transform(parents, ArtifactId::toApiArtifactId), pluginEntry, properties, pluginType, pluginName, pluginInstantiator); plugins.put(pluginId, new PluginWithLocation(plugin, pluginEntry.getKey().getLocation())); return plugin; } catch (PluginNotExistsException e) {
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { int len = in.readInt(); byte[] bytes = new byte[len]; in.readFully(bytes); Map<String, PluginWithLocation> plugins = getGson().fromJson(new InputStreamReader(new ByteArrayInputStream(bytes), StandardCharsets.UTF_8), PLUGINS_TYPE); extraPlugins.putAll(plugins); for (PluginWithLocation plugin : plugins.values()) { pluginInstantiator.addArtifact(plugin.getArtifactLocation(), plugin.getPlugin().getArtifactId()); } }
public Map<String, Plugin> getPlugins() { Map<String, Plugin> plugins = pluginConfigurer.getPlugins().entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().getPlugin())); plugins.putAll(extraPlugins); return plugins; }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { int len = in.readInt(); byte[] bytes = new byte[len]; in.readFully(bytes); Map<String, PluginWithLocation> plugins = getGson().fromJson(new InputStreamReader(new ByteArrayInputStream(bytes), StandardCharsets.UTF_8), PLUGINS_TYPE); extraPlugins.putAll(plugins); for (PluginWithLocation plugin : plugins.values()) { pluginInstantiator.addArtifact(plugin.getArtifactLocation(), plugin.getPlugin().getArtifactId()); } }
public Map<String, Plugin> getPlugins() { Map<String, Plugin> plugins = pluginConfigurer.getPlugins().entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().getPlugin())); plugins.putAll(extraPlugins); return plugins; }
/** * Returns the {@link Plugin} information for the given plugin id that were configured via this context. */ private Plugin getExtraPlugin(String pluginId) { // Get the map of plugins from either the configurer (handler method) or the extra plugins map (executor) Map<String, PluginWithLocation> plugins = pluginConfigurer == null ? extraPlugins : pluginConfigurer.getPlugins(); PluginWithLocation plugin = plugins.get(pluginId); if (plugin == null) { throw new IllegalArgumentException("Plugin with id " + pluginId + " does not exist"); } return plugin.getPlugin(); }