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
12  {
13      private String errorText;
14  
15      public Object getModule()
16      {
17          return null;
18      }
19  
20      protected void loadClass(Plugin plugin, Element element) throws PluginParseException {
21          // don't try to load the class -- we are possibly here because it doesn't exist
22      }
23  
24      public boolean isEnabledByDefault()
25      {
26          // An Unloadable module is never enabled
27          return false;
28      }
29  
30      public String getErrorText()
31      {
32          return errorText;
33      }
34  
35      public void setErrorText(String errorText)
36      {
37          this.errorText = errorText;
38      }
39  
40      /**
41       * Sets the key of the ModuleDescriptor
42       *
43       * This is theoretically bad, as the superclass and the interface doesn't define this method,
44       * but it's required to construct an UnloadableModuleDescriptor when we don't have the XML Element.
45       *
46       * @param key the key of the ModuleDescriptor
47       */
48      public void setKey(String key)
49      {
50          this.key = key;
51      }
52  
53      /**
54       * Sets the name of the ModuleDescriptor
55       *
56       * This is theoretically bad, as the superclass and the interface doesn't define this method,
57       * but it's required to construct an UnloadableModuleDescriptor when we don't have the XML Element.
58       *
59       * @param name the name of the ModuleDescriptor
60       */
61      public void setName(String name)
62      {
63          this.name = name;
64      }
65  }