View Javadoc

1   package com.atlassian.plugin;
2   
3   import com.google.common.collect.ImmutableSet;
4   
5   import java.util.Set;
6   
7   import static com.google.common.base.Preconditions.checkNotNull;
8   
9   /**
10   * This exception is thrown by {@link ModuleDescriptor module descriptors} when a set of their required permissions is
11   * not met by the plugin declaring them.
12   *
13   * @since 3.0
14   */
15  public final class ModulePermissionException extends PluginException
16  {
17      private final String moduleKey;
18      private final Set<String> permissions;
19  
20      public ModulePermissionException(String moduleKey, Set<String> permissions)
21      {
22          super("Could not load module " + moduleKey + ". The plugin is missing the following permissions: " + permissions);
23          this.moduleKey = checkNotNull(moduleKey);
24          this.permissions = ImmutableSet.copyOf(checkNotNull(permissions));
25      }
26  
27      public String getModuleKey()
28      {
29          return moduleKey;
30      }
31  
32      public Set<String> getPermissions()
33      {
34          return permissions;
35      }
36  }