public class

OsgiBundlePlugin

extends AbstractPlugin
java.lang.Object
   ↳ com.atlassian.plugin.impl.AbstractPlugin
     ↳ com.atlassian.plugin.osgi.factory.OsgiBundlePlugin

Class Overview

Plugin that wraps an OSGi bundle that has no plugin descriptor.

Summary

[Expand]
Inherited Fields
From interface com.atlassian.plugin.Plugin
Public Constructors
OsgiBundlePlugin(Bundle bundle, String key, PluginEventManager pluginEventManager)
Public Methods
void addModuleDescriptor(ModuleDescriptor<?> moduleDescriptor)
boolean containsSystemModule()
ClassLoader getClassLoader()
Date getDateLoaded()
The date this plugin was loaded into the system.
String getKey()
ModuleDescriptor<?> getModuleDescriptor(String key)
Get the ModuleDescriptor for a particular key.
Collection<ModuleDescriptor<?>> getModuleDescriptors()
Returns the module descriptors for this plugin
<M> List<ModuleDescriptor<M>> getModuleDescriptorsByModuleClass(Class<M> aClass)
String getName()
Returns the non-localised name of this plugin if defined.
PluginInformation getPluginInformation()
int getPluginsVersion()
Gets the version of the plugins system to handle this plugin
URL getResource(String name)
InputStream getResourceAsStream(String name)
ResourceDescriptor getResourceDescriptor(String type, String name)
This method is deprecated. No replacement.
List<ResourceDescriptor> getResourceDescriptors()
Get a List of all the descriptors .
List<ResourceDescriptor> getResourceDescriptors(String type)
Get a list of all descriptors of a particular type.
ResourceLocation getResourceLocation(String type, String name)
Get a ResourceLocation of a particular type and name.
boolean isDeleteable()
boolean isDynamicallyLoaded()
boolean isEnabledByDefault()
boolean isSystemPlugin()
Whether the plugin is a "system" plugin that shouldn't be made visible to the user.
boolean isUninstallable()
<T> Class<T> loadClass(String clazz, Class<?> callingClass)
void setEnabledByDefault(boolean enabledByDefault)
void setI18nNameKey(String i18nNameKey)
Sets the i18nKey used to get an internationalised name for this plugin.
void setKey(String aPackage)
void setName(String name)
Sets the non-localised name of this plugin.
void setPluginInformation(PluginInformation pluginInformation)
void setPluginsVersion(int version)
Sets the version of the plugins system
void setResources(Resourced resources)
void setSystemPlugin(boolean system)
Protected Methods
void disableInternal()
Perform any internal disabling logic.
PluginState enableInternal()
Perform any internal enabling logic.
void uninstallInternal()
Perform any internal uninstallation logic.
[Expand]
Inherited Methods
From class com.atlassian.plugin.impl.AbstractPlugin
From class java.lang.Object
From interface com.atlassian.plugin.Plugin
From interface com.atlassian.plugin.Resourced
From interface java.lang.Comparable

Public Constructors

public OsgiBundlePlugin (Bundle bundle, String key, PluginEventManager pluginEventManager)

Public Methods

public void addModuleDescriptor (ModuleDescriptor<?> moduleDescriptor)

public boolean containsSystemModule ()

public ClassLoader getClassLoader ()

public Date getDateLoaded ()

The date this plugin was loaded into the system.

Returns
  • The date this plugin was loaded into the system.

public String getKey ()

public ModuleDescriptor<?> getModuleDescriptor (String key)

Get the ModuleDescriptor for a particular key. Returns null if the plugin does not exist.

Note: The getModule() may throw ClassCastException if the expected type is incorrect.

Parameters
key the String complete key of the module, in the form "org.example.plugin:module-key".
Returns

public Collection<ModuleDescriptor<?>> getModuleDescriptors ()

Returns the module descriptors for this plugin

Returns
  • An unmodifiable list of the module descriptors.

public List<ModuleDescriptor<M>> getModuleDescriptorsByModuleClass (Class<M> aClass)

public String getName ()

Returns the non-localised name of this plugin if defined.

This corresponds to the value of the name field in the plugin's XML configuration file.

You would expect a plugin developer to fill in one of either name, or i18n-name-key, but the framework does no validation and makes no guarantees that this is the case.

Returns
  • the non-localised name of this plugin if defined, or null.

public PluginInformation getPluginInformation ()

public int getPluginsVersion ()

Gets the version of the plugins system to handle this plugin

Returns
  • The plugins version. If undefined, assumed to be 1.

public URL getResource (String name)

public InputStream getResourceAsStream (String name)

public ResourceDescriptor getResourceDescriptor (String type, String name)

This method is deprecated.
No replacement.

Get a ResourceDescriptor of a particular type and name.

Returns
  • the specified resource descriptor if found, null otherwise.

public List<ResourceDescriptor> getResourceDescriptors ()

Get a List of all the descriptors .

Note: since 2.2 this list must be immutable, previously modifying this list could modify the underlying list.

Returns
  • all resource descriptors this object supports.

public List<ResourceDescriptor> getResourceDescriptors (String type)

Get a list of all descriptors of a particular type.

Note: since 2.2 this list must be immutable, previously this list was modifiable but modifications would not be reflected in the underlying list.

Returns
  • all resource descriptors this object supports.

public ResourceLocation getResourceLocation (String type, String name)

Get a ResourceLocation of a particular type and name.

Returns
  • the specified resource location if found, null otherwise.

public boolean isDeleteable ()

public boolean isDynamicallyLoaded ()

public boolean isEnabledByDefault ()

public boolean isSystemPlugin ()

Whether the plugin is a "system" plugin that shouldn't be made visible to the user.

Returns
  • true if this plugin is a "system" plugin.

public boolean isUninstallable ()

public Class<T> loadClass (String clazz, Class<?> callingClass)

public void setEnabledByDefault (boolean enabledByDefault)

public void setI18nNameKey (String i18nNameKey)

Sets the i18nKey used to get an internationalised name for this plugin.

Parameters
i18nNameKey the i18n Name Key.

public void setKey (String aPackage)

public void setName (String name)

Sets the non-localised name of this plugin.

Parameters
name the name.

public void setPluginInformation (PluginInformation pluginInformation)

public void setPluginsVersion (int version)

Sets the version of the plugins system

Parameters
version The version

public void setResources (Resourced resources)

public void setSystemPlugin (boolean system)

Protected Methods

protected void disableInternal ()

Perform any internal disabling logic. Subclasses should only throw PluginException.

protected PluginState enableInternal ()

Perform any internal enabling logic. Subclasses should only throw PluginException.

Returns

protected void uninstallInternal ()

Perform any internal uninstallation logic. Subclasses should only throw PluginException.