Package com.atlassian.plugin.manager
Class EnabledModuleCachingPluginAccessor
java.lang.Object
com.atlassian.plugin.manager.EnabledModuleCachingPluginAccessor
- All Implemented Interfaces:
PluginAccessor
A caching decorator which caches
getEnabledModuleDescriptorsByClass(Class) and getEnabledModulesByClass(Class) on PluginAccessor interface.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.plugin.PluginAccessor
PluginAccessor.Descriptor -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEnabledModuleCachingPluginAccessor(PluginAccessor delegate, PluginEventManager pluginEventManager, PluginController pluginController) -
Method Summary
Modifier and TypeMethodDescription<D extends ModuleDescriptor<?>>
List<D>getActiveModuleDescriptorsByClass(Class<D> descriptorClazz) Deprecated.getDynamicModules(Plugin plugin) getDynamicResourceAsStream(String resourcePath) <D extends ModuleDescriptor<?>>
List<D>getEnabledModuleDescriptorsByClass(Class<D> descriptorClazz) This method overrides the same method on PluginAccessor from the plugin system.<M> List<M>getEnabledModulesByClass(Class<M> moduleClass) This method overrides the same method on PluginAccessor from the plugin system.getEnabledPlugin(String pluginKey) getEnabledPluginModule(String completeKey) <M> Collection<ModuleDescriptor<M>>getModuleDescriptors(Predicate<ModuleDescriptor<M>> moduleDescriptorPredicate) <M> Collection<M>getModules(Predicate<ModuleDescriptor<M>> moduleDescriptorPredicate) getPluginModule(String completeKey) getPlugins(Predicate<Plugin> pluginPredicate) booleanisPluginEnabled(String key) booleanisPluginModuleEnabled(String completeKey) booleanisSystemPlugin(String key) voidClears the enabled module cache when any plugin is disabled.voidonPluginEnable(PluginEnabledEvent event) Clears the cache when any plugin is enabled.voidvoidvoidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.plugin.PluginAccessor
getActiveModuleDescriptorsByClass, getClassLoader, getDynamicModules, getDynamicResourceAsStream, getEnabledPlugin, getEnabledPluginModule, getEnabledPlugins, getModuleDescriptors, getModuleDescriptors, getModules, getModules, getPlugin, getPluginModule, getPluginRestartState, getPlugins, getPlugins, getPlugins, isPluginEnabled, isPluginModuleEnabled, isSystemPlugin
-
Field Details
-
delegate
-
-
Constructor Details
-
EnabledModuleCachingPluginAccessor
public EnabledModuleCachingPluginAccessor(PluginAccessor delegate, PluginEventManager pluginEventManager, PluginController pluginController)
-
-
Method Details
-
onPluginDisable
Clears the enabled module cache when any plugin is disabled. This ensures old modules are never returned from disabled plugins.- Parameters:
event- The plugin disabled event
-
onPluginEnable
Clears the cache when any plugin is enabled. -
onPluginModuleEnabled
-
onPluginModuleDisabled
-
onPluginFrameworkShutdown
-
getEnabledModuleDescriptorsByClass
public <D extends ModuleDescriptor<?>> List<D> getEnabledModuleDescriptorsByClass(Class<D> descriptorClazz) This method overrides the same method on PluginAccessor from the plugin system. We keep an up to date cache of (module descriptor class M -> collection of module descriptors of descriptor class M) so we can avoid the expensive call to the plugin system.- Specified by:
getEnabledModuleDescriptorsByClassin interfacePluginAccessor- Parameters:
descriptorClazz- The module descriptor class you wish to find all enabled instances of- Returns:
- A list of all instances of enabled plugin module descriptors of the specified descriptor class
-
getEnabledModulesByClass
This method overrides the same method on PluginAccessor from the plugin system. We keep an up to date cache of (module class M -> collection of module descriptors that have module class M) so we can avoid the expensive call to the plugin system.- Specified by:
getEnabledModulesByClassin interfacePluginAccessor- Parameters:
moduleClass- The module class you wish to find all instances of- Returns:
- A list of all instances of enabled plugin modules of the specified class
-
getClassLoader
- Specified by:
getClassLoaderin interfacePluginAccessor
-
getDynamicResourceAsStream
- Specified by:
getDynamicResourceAsStreamin interfacePluginAccessor
-
getActiveModuleDescriptorsByClass
@Deprecated public <D extends ModuleDescriptor<?>> List<D> getActiveModuleDescriptorsByClass(Class<D> descriptorClazz) Deprecated.- Specified by:
getActiveModuleDescriptorsByClassin interfacePluginAccessor
-
getEnabledPlugin
- Specified by:
getEnabledPluginin interfacePluginAccessor
-
getEnabledPluginModule
- Specified by:
getEnabledPluginModulein interfacePluginAccessor
-
getEnabledPlugins
- Specified by:
getEnabledPluginsin interfacePluginAccessor
-
getModuleDescriptors
public <M> Collection<ModuleDescriptor<M>> getModuleDescriptors(Predicate<ModuleDescriptor<M>> moduleDescriptorPredicate) - Specified by:
getModuleDescriptorsin interfacePluginAccessor
-
getModules
- Specified by:
getModulesin interfacePluginAccessor
-
getPlugin
- Specified by:
getPluginin interfacePluginAccessor
-
getPluginModule
- Specified by:
getPluginModulein interfacePluginAccessor
-
getPluginRestartState
- Specified by:
getPluginRestartStatein interfacePluginAccessor
-
getPlugins
- Specified by:
getPluginsin interfacePluginAccessor
-
getPlugins
- Specified by:
getPluginsin interfacePluginAccessor
-
isPluginEnabled
- Specified by:
isPluginEnabledin interfacePluginAccessor
-
isPluginModuleEnabled
- Specified by:
isPluginModuleEnabledin interfacePluginAccessor
-
isSystemPlugin
- Specified by:
isSystemPluginin interfacePluginAccessor
-
getDynamicModules
- Specified by:
getDynamicModulesin interfacePluginAccessor
-