com.atlassian.plugin.impl
Class DynamicPlugin

java.lang.Object
  extended by com.atlassian.plugin.impl.StaticPlugin
      extended by com.atlassian.plugin.impl.DynamicPlugin
All Implemented Interfaces:
Plugin, Resourced, java.lang.Comparable

public class DynamicPlugin
extends StaticPlugin


Field Summary
 
Fields inherited from interface com.atlassian.plugin.Plugin
NAME_COMPARATOR
 
Constructor Summary
DynamicPlugin(DeploymentUnit deploymentUnit, PluginsClassLoader loader)
           
 
Method Summary
 void close()
          Free any resources held by this plugin.
 java.lang.ClassLoader getClassLoader()
           
 DeploymentUnit getDeploymentUnit()
           
 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()
          Static plugins loaded from the classpath can't be uninstalled.
 java.lang.Class loadClass(java.lang.String clazz, java.lang.Class callingClass)
          Get the plugin to load a specific class.
 void setBundled(boolean bundled)
           
 void setDeletable(boolean deletable)
           
 
Methods inherited from class com.atlassian.plugin.impl.StaticPlugin
addModuleDescriptor, compareTo, containsSystemModule, getDateLoaded, getI18nNameKey, getKey, getModuleDescriptor, getModuleDescriptors, getModuleDescriptorsByModuleClass, getName, getPluginInformation, getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation, isEnabled, isEnabledByDefault, isSystemPlugin, setEnabled, setEnabledByDefault, setI18nNameKey, setKey, setName, setPluginInformation, setResources, setSystemPlugin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicPlugin

public DynamicPlugin(DeploymentUnit deploymentUnit,
                     PluginsClassLoader loader)
Method Detail

loadClass

public java.lang.Class 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.

Specified by:
loadClass in interface Plugin
Overrides:
loadClass in class StaticPlugin
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

isUninstallable

public boolean isUninstallable()
Description copied from class: StaticPlugin
Static plugins loaded from the classpath can't be uninstalled.

Specified by:
isUninstallable in interface Plugin
Overrides:
isUninstallable in class StaticPlugin

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.

Specified by:
getResourceAsStream in interface Plugin
Overrides:
getResourceAsStream in class StaticPlugin
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()

isDynamicallyLoaded

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

Specified by:
isDynamicallyLoaded in interface Plugin
Overrides:
isDynamicallyLoaded in class StaticPlugin
Returns:
true

getDeploymentUnit

public DeploymentUnit getDeploymentUnit()

isDeleteable

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

Specified by:
isDeleteable in interface Plugin
Overrides:
isDeleteable in class StaticPlugin

setDeletable

public void setDeletable(boolean deletable)

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 StaticPlugin

setBundled

public void setBundled(boolean bundled)

close

public void close()
Description copied from interface: Plugin
Free any resources held by this plugin. To be called during uninstallation of the Plugin.

Specified by:
close in interface Plugin
Overrides:
close in class StaticPlugin


Copyright © 2008 Atlassian Software Systems Pty Ltd. All Rights Reserved.