public class

OsgiBundlePlugin

extends AbstractPlugin
implements PluginArtifactBackedPlugin
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, PluginArtifact pluginArtifact, PluginEventManager pluginEventManager)
Public Methods
ClassLoader getClassLoader()
Get the classloader for the plugin.
Date getDateLoaded()
The date this plugin was loaded into the system.
PluginArtifact getPluginArtifact()
URL getResource(String name)
Retrieve the URL of the resource from the plugin.
InputStream getResourceAsStream(String name)
Load a given resource from the plugin.
boolean isDeleteable()
Should the plugin file be deleted on unistall?
boolean isDynamicallyLoaded()
Whether or not this plugin is loaded dynamically at runtime.
boolean isUninstallable()
Whether or not this plugin can be 'uninstalled'.
<T> Class<T> loadClass(String clazz, Class<?> callingClass)
Get the plugin to load a specific class.
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.PluginArtifactBackedPlugin
From interface com.atlassian.plugin.Resourced
From interface java.lang.Comparable

Public Constructors

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

Public Methods

public ClassLoader getClassLoader ()

Get the classloader for the plugin.

Returns
  • The classloader used to load classes for this plugin

public Date getDateLoaded ()

The date this plugin was loaded into the system.

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

public PluginArtifact getPluginArtifact ()

public URL getResource (String name)

Retrieve the URL of the resource from the plugin.

Parameters
name the name of the resource to be loaded
Returns
  • The URL to the resource, or null if the resource is not found

public InputStream getResourceAsStream (String name)

Load a given resource from the plugin. Plugins that are loaded dynamically will need to implement this in a way that loads the resource from the same context as the plugin. Static plugins can just pull them from their own classloader.

Parameters
name The name of the resource to be loaded.
Returns
  • An InputStream for the resource, or null if the resource is not found.

public boolean isDeleteable ()

Should the plugin file be deleted on unistall?

Returns
  • true if this plugin file should be deleted on unistall.

public boolean isDynamicallyLoaded ()

Whether or not this plugin is loaded dynamically at runtime.

Returns
  • true if this plugin is loaded dynamically at runtime.

public boolean isUninstallable ()

Whether or not this plugin can be 'uninstalled'.

Returns
  • true if this plugin can be 'uninstalled'.

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

Get the plugin to load a specific class.

Parameters
clazz The name of the class to be loaded
callingClass The class calling the loading (used to help find a classloader)
Returns
  • The loaded class.

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.