public class

DefaultDynamicPlugin

extends AbstractPlugin
implements PluginArtifactBackedPlugin
java.lang.Object
   ↳ com.atlassian.plugin.impl.AbstractPlugin
     ↳ com.atlassian.plugin.impl.DefaultDynamicPlugin

Class Overview

A dynamically loaded plugin is loaded through the plugin class loader.

Summary

[Expand]
Inherited Fields
From interface com.atlassian.plugin.Plugin
Public Constructors
DefaultDynamicPlugin(DeploymentUnit deploymentUnit, PluginClassLoader loader)
DefaultDynamicPlugin(PluginArtifact pluginArtifact, PluginClassLoader loader)
Public Methods
ClassLoader getClassLoader()
Get the classloader for the plugin.
DeploymentUnit getDeploymentUnit()
This method is deprecated. Since 2.2.0, use getPluginArtifact() instead
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 isBundledPlugin()
Whether the plugin is a "bundled" plugin that can't be removed.
boolean isDeleteable()
Should the plugin file be deleted on unistall?
boolean isDynamicallyLoaded()
This plugin is dynamically loaded, so returns true.
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 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 DefaultDynamicPlugin (DeploymentUnit deploymentUnit, PluginClassLoader loader)

public DefaultDynamicPlugin (PluginArtifact pluginArtifact, PluginClassLoader loader)

Public Methods

public ClassLoader getClassLoader ()

Get the classloader for the plugin.

Returns
  • The classloader used to load classes for this plugin

public DeploymentUnit getDeploymentUnit ()

This method is deprecated.
Since 2.2.0, use getPluginArtifact() instead

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 isBundledPlugin ()

Whether the plugin is a "bundled" plugin that can't be removed.

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

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 ()

This plugin is dynamically loaded, so returns true.

Returns
  • true

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 uninstallInternal ()

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