com.atlassian.plugin.impl
Class AbstractPlugin

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

public abstract class AbstractPlugin
extends java.lang.Object
implements Plugin, java.lang.Comparable<Plugin>


Field Summary
 
Fields inherited from interface com.atlassian.plugin.Plugin
NAME_COMPARATOR
 
Constructor Summary
AbstractPlugin()
           
 
Method Summary
 void addModuleDescriptor(ModuleDescriptor<?> moduleDescriptor)
           
 int compareTo(Plugin otherPlugin)
          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<ModuleDescriptor<?>> getModuleDescriptors()
          Returns a copy of the module descriptors for this plugin
<T> java.util.List<ModuleDescriptor<T>>
getModuleDescriptorsByModuleClass(java.lang.Class<T> aClass)
           
 java.lang.String getName()
           
 PluginInformation getPluginInformation()
           
 int getPluginsVersion()
          Gets the version of the plugins system to handle this 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 isEnabled()
           
 boolean isEnabledByDefault()
           
 boolean isSystemPlugin()
          Whether the plugin is a "system" plugin that shouldn't be made visible to the user
protected  void removeModuleDescriptor(java.lang.String key)
           
 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 setPluginsVersion(int pluginsVersion)
          Sets the version of the plugins system
 void setResources(Resourced resources)
           
 void setSystemPlugin(boolean system)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.plugin.Plugin
close, getClassLoader, getResource, getResourceAsStream, isBundledPlugin, isDeleteable, isDynamicallyLoaded, isUninstallable, loadClass
 

Constructor Detail

AbstractPlugin

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

removeModuleDescriptor

protected void removeModuleDescriptor(java.lang.String key)

getModuleDescriptors

public java.util.Collection<ModuleDescriptor<?>> getModuleDescriptors()
Returns a copy of the module descriptors for this plugin

Specified by:
getModuleDescriptors in interface Plugin
Returns:
A copy of the internal list

getModuleDescriptor

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

getModuleDescriptorsByModuleClass

public <T> java.util.List<ModuleDescriptor<T>> getModuleDescriptorsByModuleClass(java.lang.Class<T> 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

getPluginsVersion

public int getPluginsVersion()
Description copied from interface: Plugin
Gets the version of the plugins system to handle this plugin

Specified by:
getPluginsVersion in interface Plugin
Returns:
The plugins version. If undefined, assumed to be 1.

setPluginsVersion

public void setPluginsVersion(int pluginsVersion)
Description copied from interface: Plugin
Sets the version of the plugins system

Specified by:
setPluginsVersion in interface Plugin
Parameters:
pluginsVersion - The version

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

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

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(Plugin otherPlugin)
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<Plugin>
Returns:
-1 if the other plugin is newer, 0 if equal, 1 if the other plugin is older or has a different plugin key.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.