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 org.dom4j.Element;
7   
8   import java.util.Collections;
9   
10  public class UnrecognisedModuleDescriptor extends AbstractModuleDescriptor
11  {
12      private String errorText;
13  
14      public Object getModule()
15      {
16          return null;
17      }
18  
19      public void init(Plugin plugin, Element element) throws PluginParseException
20      {
21          this.key = element.attributeValue("key");
22          this.name = element.attributeValue("name");
23          this.description = element.elementTextTrim("description");
24  
25          this.plugin = plugin;
26          this.resources = new Resources(Collections.EMPTY_LIST);
27      }
28  
29      public boolean isEnabledByDefault()
30      {
31          //never enable a UnrecognisedModuleDescriptor
32          return false;
33      }
34  
35      public String getErrorText()
36      {
37          return errorText;
38      }
39  
40      public void setErrorText(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 UnrecognisedModuleDescriptor when we don't have the XML Element.
50       *
51       * @param key the key of the ModuleDescriptor
52       */
53      public void setKey(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 UnrecognisedModuleDescriptor when we don't have the XML Element.
63       *
64       * @param name the name of the ModuleDescriptor
65       */
66      public void setName(String name)
67      {
68          this.name = name;
69      }
70  }