com.atlassian.plugin.metadata
Class DefaultPluginMetadataManager

java.lang.Object
  extended by com.atlassian.plugin.metadata.DefaultPluginMetadataManager
All Implemented Interfaces:
PluginMetadataManager

@Immutable
public final class DefaultPluginMetadataManager
extends Object
implements PluginMetadataManager

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

Since:
2.6

Constructor Summary
DefaultPluginMetadataManager()
          Production ctor.
 
Method Summary
 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 isUserInstalled(Plugin plugin)
          A plugin is determined to be non-user if Plugin.isBundledPlugin() is true or if the host application has indicated to the plugins system that a plugin was provided by it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPluginMetadataManager

public DefaultPluginMetadataManager()
Production ctor. Loads from the class path.

Method Detail

isUserInstalled

public boolean isUserInstalled(Plugin plugin)
A plugin is determined to be non-user if Plugin.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.

Specified by:
isUserInstalled in interface PluginMetadataManager
Parameters:
plugin - used to determine the state, not null.
Returns:
true if the plugin was not provided by the host application, false otherwise.

isOptional

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.

Specified by:
isOptional in interface PluginMetadataManager
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.

isOptional

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.

Specified by:
isOptional in interface PluginMetadataManager
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.


Copyright © 2011 Atlassian. All Rights Reserved.