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      /**
16       * Determines if the plugin was installed by a user.
17       * 
18       * @param plugin used to determine the state, not null.
19       * @return true if the plugin was installed by a user,
20       *         false otherwise.
21       */
22      boolean isUserInstalled(Plugin plugin);
23  
24      /**
25       * This is used to determine if the plugin was provided by the host
26       * application.
27       *
28       * @param plugin used to determine the state, not null.
29       * @return true if the plugin was provided by the host application,
30       *         false otherwise.
31       */
32      boolean isSystemProvided(Plugin plugin);
33  
34      /**
35       * This is used to determine if a plugin is considered optional. If an
36       * optional plugin is disabled it should not adversely effect the host
37       * application. If any {@link ModuleDescriptor}'s are not optional then the
38       * plugin is also not optional.
39       * 
40       * @param plugin used to determine the state, not null.
41       * @return true if the plugin can safely be disabled, false if the plugin
42       *         being disabled would adversely effect the host application.
43       */
44      boolean isOptional(Plugin plugin);
45  
46      /**
47       * This is used to determine if a module is considered optional. If an
48       * optional module is disabled it should not adversely effect the host
49       * application. A module can not be optional if its containing plugin is not
50       * optional.
51       * 
52       * @param moduleDescriptor used to determine state, not null.
53       * @return true if the module can safely be disabled, false if the module
54       *         being disabled would adversely effect the host application.
55       */
56      boolean isOptional(ModuleDescriptor<?> moduleDescriptor);
57  }