com.atlassian.plugin.tracker
Class DefaultPluginModuleTracker<M,T extends ModuleDescriptor<M>>
java.lang.Object
com.atlassian.plugin.tracker.DefaultPluginModuleTracker<M,T>
- All Implemented Interfaces:
- PluginModuleTracker<M,T>
public class DefaultPluginModuleTracker<M,T extends ModuleDescriptor<M>>
- extends java.lang.Object
- implements PluginModuleTracker<M,T>
Tracks enabled plugin module descriptors, focusing on fast reads
- Since:
- 2.6.0
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultPluginModuleTracker
public DefaultPluginModuleTracker(PluginAccessor pluginAccessor,
PluginEventManager pluginEventManager,
java.lang.Class<T> moduleDescriptorClass)
DefaultPluginModuleTracker
public DefaultPluginModuleTracker(PluginAccessor pluginAccessor,
PluginEventManager pluginEventManager,
java.lang.Class<T> moduleDescriptorClass,
PluginModuleTracker.Customizer<M,T> pluginModuleTrackerCustomizer)
getModuleDescriptors
public java.lang.Iterable<T> getModuleDescriptors()
- Specified by:
getModuleDescriptors in interface PluginModuleTracker<M,T extends ModuleDescriptor<M>>
- Returns:
- a snapshot of the currently tracked enabled module descriptors
getModules
public java.lang.Iterable<M> getModules()
- Description copied from interface:
PluginModuleTracker
- Gets a snapshot of the currently tracked enabled module instances
- Specified by:
getModules in interface PluginModuleTracker<M,T extends ModuleDescriptor<M>>
- Returns:
- The module instances
size
public int size()
- Specified by:
size in interface PluginModuleTracker<M,T extends ModuleDescriptor<M>>
- Returns:
- The number of module descriptors currently tracked. Should only be used for reporting purposes as it
only reflects the size at exactly the calling time.
close
public void close()
- Description copied from interface:
PluginModuleTracker
- Closes the tracker. Ensure you call this, or you may cause a memory leak.
- Specified by:
close in interface PluginModuleTracker<M,T extends ModuleDescriptor<M>>
onPluginModuleEnabled
public void onPluginModuleEnabled(PluginModuleEnabledEvent event)
onPluginModuleDisabled
public void onPluginModuleDisabled(PluginModuleDisabledEvent event)
onPluginDisabled
public void onPluginDisabled(PluginDisabledEvent event)
create
public static <M,T extends ModuleDescriptor<M>> PluginModuleTracker<M,T> create(PluginAccessor pluginAccessor,
PluginEventManager pluginEventManager,
java.lang.Class<? extends ModuleDescriptor<?>> moduleDescriptorClass)
- Static factory method for constructing trackers generically where M is not known.
- Type Parameters:
M - The module class, generically inferred.T - The module descriptor class.- Parameters:
pluginAccessor - For getting the enabled descriptors of a certain type.pluginEventManager - For being told about changes to the enabled plugins.moduleDescriptorClass - The type of module descriptors we are interested in.
- Returns:
- a PluginModuleTracker useful for fast and upd to date caching of the currently enabled module descriptors.
- Since:
- 2.7.0
Copyright © 2012 Atlassian. All Rights Reserved.