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