Refine search
public Extension(Plugin plugin) { notNull(plugin); this.key = plugin.getKey(); this.name = plugin.getName(); this.description = plugin.getPluginInformation().getDescription(); this.version = plugin.getPluginInformation().getVersion(); this.params = new HashMap<String,String>(plugin.getPluginInformation().getParameters()); }
public boolean matches( Plugin plugin ) { try { Class<?> loadedClass = plugin.loadClass( DefaultOverrideManager.class.getName(), null ); Class<?> myClass = DefaultOverrideManager.class; return loadedClass == myClass; } catch ( ClassNotFoundException e ) { return false; } } } ) ) {
private static boolean resourcesAvailable(Plugin plugin, String... resources) { for (final String resource : resources) { if (plugin.getResource(resource) == null) { return false; } } return true; } }
public String getErrorMessage(final Plugin input) { final StringBuilder errorMessage = new StringBuilder(); errorMessage.append("* ").append(input.getName()).append(" (").append(input.getKey()).append(")"); final float pluginMinVersion = input.getPluginInformation().getMinVersion(); final String pluginVersion = input.getPluginInformation().getVersion(); errorMessage.append(" v").append(pluginVersion).append(" - requires JIRA v").append(pluginMinVersion).append(" minimum"); return errorMessage.toString(); } }
private void restVersion(Map<String, String> container) { Plugin plugin = pluginAccessor.getPlugin("com.atlassian.plugins.rest.atlassian-rest-module"); if (plugin != null) { container.put("Atlassian REST", plugin.getPluginInformation().getVersion()); } }
private void removeAdminTasks(final Map<String, SimpleLink> linkIdMap, final List<String> moduleIdList) { final Plugin selectedPlugin = pluginAccessor.getPlugin("jira.top.navigation.bar"); if (pluginAccessor.isPluginEnabled(selectedPlugin.getKey())) { Collection<ModuleDescriptor<?>> moduleDescriptors = selectedPlugin.getModuleDescriptors(); for (ModuleDescriptor<?> moduleDescriptor : moduleDescriptors) { if (pluginAccessor.isPluginModuleEnabled(moduleDescriptor.getCompleteKey())) { if (moduleDescriptor instanceof WebItemModuleDescriptor) { moduleIdList.add(((WebItemModuleDescriptor) moduleDescriptor).getLink().getId()); } } } linkIdMap.keySet().removeAll(moduleIdList); } }
@Override public Optional<ConnectIFrame> fetchConnectIFrame(String addonKey, String moduleKey, Optional<String> optionalClassifier) { if (moduleKey.startsWith(addonKey + ModuleKeyUtils.ADDON_MODULE_SEPARATOR)) { log.info("ACDEV-2694: connect iframe requested for module " + addonKey + ":" + moduleKey); } ModuleDescriptor moduleDescriptor = pluginAccessor.getEnabledPluginModule( new ModuleCompleteKey(pluginRetrievalService.getPlugin().getKey(), ConnectIFrameModuleDescriptor.getModuleKey(addonKey, moduleKey, optionalClassifier)).getCompleteKey()); if (moduleDescriptor != null) { return Optional.of((ConnectIFrame)moduleDescriptor.getModule()); } return Optional.empty(); } }
@GET @Path("content") @Produces(APPLICATION_OCTET_STREAM) public Response getContent() { return Response.ok(PluginResourceResolver.getResourceResolver(plugin).getArtifactAsStream(), APPLICATION_OCTET_STREAM_TYPE) .header("Content-Disposition", "attachment; filename=" + plugin.getKey() + "-" + plugin.getPluginInformation().getVersion() + ".jar").build(); }
@Override protected TemplateRenderer createRenderer(Plugin plugin) { return new VelocityTemplateRendererImpl(plugin.getClassLoader(), plugin.getKey(), Collections.<String, String>emptyMap(), templateContextFactory); } }
@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; }
public void removeState(final Plugin plugin) { apply(builder -> { builder.removeState(plugin.getKey()); for (final ModuleDescriptor<?> moduleDescriptor : plugin.getModuleDescriptors()) { builder.removeState(moduleDescriptor.getCompleteKey()); } }); } }
public List<String> listLocalization() { Plugin plugin = pluginAccessor.getPlugin(Constants.PLUGIN_KEY); Collection<ModuleDescriptor<?>> descriptors = plugin.getModuleDescriptors(); List<String> result = new ArrayList<>(); for (ModuleDescriptor<?> descriptor : descriptors) { if (descriptor.getKey().startsWith(LOCALIZATION_DESCRIPTOR_PREFIX)) { String webResourceId = descriptor.getCompleteKey(); if (StringUtils.isNotEmpty(webResourceId)) { String languageKey = webResourceId.substring(webResourceId.length() - 2, webResourceId.length()); result.add(languageKey.toLowerCase()); } } } return result; }
@Override public void contribute(final ImmutableMap.Builder<String, Object> builder, final String name, final Object value) { if (value instanceof Plugin) builder.put(name + ".key", ((Plugin) value).getKey()); if (value instanceof ModuleDescriptor) builder.put(name + ".key", ((ModuleDescriptor<?>) value).getCompleteKey()); } }
@Override public void append(final Plugin input, Map<String, Object> map) { PluginInformation info = input.getPluginInformation(); map.put("name", input.getName()); map.put("version", info.getVersion()); map.put("vendor", info.getVendorName()); map.put("enabled", extendedSystemInfoUtils.isPluginEnabled(input)); map.put("parameters", arrarify(info.getParameters())); } }.build(extendedSystemInfoUtils.getPlugins());
@Override public InputStream open(URI uri) throws IOException { Plugin plugin = resolvePlugin(uri); InputStream in = plugin.getResourceAsStream(getResourcePath(uri)); if (in == null) { throw new IOException(uri.getPath() + " does not exist in plugin " + plugin.getKey()); } return in; }
@Override public boolean matches(Plugin plugin) { return plugin != null && !pluginAccessor.isPluginEnabled(plugin.getKey()); } });
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); }
protected PluginDetails expandInternal(PluginDetails entity) { final Plugin plugin = pluginAccessor.getPlugin(entity.getKey()); entity.setName(plugin.getName()); entity.setPluginInfo(PluginInfo.getInfo(plugin.getPluginInformation())); entity.setPluginModules(PluginModule.getModules(pluginAccessor, plugin)); return entity; } }
public List<String> findAllEnabledExtensions(String user) { List<String> result = newArrayList(); for (Plugin plugin : pluginAccessor.getEnabledPlugins()) { if (data.getUsersList(plugin.getKey()).contains(user)) { result.add(plugin.getKey()); } } return result; }