com.atlassian.plugin.impl
Class StaticPlugin

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

public class StaticPlugin
extends java.lang.Object
implements Plugin, java.lang.Comparable


Field Summary
 
Fields inherited from interface com.atlassian.plugin.Plugin
NAME_COMPARATOR
 
Constructor Summary
StaticPlugin()
           
 
Method Summary
 void addModuleDescriptor(ModuleDescriptor moduleDescriptor)
           
 void close()
          Free any resources held by this plugin.
 int compareTo(java.lang.Object other)
          Plugins with the same key are compared by version number, using VersionStringComparator.
 boolean containsSystemModule()
           
 java.util.Date getDateLoaded()
          The date this plugin was loaded into the system.
 java.lang.String getI18nNameKey()
           
 java.lang.String getKey()
           
 ModuleDescriptor getModuleDescriptor(java.lang.String key)
           
 java.util.Collection getModuleDescriptors()
           
 java.util.List getModuleDescriptorsByModuleClass(java.lang.Class aClass)
           
 java.lang.String getName()
           
 PluginInformation getPluginInformation()
           
 java.io.InputStream getResourceAsStream(java.lang.String name)
          Load a given resource from the plugin.
 ResourceDescriptor getResourceDescriptor(java.lang.String type, java.lang.String name)
          Deprecated.  
 java.util.List getResourceDescriptors()
           
 java.util.List getResourceDescriptors(java.lang.String type)
           
 ResourceLocation getResourceLocation(java.lang.String type, java.lang.String name)
           
 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()
          Whether or not this plugin is loaded dynamically at runtime
 boolean isEnabled()
           
 boolean isEnabledByDefault()
           
 boolean isSystemPlugin()
          Whether the plugin is a "system" plugin that shouldn't be made visible to the user
 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 setEnabled(boolean enabled)
          Setter for the enabled state of a plugin.
 void setEnabledByDefault(boolean enabledByDefault)
           
 void setI18nNameKey(java.lang.String i18nNameKey)
           
 void setKey(java.lang.String aPackage)
           
 void setName(java.lang.String name)
           
 void setPluginInformation(PluginInformation pluginInformation)
           
 void setResources(Resourced resources)
           
 void setSystemPlugin(boolean system)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticPlugin

public StaticPlugin()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Plugin

setName

public void setName(java.lang.String name)
Specified by:
setName in interface Plugin

getI18nNameKey

public java.lang.String getI18nNameKey()
Specified by:
getI18nNameKey in interface Plugin

setI18nNameKey

public void setI18nNameKey(java.lang.String i18nNameKey)
Specified by:
setI18nNameKey in interface Plugin

getKey

public java.lang.String getKey()
Specified by:
getKey in interface Plugin

setKey

public void setKey(java.lang.String aPackage)
Specified by:
setKey in interface Plugin

addModuleDescriptor

public void addModuleDescriptor(ModuleDescriptor moduleDescriptor)
Specified by:
addModuleDescriptor in interface Plugin

getModuleDescriptors

public java.util.Collection getModuleDescriptors()
Specified by:
getModuleDescriptors in interface Plugin

getModuleDescriptor

public ModuleDescriptor getModuleDescriptor(java.lang.String key)
Specified by:
getModuleDescriptor in interface Plugin

getModuleDescriptorsByModuleClass

public java.util.List getModuleDescriptorsByModuleClass(java.lang.Class aClass)
Specified by:
getModuleDescriptorsByModuleClass in interface Plugin

isEnabledByDefault

public boolean isEnabledByDefault()
Specified by:
isEnabledByDefault in interface Plugin

setEnabledByDefault

public void setEnabledByDefault(boolean enabledByDefault)
Specified by:
setEnabledByDefault in interface Plugin

getPluginInformation

public PluginInformation getPluginInformation()
Specified by:
getPluginInformation in interface Plugin

setPluginInformation

public void setPluginInformation(PluginInformation pluginInformation)
Specified by:
setPluginInformation in interface Plugin

setResources

public void setResources(Resourced resources)
Specified by:
setResources in interface Plugin

getResourceDescriptors

public java.util.List getResourceDescriptors()
Specified by:
getResourceDescriptors in interface Resourced

getResourceDescriptors

public java.util.List getResourceDescriptors(java.lang.String type)
Specified by:
getResourceDescriptors in interface Resourced

getResourceLocation

public ResourceLocation getResourceLocation(java.lang.String type,
                                            java.lang.String name)
Specified by:
getResourceLocation in interface Resourced

getResourceDescriptor

public ResourceDescriptor getResourceDescriptor(java.lang.String type,
                                                java.lang.String name)
Deprecated. 

Specified by:
getResourceDescriptor in interface Resourced

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface Plugin
Returns:
true if the plugin has been enabled

setEnabled

public void setEnabled(boolean enabled)
Setter for the enabled state of a plugin. If this is set to false then the plugin will not execute.

Specified by:
setEnabled in interface Plugin
Parameters:
enabled -

isUninstallable

public boolean isUninstallable()
Static plugins loaded from the classpath can't be uninstalled.

Specified by:
isUninstallable in interface Plugin

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

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
Parameters:
name - The name of the resource to be loaded.
Returns:
An InputStream for the resource, or null if the resource is not found.

isDynamicallyLoaded

public boolean isDynamicallyLoaded()
Description copied from interface: Plugin
Whether or not this plugin is loaded dynamically at runtime

Specified by:
isDynamicallyLoaded in interface Plugin

isSystemPlugin

public boolean isSystemPlugin()
Description copied from interface: Plugin
Whether the plugin is a "system" plugin that shouldn't be made visible to the user

Specified by:
isSystemPlugin in interface Plugin

containsSystemModule

public boolean containsSystemModule()
Specified by:
containsSystemModule in interface Plugin

setSystemPlugin

public void setSystemPlugin(boolean system)
Specified by:
setSystemPlugin in interface Plugin

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

getDateLoaded

public java.util.Date getDateLoaded()
Description copied from interface: Plugin
The date this plugin was loaded into the system.

Specified by:
getDateLoaded in interface Plugin

compareTo

public int compareTo(java.lang.Object other)
Plugins with the same key are compared by version number, using VersionStringComparator. If the other plugin has a different key, this method returns 1.

Specified by:
compareTo in interface java.lang.Comparable
Returns:
-1 if the other plugin is newer, 0 if equal, 1 if the other plugin is older or has a different plugin key.

isDeleteable

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

Specified by:
isDeleteable in interface Plugin

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


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