|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.atlassian.plugin.impl.AbstractPlugin
public abstract class AbstractPlugin
Field Summary |
---|
Fields inherited from interface com.atlassian.plugin.Plugin |
---|
NAME_COMPARATOR |
Constructor Summary | |
---|---|
AbstractPlugin()
|
Method Summary | ||
---|---|---|
void |
addModuleDescriptor(ModuleDescriptor<?> moduleDescriptor)
|
|
void |
close()
Free any resources held by this plugin. |
|
protected boolean |
compareAndSetPluginState(PluginState requiredExistingState,
PluginState desiredState)
Only sets the plugin state if it is in the expected state. |
|
int |
compareTo(Plugin otherPlugin)
Compares this Plugin to another Plugin for order. |
|
boolean |
containsSystemModule()
|
|
void |
disable()
Disables the plugin. |
|
protected void |
disableInternal()
Perform any internal disabling logic. |
|
void |
enable()
Enables the plugin. |
|
protected PluginState |
enableInternal()
Perform any internal enabling logic. |
|
java.util.Date |
getDateLoaded()
The date this plugin was loaded into the system. |
|
java.lang.String |
getI18nNameKey()
Returns the i18nKey used to get an internationalised name for this plugin. |
|
java.lang.String |
getKey()
|
|
protected org.slf4j.Logger |
getLog()
|
|
ModuleDescriptor<?> |
getModuleDescriptor(java.lang.String key)
Get the ModuleDescriptor for a particular key. |
|
java.util.Collection<ModuleDescriptor<?>> |
getModuleDescriptors()
Returns the module descriptors for this plugin |
|
|
getModuleDescriptorsByModuleClass(java.lang.Class<T> aClass)
Get the descriptors whose module class implements or is assignable from the supplied Class . |
|
java.lang.String |
getName()
Returns the non-localised name of this plugin if defined. |
|
PluginInformation |
getPluginInformation()
|
|
PluginState |
getPluginState()
Returns this plugin's current state. |
|
int |
getPluginsVersion()
Gets the version of the plugins system to handle this plugin |
|
java.util.Set<java.lang.String> |
getRequiredPlugins()
|
|
ResourceDescriptor |
getResourceDescriptor(java.lang.String type,
java.lang.String name)
Deprecated. |
|
java.util.List<ResourceDescriptor> |
getResourceDescriptors()
Get a List of all the descriptors
. |
|
java.util.List<ResourceDescriptor> |
getResourceDescriptors(java.lang.String type)
Get a list of all descriptors of a particular
type. |
|
ResourceLocation |
getResourceLocation(java.lang.String type,
java.lang.String name)
Get a ResourceLocation of a particular type and name. |
|
void |
install()
Installs the plugin into any internal, managing container. |
|
protected void |
installInternal()
Perform any internal installation logic. |
|
boolean |
isBundledPlugin()
Whether the plugin is a "bundled" plugin that can't be removed. |
|
boolean |
isEnabled()
Deprecated. |
|
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)
Deprecated. |
|
void |
setEnabledByDefault(boolean enabledByDefault)
|
|
void |
setI18nNameKey(java.lang.String i18nNameKey)
Sets the i18nKey used to get an internationalised name for this plugin. |
|
void |
setKey(java.lang.String aPackage)
|
|
void |
setName(java.lang.String name)
Sets the non-localised name of this plugin. |
|
void |
setPluginInformation(PluginInformation pluginInformation)
|
|
protected void |
setPluginState(PluginState state)
|
|
void |
setPluginsVersion(int pluginsVersion)
Sets the version of the plugins system |
|
void |
setResources(Resourced resources)
|
|
void |
setSystemPlugin(boolean system)
|
|
java.lang.String |
toString()
|
|
void |
uninstall()
Uninstalls the plugin from any internal container. |
|
protected void |
uninstallInternal()
Perform any internal uninstallation logic. |
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 |
---|
getClassLoader, getResource, getResourceAsStream, isDeleteable, isDynamicallyLoaded, isUninstallable, loadClass |
Constructor Detail |
---|
public AbstractPlugin()
Method Detail |
---|
public java.lang.String getName()
Plugin
This corresponds to the value of the name
field in the plugin's XML configuration file.
You would expect a plugin developer to fill in one of either name
, or i18n-name-key
,
but the framework does no validation and makes no guarantees that this is the case.
getName
in interface Plugin
Plugin.getI18nNameKey()
public void setName(java.lang.String name)
Plugin
setName
in interface Plugin
name
- the name.Plugin.getName()
protected org.slf4j.Logger getLog()
public java.lang.String getI18nNameKey()
Plugin
This corresponds to the value of the i18n-name-key
field in the plugin's XML configuration file.
You would expect a plugin developer to fill in one of either name
, or i18n-name-key
,
but the framework does no validation and makes no guarantees that this is the case.
getI18nNameKey
in interface Plugin
Plugin.getName()
public void setI18nNameKey(java.lang.String i18nNameKey)
Plugin
setI18nNameKey
in interface Plugin
i18nNameKey
- the i18n Name Key.Plugin.getI18nNameKey()
public java.lang.String getKey()
getKey
in interface Plugin
public void setKey(java.lang.String aPackage)
setKey
in interface Plugin
public void addModuleDescriptor(ModuleDescriptor<?> moduleDescriptor)
addModuleDescriptor
in interface Plugin
protected void removeModuleDescriptor(java.lang.String key)
public java.util.Collection<ModuleDescriptor<?>> getModuleDescriptors()
getModuleDescriptors
in interface Plugin
public ModuleDescriptor<?> getModuleDescriptor(java.lang.String key)
Plugin
ModuleDescriptor
for a particular key. Returns null if the plugin does not exist.
Note: The ModuleDescriptor.getModule()
may throw ClassCastException
if the expected type is incorrect.
getModuleDescriptor
in interface Plugin
key
- the String
complete key of the module, in the form "org.example.plugin:module-key".
ModuleDescriptor
of the expected type.public <T> java.util.List<ModuleDescriptor<T>> getModuleDescriptorsByModuleClass(java.lang.Class<T> aClass)
Plugin
descriptors
whose module class implements or is assignable from the supplied Class
.
Note: The ModuleDescriptor.getModule()
may throw ClassCastException
if the expected type is incorrect.
Normally this method would not be supplied with anything other than Object
or <?>, unless you are
confident in the super type of the module classes this Plugin
provides.
getModuleDescriptorsByModuleClass
in interface Plugin
T
- The expected module type of the returned descriptors
.aClass
- the super class
the descriptors
return.
List
of descriptors
of the expected type.public PluginState getPluginState()
Plugin
getPluginState
in interface Plugin
protected void setPluginState(PluginState state)
protected boolean compareAndSetPluginState(PluginState requiredExistingState, PluginState desiredState)
requiredExistingState
- The expected statedesiredState
- The desired state
public boolean isEnabledByDefault()
isEnabledByDefault
in interface Plugin
public void setEnabledByDefault(boolean enabledByDefault)
setEnabledByDefault
in interface Plugin
public int getPluginsVersion()
Plugin
getPluginsVersion
in interface Plugin
public void setPluginsVersion(int pluginsVersion)
Plugin
setPluginsVersion
in interface Plugin
pluginsVersion
- The versionpublic PluginInformation getPluginInformation()
getPluginInformation
in interface Plugin
public void setPluginInformation(PluginInformation pluginInformation)
setPluginInformation
in interface Plugin
public void setResources(Resourced resources)
setResources
in interface Plugin
public java.util.List<ResourceDescriptor> getResourceDescriptors()
Resourced
List
of all the descriptors
.
Note: since 2.2 this list must be immutable, previously modifying this list could modify the underlying list.
getResourceDescriptors
in interface Resourced
public java.util.List<ResourceDescriptor> getResourceDescriptors(java.lang.String type)
Resourced
descriptors
of a particular
type.
Note: since 2.2 this list must be immutable, previously this list was modifiable but modifications would not be reflected in the underlying list.
getResourceDescriptors
in interface Resourced
public ResourceLocation getResourceLocation(java.lang.String type, java.lang.String name)
Resourced
ResourceLocation
of a particular type and name.
getResourceLocation
in interface Resourced
@Deprecated public ResourceDescriptor getResourceDescriptor(java.lang.String type, java.lang.String name)
Resourced
ResourceDescriptor
of a particular type and name.
getResourceDescriptor
in interface Resourced
@Deprecated public boolean isEnabled()
isEnabled
in interface Plugin
public final void enable()
Plugin
PluginState.ENABLING
or PluginState.ENABLED
state. If the plugin is already in the
PluginState.ENABLING
or PluginState.ENABLED
state, nothing will happen.
enable
in interface Plugin
protected PluginState enableInternal() throws PluginException
PluginException
.
PluginState.ENABLED
or
PluginState.ENABLING
PluginException
- If the plugin could not be enabledpublic final void disable()
Plugin
PluginState.DISABLED
state. If the plugin is already in the PluginState.DISABLED
state, nothing will happen.
disable
in interface Plugin
protected void disableInternal() throws PluginException
PluginException
.
PluginException
- If the plugin could not be disabledpublic java.util.Set<java.lang.String> getRequiredPlugins()
getRequiredPlugins
in interface Plugin
public void close()
Plugin
Plugin
.
close
in interface Plugin
public final void install()
Plugin
PluginState.INSTALLED
state. If the plugin is already
in the PluginState.INSTALLED
state, nothing will happen.
install
in interface Plugin
protected void installInternal() throws PluginException
PluginException
.
PluginException
- If the plugin could not be installedpublic final void uninstall()
Plugin
PluginState.UNINSTALLED
state. If the plugin is already
in the PluginState.UNINSTALLED
state, nothing will happen.
uninstall
in interface Plugin
protected void uninstallInternal() throws PluginException
PluginException
.
PluginException
- If the plugin could not be uninstalled@Deprecated public void setEnabled(boolean enabled)
setEnabled
in interface Plugin
enabled
- new enabled statepublic boolean isSystemPlugin()
Plugin
isSystemPlugin
in interface Plugin
true
if this plugin is a "system" plugin.public boolean containsSystemModule()
containsSystemModule
in interface Plugin
public void setSystemPlugin(boolean system)
setSystemPlugin
in interface Plugin
system
- whether the plugin is a "system" plugin that shouldn't be made visible to the user.public java.util.Date getDateLoaded()
Plugin
getDateLoaded
in interface Plugin
public boolean isBundledPlugin()
Plugin
isBundledPlugin
in interface Plugin
true
if this plugin is a "bundled" plugin.public int compareTo(Plugin otherPlugin)
compareTo
in interface java.lang.Comparable<Plugin>
otherPlugin
- The plugin to be compared.
VersionStringComparator
,
Comparable.compareTo(T)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |