@Override public String getCompleteKey() { return String.format("%s:%s", plugin.getKey(), key); }
public MockPluginAccessor addPlugin(Plugin plugin) { plugins.put(plugin.getKey(), plugin); return this; }
@Override public boolean onEnableException(final Plugin plugin, final Exception pluginException) { PluginInfo pluginInfo = trackedPlugins.get(plugin.getKey()); if (pluginInfo != null) { PluginInfo value = PluginInfo.addFailures(pluginInfo, pluginException); failedPlugins.put(plugin.getKey(), value); } return false; }
private Plugin findDelayedPlugin(final String key) { return delayedPlugins.stream() .filter(plugin -> plugin.getKey().equals(key)) .findFirst() .orElse(null); }
public Iterable<String> toPluginKeyDependencyTypes(final Set<PluginDependencies.Type> dependencyTypes) { final List<String> output = new ArrayList<>(); for (final Map.Entry<Plugin, PluginDependencies.Type> entry : plugins.entrySet()) { if (dependencyTypes.contains(entry.getValue())) { output.add(entry.getKey().getKey() + "(" + entry.getValue() + ")"); } } return output; }
@Override public Map<String, PluginEnabledState> getPluginEnabledStateMap(Plugin plugin) { return getStatesMap().entrySet().stream() .filter(e -> e.getKey().startsWith(plugin.getKey())) .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); }
public String getErrorMessage(final Plugin input) { return "* The plugin '" + input.getName() + "' (" + input.getKey() + ") is no longer compatible with this version of JIRA and needs to be removed. Its functionality has been incorporated into JIRA core."; } }
/** * Set the owner/manager of the item * @param plugin the plugin who owns/manages this item * @return the builder */ public ManagedConfigurationItemBuilder setSource(Plugin plugin) { return setSource(ManagedConfigurationItemService.SOURCE_PREFIX_PLUGIN + plugin.getKey()); }
@Override public int compareTo(final Plugin o) { return getKey().compareTo(o.getKey()); }
@Before public void setupMocks() { when(mockPlugin.getKey()).thenReturn("plugin.key"); }
@Override public void removePlugin(Plugin plugin) throws PluginException { if (!(plugin instanceof UnloadablePlugin)) { super.removePlugin(plugin); } else { logger.debug("Detected an unloadable plugin '{}', so skipping removal", plugin.getKey()); } }
@Override public void discardPlugin(Plugin plugin) throws PluginException { if (!(plugin instanceof UnloadablePlugin)) { super.discardPlugin(plugin); } else { logger.debug("Detected an unloadable plugin '{}', so skipping discard", plugin.getKey()); } }
@Override public boolean test(final Plugin plugin) { return matchType.processMatcher(pattern.matcher(plugin.getKey())); } }
/** * This is called then the PluginFactory has decided it can create a plugin BUT it hasn't started it and hence * resolved its dependencies * * @param plugin the plugin that has been created by the PluginFactory but not resolved * @param pluginArtifact the artifact used to load this plugin */ public void trackLoadingPlugin(final Plugin plugin, final PluginArtifact pluginArtifact) { PluginInfo pluginInfo = new PluginInfo(plugin.getKey(), plugin.getName(), Option.some(pluginArtifact)); trackedPlugins.put(plugin.getKey(), pluginInfo); }
@PluginEventListener public void onPluginDisabledEvent(PluginDisabledEvent disabledEvent) { final Plugin plugin = disabledEvent.getPlugin(); log.debug(String.format("Plugin with key '%s' has been disabled.", plugin.getKey())); }
public PluginInfo apply(Plugin plugin) { return new PluginInfo(plugin.getKey(), plugin.getName()); } }
public Collection<Plugin> getPlugins() { final SortedSet<Plugin> plugins = new TreeSet<>(new PluginComparator()); for(Plugin plugin : pluginAccessor.getPlugins()) { if (!plugins.add(plugin)) { throw new IllegalStateException("Multiple plugins with the same key and version:" + plugin.getKey() + " " + plugin.getPluginsVersion()); } } return Collections.unmodifiableSet(plugins); }
@PluginEventListener public void onPluginUpgraded(final PluginUpgradedEvent event) { remove(event.getPlugin().getKey()); }
@Override public void init(Plugin plugin, Element element) throws PluginParseException { super.init(plugin, element); if (systemPermissionOverride(plugin)) { throw new PluginParseException("Plugin '" + plugin.getKey() + "' cannot override system project permission '" + getKey() + "'"); } descriptionI18nKey = element.attributeValue("i18n-description-key"); this.element = element; initCategory(element); }
public void removeState(final Plugin plugin) { apply(builder -> { builder.removeState(plugin.getKey()); for (final ModuleDescriptor<?> moduleDescriptor : plugin.getModuleDescriptors()) { builder.removeState(moduleDescriptor.getCompleteKey()); } }); } }