com.atlassian.plugin.impl
Class DefaultDynamicPlugin

java.lang.Object
  extended by com.atlassian.plugin.impl.AbstractPlugin
      extended by com.atlassian.plugin.impl.DefaultDynamicPlugin
All Implemented Interfaces:
Plugin, Resourced, java.lang.Comparable<Plugin>

public class DefaultDynamicPlugin
extends AbstractPlugin

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


Field Summary
 
Fields inherited from interface com.atlassian.plugin.Plugin
NAME_COMPARATOR
 
Constructor Summary
DefaultDynamicPlugin(DeploymentUnit deploymentUnit, PluginClassLoader loader)
           
DefaultDynamicPlugin(PluginArtifact pluginArtifact, PluginClassLoader loader)
           
 
Method Summary
 java.lang.ClassLoader getClassLoader()
          Get the classloader for the plugin.
 DeploymentUnit getDeploymentUnit()
          Deprecated. Since 2.2.0, use getPluginArtifact() instead
 PluginArtifact getPluginArtifact()
           
 java.net.URL getResource(java.lang.String name)
          Retrieve the URL of the resource from the plugin.
 java.io.InputStream getResourceAsStream(java.lang.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> java.lang.Class<T>
loadClass(java.lang.String clazz, java.lang.Class<?> callingClass)
          Get the plugin to load a specific class.
protected  void uninstallInternal()
          Perform any internal uninstallation logic.
 
Methods inherited from class com.atlassian.plugin.impl.AbstractPlugin
addModuleDescriptor, close, compareAndSetPluginState, compareTo, containsSystemModule, disable, disableInternal, enable, enableInternal, getDateLoaded, getI18nNameKey, getKey, getLog, getModuleDescriptor, getModuleDescriptors, getModuleDescriptorsByModuleClass, getName, getPluginInformation, getPluginState, getPluginsVersion, getRequiredPlugins, getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation, install, installInternal, isEnabled, isEnabledByDefault, isSystemPlugin, removeModuleDescriptor, setEnabled, setEnabledByDefault, setI18nNameKey, setKey, setName, setPluginInformation, setPluginState, setPluginsVersion, setResources, setSystemPlugin, toString, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultDynamicPlugin

public DefaultDynamicPlugin(DeploymentUnit deploymentUnit,
                            PluginClassLoader loader)

DefaultDynamicPlugin

public DefaultDynamicPlugin(PluginArtifact pluginArtifact,
                            PluginClassLoader loader)
Method Detail

loadClass

public <T> java.lang.Class<T> loadClass(java.lang.String clazz,
                                        java.lang.Class<?> callingClass)
                             throws java.lang.ClassNotFoundException
Description copied from interface: Plugin
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.
Throws:
java.lang.ClassNotFoundException - if the class cannot be located.

isUninstallable

public boolean isUninstallable()
Description copied from interface: Plugin
Whether or not this plugin can be 'uninstalled'.

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

getResource

public java.net.URL getResource(java.lang.String name)
Description copied from interface: Plugin
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

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String name)
Description copied from interface: Plugin
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.

getClassLoader

public java.lang.ClassLoader getClassLoader()
Description copied from interface: Plugin
Get the classloader for the plugin.

Returns:
The classloader used to load classes for this plugin

isDynamicallyLoaded

public boolean isDynamicallyLoaded()
This plugin is dynamically loaded, so returns true.

Returns:
true

getDeploymentUnit

public DeploymentUnit getDeploymentUnit()
Deprecated. Since 2.2.0, use getPluginArtifact() instead


getPluginArtifact

public PluginArtifact getPluginArtifact()
Since:
2.2.0

isDeleteable

public boolean isDeleteable()
Description copied from interface: Plugin
Should the plugin file be deleted on unistall?

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

isBundledPlugin

public boolean isBundledPlugin()
Description copied from interface: Plugin
Whether the plugin is a "bundled" plugin that can't be removed.

Specified by:
isBundledPlugin in interface Plugin
Overrides:
isBundledPlugin in class AbstractPlugin
Returns:
true if this plugin is a "bundled" plugin.

uninstallInternal

protected void uninstallInternal()
Description copied from class: AbstractPlugin
Perform any internal uninstallation logic. Subclasses should only throw PluginException.

Overrides:
uninstallInternal in class AbstractPlugin


Copyright © 2010 Atlassian. All Rights Reserved.