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 /**
49 * Initialise a module given it's parent plugin and the XML element representing the module.
50 */
51 void init(Plugin plugin, Element element) throws PluginParseException;
52
53 /**
54 * Whether or not this plugin module is enabled by default.
55 * @return
56 */
57 boolean isEnabledByDefault();
58
59 /**
60 * Whether or not this plugin module is a "system" plugin that shouldn't be made visible/disableable to the user
61 * @return
62 */
63 boolean isSystemModule();
64
65 /**
66 * Override this if your plugin needs to clean up when it's been removed.
67 * @param plugin
68 */
69 void destroy(Plugin plugin);
70
71 Float getMinJavaVersion();
72
73 /**
74 * If a min java version has been specified this will return true if the running jvm
75 * is >= to the specified version. If this is not set then it is treated as not having
76 * a preference.
77 * @return true if satisfied, false otherwise.
78 */
79 boolean satisfiesMinJavaVersion();
80
81 Map getParams();
82
83 /**
84 * Key used to override {@link #getName()} when using internationalisation.
85 *
86 * @return the i18n key. May be null.
87 */
88 String getI18nNameKey();
89
90 /**
91 * Key used to override {@link #getDescription()} when using internationalisation.
92 *
93 * @return the i18n key. May be null.
94 */
95 String getDescriptionKey();
96
97 /**
98 * @return The plugin this module descriptor is associated with
99 */
100 Plugin getPlugin();
101 }