@Immutable public final class

DefaultPluginMetadataManager

extends Object
implements PluginMetadataManager
java.lang.Object
   ↳ com.atlassian.plugin.metadata.DefaultPluginMetadataManager

Class Overview

A default implementation that uses the ClasspathFilePluginMetadata plugin metadata implementation to resolve the application provided plugin metadata.

Summary

Public Constructors
DefaultPluginMetadataManager()
Production ctor.
Public Methods
boolean isOptional(ModuleDescriptor<?> moduleDescriptor)
A module is determined to be optional if the host application has not indicated to the plugins system that it is required.
boolean isOptional(Plugin plugin)
A plugin is determined to be optional if the host application has not indicated to the plugins system that it is required or if any of its modules have been flagged as not optional.
boolean isSystemProvided(Plugin plugin)
A plugin is determined to be "system" if isUserInstalled(com.atlassian.plugin.Plugin) is false.
boolean isUserInstalled(Plugin plugin)

A plugin is determined to be non-user if isBundledPlugin() is true or if the host application has indicated to the plugins system that a plugin was provided by it.

[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.metadata.PluginMetadataManager

Public Constructors

public DefaultPluginMetadataManager ()

Production ctor. Loads from the class path.

Public Methods

public boolean isOptional (ModuleDescriptor<?> moduleDescriptor)

A module is determined to be optional if the host application has not indicated to the plugins system that it is required. If the call to isOptional with the module descriptor's plugin is false, then this method will also return false. Also if the module descriptor is annotated with CannotDisable then it can not be optional.

Parameters
moduleDescriptor used to determine state, not null.
Returns
  • true if the module can safely be disabled, false if the module being disabled would adversely effect the host application.

public boolean isOptional (Plugin plugin)

A plugin is determined to be optional if the host application has not indicated to the plugins system that it is required or if any of its modules have been flagged as not optional.

Parameters
plugin used to determine the state, not null.
Returns
  • true if the plugin can safely be disabled, false if the plugin being disabled would adversely effect the host application.

public boolean isSystemProvided (Plugin plugin)

A plugin is determined to be "system" if isUserInstalled(com.atlassian.plugin.Plugin) is false.

Parameters
plugin used to determine the state, not null.
Returns
  • true if the plugin was provided by the host application, false otherwise.

public boolean isUserInstalled (Plugin plugin)

A plugin is determined to be non-user if isBundledPlugin() is true or if the host application has indicated to the plugins system that a plugin was provided by it.

NOTE: If a user has upgraded a bundled plugin then the decision of whether it is user installed plugin is determined by if the application has indicated to the plugins system that a plugin was provided or not.

Parameters
plugin used to determine the state, not null.
Returns
  • true if the plugin was installed by a user, false otherwise.