View Javadoc

1   package com.atlassian.plugin;
2   
3   import org.dom4j.Element;
4   
5   import java.util.Map;
6   
7   public interface ModuleDescriptor<T> extends Resourced
8   {
9       /**
10       * The complete key for this module, including the plugin key.
11       * <p>
12       * Format is plugin.key:module.key
13       * </p>
14       */
15      String getCompleteKey();
16  
17      /**
18       * The plugin key for this module, derived from the complete key
19       */
20      String getPluginKey();
21  
22      /**
23       * The key for this module, unique within the plugin.
24       */
25      String getKey();
26  
27      /**
28       * A simple string name for this descriptor.
29       */
30      String getName();
31  
32      /**
33       * A simple description of this descriptor.
34       */
35      String getDescription();
36  
37      /**
38       * The class of the module this descriptor creates.
39       */
40      Class<T> getModuleClass();
41  
42      /**
43       * The particular module object created by this plugin.
44       */
45      T getModule();
46  
47      /**
48       * Initialise a module given it's parent plugin and the XML element representing the module.
49       */
50      void init(Plugin plugin, Element element) throws PluginParseException;
51  
52      /**
53       * Whether or not this plugin module is enabled by default.
54       * @return
55       */
56      boolean isEnabledByDefault();
57  
58      /**
59       * Whether or not this plugin module is a "system" plugin that shouldn't be made visible/disableable to the user
60       * @return
61       */
62      boolean isSystemModule();
63  
64      /**
65       * Override this if your plugin needs to clean up when it's been removed.
66       * @param plugin
67       */
68      void destroy(Plugin plugin);
69  
70      Float getMinJavaVersion();
71  
72      /**
73       * If a min java version has been specified this will return true if the running jvm
74       * is >= to the specified version. If this is not set then it is treated as not having
75       * a preference.
76       * @return true if satisfied, false otherwise.
77       */
78      boolean satisfiesMinJavaVersion();
79  
80      Map<String, String> getParams();
81  
82      /**
83       * Key used to override {@link #getName()} when using internationalisation.
84       *
85       * @return the i18n key.  May be null.
86       */
87      String getI18nNameKey();
88  
89      /**
90       * Key used to override {@link #getDescription()} when using internationalisation.
91       *
92       * @return the i18n key.  May be null.
93       */
94      String getDescriptionKey();
95  
96      /**
97       * @return The plugin this module descriptor is associated with
98       */
99      Plugin getPlugin();
100 }