View Javadoc

1   package com.atlassian.plugin.descriptors;
2   
3   import com.atlassian.plugin.Plugin;
4   import com.atlassian.plugin.PluginParseException;
5   import com.atlassian.plugin.Resources;
6   import com.atlassian.plugin.elements.ResourceDescriptor;
7   import org.dom4j.Element;
8   
9   import java.util.Collections;
10  
11  public class UnrecognisedModuleDescriptor extends AbstractModuleDescriptor
12  {
13      private String errorText;
14  
15      public Object getModule()
16      {
17          return null;
18      }
19  
20      public void init(Plugin plugin, Element element) throws PluginParseException
21      {
22          this.key = element.attributeValue("key");
23          this.name = element.attributeValue("name");
24          this.description = element.elementTextTrim("description");
25  
26          this.plugin = plugin;
27          this.resources = new Resources(Collections.<ResourceDescriptor>emptyList());
28      }
29  
30      public boolean isEnabledByDefault()
31      {
32          //never enable a UnrecognisedModuleDescriptor
33          return false;
34      }
35  
36      public String getErrorText()
37      {
38          return errorText;
39      }
40  
41      public void setErrorText(String errorText)
42      {
43          this.errorText = errorText;
44      }
45  
46      /**
47       * Sets the key of the ModuleDescriptor
48       *
49       * This is theoretically bad, as the superclass and the interface doesn't define this method,
50       * but it's required to construct an UnrecognisedModuleDescriptor when we don't have the XML Element.
51       *
52       * @param key the key of the ModuleDescriptor
53       */
54      public void setKey(String key)
55      {
56          this.key = key;
57      }
58  
59      /**
60       * Sets the name of the ModuleDescriptor
61       *
62       * This is theoretically bad, as the superclass and the interface doesn't define this method,
63       * but it's required to construct an UnrecognisedModuleDescriptor when we don't have the XML Element.
64       *
65       * @param name the name of the ModuleDescriptor
66       */
67      public void setName(String name)
68      {
69          this.name = name;
70      }
71  }