View Javadoc

1   package com.atlassian.plugin.descriptors;
2   
3   import com.atlassian.plugin.Plugin;
4   import com.atlassian.plugin.PluginParseException;
5   
6   import org.dom4j.Element;
7   
8   /**
9    * Instances of this class represent a module which <i>could not be loaded</i>, not a module
10   * which <i>can be unloaded</i>.
11   */
12  public class UnloadableModuleDescriptor extends AbstractModuleDescriptor<Void>
13  {
14      private String errorText;
15  
16      @Override
17      public Void getModule()
18      {
19          return null;
20      }
21  
22      @Override
23      protected void loadClass(final Plugin plugin, final Element element) throws PluginParseException
24      {
25      // don't try to load the class -- we are possibly here because it doesn't exist
26      }
27  
28      @Override
29      public boolean isEnabledByDefault()
30      {
31          // An Unloadable module is never enabled
32          return false;
33      }
34  
35      public String getErrorText()
36      {
37          return errorText;
38      }
39  
40      public void setErrorText(final String errorText)
41      {
42          this.errorText = errorText;
43      }
44  
45      /**
46       * Sets the key of the ModuleDescriptor
47       *
48       * This is theoretically bad, as the superclass and the interface doesn't define this method,
49       * but it's required to construct an UnloadableModuleDescriptor when we don't have the XML Element.
50       *
51       * @param key the key of the ModuleDescriptor
52       */
53      public void setKey(final String key)
54      {
55          this.key = key;
56      }
57  
58      /**
59       * Sets the name of the ModuleDescriptor
60       *
61       * This is theoretically bad, as the superclass and the interface doesn't define this method,
62       * but it's required to construct an UnloadableModuleDescriptor when we don't have the XML Element.
63       *
64       * @param name the name of the ModuleDescriptor
65       */
66      public void setName(final String name)
67      {
68          this.name = name;
69      }
70  }