View Javadoc
1   package com.atlassian.plugin.manager;
2   
3   import com.atlassian.annotations.PublicSpi;
4   import com.atlassian.plugin.ModuleDescriptor;
5   import com.atlassian.plugin.Plugin;
6   
7   /**
8    * Controls what plugins are enabled when plugins are disabled from start-up using command-line options.
9    * (NB: this is currently not the same as safe-mode as defined in UPM, as UPM allows the user to restore
10   * the system to how it was before entering safe-mode)
11   * {@link DefaultSafeModeManager} should be suitable for most implementations
12   */
13  @PublicSpi
14  public interface SafeModeManager {
15      /**
16       * Default implementation of safe mode manager
17       * Just a convenient way to start all the plugins skipping all checks
18       */
19      SafeModeManager START_ALL_PLUGINS  = new SafeModeManager() {
20          @Override
21          public boolean pluginShouldBeStarted(Plugin plugin, Iterable<ModuleDescriptor> descriptors) {
22              return true;
23          }
24  
25          @Override
26          public boolean isInSafeMode() {
27              return false;
28          }
29      };
30  
31      /**
32       * This checks if a plugin should be started when safe-mode is on
33       *
34       * @param plugin      to be checked if it should be started
35       * @param descriptors list of module descriptors to find the plugin references that must be started in safe mode
36       *                    (this is kinda tricky way to do such search, but the only available at the startup phase)
37       * @return true if plugin should be started when the product starts up or false otherwise
38       */
39      boolean pluginShouldBeStarted(Plugin plugin, Iterable<ModuleDescriptor> descriptors);
40  
41      boolean isInSafeMode();
42  }