Interface ModuleDescriptor<T>

All Superinterfaces:
Resourced, ScopeAware

public interface ModuleDescriptor<T> extends ScopeAware, Resourced
  • Method Details

    • getCompleteKey

      String getCompleteKey()
      The complete key for this module, including the plugin key.

      Format is plugin.key:module.key

      Returns:
      The complete key for this module.
      See Also:
    • getPluginKey

      String getPluginKey()
      The plugin key for this module, derived from the complete key.
      Returns:
      The plugin key for this module.
      See Also:
    • getKey

      String getKey()
      The key for this module, unique within the plugin.
      Returns:
      The key for this module.
      See Also:
    • getName

      String getName()
      A simple string name for this descriptor.
      Returns:
      The name for this ModuleDescriptor.
    • getDescription

      String getDescription()
      A simple description of this descriptor.
      Returns:
      The description for this ModuleDescriptor.
    • getModuleClass

      Class<T> getModuleClass()
      The class of the module this descriptor creates.
      Returns:
      The class of the module this descriptor creates.
      See Also:
    • getModule

      T getModule()
      The particular module object created by this plugin.
      Returns:
      The module object created by this plugin.
      See Also:
    • init

      void init(@Nonnull Plugin plugin, @Nonnull Element element)
      Initialise a module given its parent plugin and the XML element representing the module.

      Since atlassian-plugins v2.2, you can no longer load classes from the plugin in this method, because the OSGi bundle that they will live in is not built yet. Load classes in the StateAware.enabled() method instead.

      Parameters:
      plugin - The plugin that the module belongs to. Must not be null.
      element - Element representing the module. Must not be null.
      Throws:
      PluginParseException - Can be thrown if an error occurs while parsing the XML element.
    • isEnabledByDefault

      boolean isEnabledByDefault()
      Whether or not this plugin module is enabled by default.
      Returns:
      true if this plugin module is enabled by default.
    • isSystemModule

      boolean isSystemModule()
      Whether or not this plugin module is a "system" module that shouldn't be made visible/disable-able to the user. System plugin modules also don't have their permissions checked, as they may be created dynamically in response to another, more safe module
      Returns:
      true if this plugin module is a "system" plugin that shouldn't be made visible/disable-able to the user.
    • destroy

      void destroy()
      Override this if your plugin needs to clean up when it's been removed.
    • getMinJavaVersion

      Float getMinJavaVersion()
    • satisfiesMinJavaVersion

      boolean satisfiesMinJavaVersion()
      If a min java version has been specified this will return true if the running jvm is >= to the specified version. If this is not set then it is treated as not having a preference.
      Returns:
      true if satisfied, false otherwise.
    • getParams

      Map<String,String> getParams()
    • getI18nNameKey

      String getI18nNameKey()
      Key used to override getName() when using internationalisation.
      Returns:
      the i18n key. May be null.
    • getDescriptionKey

      String getDescriptionKey()
      Key used to override getDescription() when using internationalisation.
      Returns:
      the i18n key. May be null.
    • getPlugin

      Plugin getPlugin()
      Returns:
      The plugin this module descriptor is associated with
    • equals

      boolean equals(Object obj)
      Compares the specified object with this module descriptor for equality.

      Returns true if the given object is also a module descriptor and the two descriptors have the same "complete key" as determined by getCompleteKey().

      This ensures that the equals method works properly across different implementations of the ModuleDescriptor interface.

      Overrides:
      equals in class Object
      Parameters:
      obj - object to be compared for equality with this module descriptor.
      Returns:
      true if the specified object is equal to this module descriptor.
      Since:
      2.8.0
    • hashCode

      int hashCode()
      Returns the hash code value for this module descriptor. The hash code of a module descriptor d is defined to be:
           getCompleteKey() == null ? 0 : getCompleteKey().hashCode()
       
      This ensures that d1.equals(d2) implies that d1.hashCode()==d2.hashCode() for any two Module Descriptors d1 and d2, as required by the general contract of Object.hashCode.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code value for this module descriptor.
      Since:
      2.8.0
      See Also:
    • isEnabled

      boolean isEnabled()
      Get whether this plugin module is enabled.
      Returns:
      If this module is enabled
      Since:
      3.1
    • setBroken

      default void setBroken()
      Changes state to "broken"

      Being breakable is something subclasses can opt in to, therefore by default ModuleDescriptors are unbreakable, this is a no-op, and isBroken() returns false

    • isBroken

      default boolean isBroken()
      Returns true if this Module is "broken".

      A "broken" module means that even though this ModuleDescriptor is enabled, calling getModule() results in an error. This typically occurs when the plugin version is not compatible with the version of the host product.

      Note that some modules are lazy-loaded, and so this method is optimistic: it will return false until we discover that the Module is not loadable.

      Returns:
      true if broken, false otherwise
    • getDisplayName

      default String getDisplayName()
      Returns the display name of this descriptor, e.g. for use in log messages. Does not identify the owning plugin.
      Returns:
      a non-blank name
      Since:
      4.6.3