View Javadoc

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