View Javadoc
1   package com.atlassian.plugin.metadata;
2   
3   import com.atlassian.plugin.ModuleDescriptor;
4   import com.atlassian.plugin.Plugin;
5   
6   /**
7    * Provides information about plugins and modules that is application host
8    * specific. The information is not relevant to the plugins system but may be
9    * relevant to managing the plugins.
10   *
11   * @since 2.6
12   */
13  public interface PluginMetadataManager {
14      /**
15       * Determines if the plugin was installed by a user.
16       *
17       * @param plugin used to determine the state, not null.
18       * @return true if the plugin was installed by a user,
19       * false otherwise.
20       */
21      boolean isUserInstalled(Plugin plugin);
22  
23      /**
24       * This is used to determine if the plugin was provided by the host
25       * application.
26       *
27       * @param plugin used to determine the state, not null.
28       * @return true if the plugin was provided by the host application,
29       * false otherwise.
30       */
31      boolean isSystemProvided(Plugin plugin);
32  
33      /**
34       * This is used to determine if a plugin is considered optional. If an
35       * optional plugin is disabled it should not adversely effect the host
36       * application. If any {@link ModuleDescriptor}'s are not optional then the
37       * plugin is also not optional.
38       *
39       * @param plugin used to determine the state, not null.
40       * @return true if the plugin can safely be disabled, false if the plugin
41       * being disabled would adversely effect the host application.
42       */
43      boolean isOptional(Plugin plugin);
44  
45      /**
46       * This is used to determine if a module is considered optional. If an
47       * optional module is disabled it should not adversely effect the host
48       * application. A module can not be optional if its containing plugin is not
49       * optional.
50       *
51       * @param moduleDescriptor used to determine state, not null.
52       * @return true if the module can safely be disabled, false if the module
53       * being disabled would adversely effect the host application.
54       */
55      boolean isOptional(ModuleDescriptor<?> moduleDescriptor);
56  }