public interface

PluginsTracker

com.atlassian.jira.plugin.util.PluginsTracker
Known Indirect Subclasses

Class Overview

This is a glorified list of plugin keys that code can use to track what plugins are involved in it's caches

On plugin events it can then ask if the event related to one of the tracked plugins

This uses a java.util.concurrent.CopyOnWriteArraySet under the covers to ensure that the list is as safe as possible. The assumption is that the reads and writes will be of low volume and the total number of plugins tracked will be smallish. In other words its anticipated that it will just work!

Summary

Nested Classes
class PluginsTracker.PluginInfo A simple class that contains plugin key and pluginVersion. 
Public Methods
void clear()
Clear the underlying set of tracked plugins
Set<PluginsTracker.PluginInfo> getInvolvedPluginKeys()
String getStateHashCode()
Return a hash that represents all the plugins in this tracker.
boolean isPluginInvolved(ModuleDescriptor moduleDescriptor)
Returns true if the plugin that this ModuleDescriptor belongs to is being tracked
boolean isPluginInvolved(Plugin plugin)
Returns true if the plugin is being tracked
boolean isPluginWithModuleDescriptor(Plugin plugin, Class<? extends ModuleDescriptor> targetModuleClass)
Returns true if the plugin pointed to by the moduleDescriptor contains in it a 1 or module descriptors with the target module descriptor class.
boolean isPluginWithModuleDescriptor(ModuleDescriptor moduleDescriptor, Class<? extends ModuleDescriptor> targetModuleClass)
Returns true if the plugin pointed to by the moduleDescriptor contains in it a 1 or modules with the target module descriptor class.
boolean isPluginWithResourceType(Plugin plugin, String pluginResourceType)
Returns true if the plugin contains resources of the specified type, for example "i18n" resource types
boolean isPluginWithResourceType(ModuleDescriptor moduleDescriptor, String pluginResourceType)
Returns true if the underlying plugin contains resources of the specified type, for example "i18n" resource types
void trackInvolvedPlugin(Plugin plugin)
Tracks a plugin as being involved
void trackInvolvedPlugin(ModuleDescriptor moduleDescriptor)
Tracks a plugin as being involved via it's ModuleDescriptor

Public Methods

public void clear ()

Clear the underlying set of tracked plugins

public Set<PluginsTracker.PluginInfo> getInvolvedPluginKeys ()

Returns
  • a copy of the underlying tracked plugin keys

public String getStateHashCode ()

Return a hash that represents all the plugins in this tracker. This hash should change if the list of plugins being tracked changes. It is used to help generate a cache busting WebResource URL prefix. That is, if this hash changes then it is likely that the URLs to all of JIRA's WebResources will change which will force all browsers to request all resources again.

Returns
  • Return a hash that represents all the plugins in this tracker.

public boolean isPluginInvolved (ModuleDescriptor moduleDescriptor)

Returns true if the plugin that this ModuleDescriptor belongs to is being tracked

Parameters
moduleDescriptor the ModuleDescriptor of the plugin in play
Returns
  • true if the underlying plugin is being tracked

public boolean isPluginInvolved (Plugin plugin)

Returns true if the plugin is being tracked

Parameters
plugin the plugin in play
Returns
  • true if the underlying plugin is being tracked

public boolean isPluginWithModuleDescriptor (Plugin plugin, Class<? extends ModuleDescriptor> targetModuleClass)

Returns true if the plugin pointed to by the moduleDescriptor contains in it a 1 or module descriptors with the target module descriptor class.

Parameters
plugin the plugin play (typically from a plugin event)
targetModuleClass the target capabilities you want to test
Returns
  • true if the underlying plugin has the designed module descriptor class

public boolean isPluginWithModuleDescriptor (ModuleDescriptor moduleDescriptor, Class<? extends ModuleDescriptor> targetModuleClass)

Returns true if the plugin pointed to by the moduleDescriptor contains in it a 1 or modules with the target module descriptor class.

Parameters
moduleDescriptor the module descriptor in play (typically from a plugin event)
targetModuleClass the target capabilities you want to test
Returns
  • true if the underlying plugin has the designed module descriptor class

public boolean isPluginWithResourceType (Plugin plugin, String pluginResourceType)

Returns true if the plugin contains resources of the specified type, for example "i18n" resource types

Parameters
plugin the plugin play (typically from a plugin event)
pluginResourceType the descriptive name of the resource type (for example "i18n")
Returns
  • true if the plugin cvontains resources of the specified type

public boolean isPluginWithResourceType (ModuleDescriptor moduleDescriptor, String pluginResourceType)

Returns true if the underlying plugin contains resources of the specified type, for example "i18n" resource types

Parameters
moduleDescriptor the module descriptor of the plugin play (typically from a plugin event)
pluginResourceType the descriptive name of the resource type (for example "i18n")
Returns
  • true if the plugin cvontains resources of the specified type

public void trackInvolvedPlugin (Plugin plugin)

Tracks a plugin as being involved

Parameters
plugin the plugin in play

public void trackInvolvedPlugin (ModuleDescriptor moduleDescriptor)

Tracks a plugin as being involved via it's ModuleDescriptor

Parameters
moduleDescriptor the ModuleDescriptor of the plugin in play