|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.atlassian.plugin.impl.AbstractPlugin
com.atlassian.plugin.osgi.factory.OsgiBundlePlugin
public class OsgiBundlePlugin
Plugin that wraps an OSGi bundle that has no plugin descriptor.
Field Summary |
---|
Fields inherited from interface com.atlassian.plugin.Plugin |
---|
NAME_COMPARATOR |
Constructor Summary | |
---|---|
OsgiBundlePlugin(org.osgi.framework.Bundle bundle,
java.lang.String key,
PluginEventManager pluginEventManager)
|
Method Summary | ||
---|---|---|
void |
addModuleDescriptor(ModuleDescriptor<?> moduleDescriptor)
|
|
boolean |
containsSystemModule()
|
|
protected void |
disableInternal()
Perform any internal disabling logic. |
|
protected PluginState |
enableInternal()
Perform any internal enabling logic. |
|
java.lang.ClassLoader |
getClassLoader()
Get the classloader for the plugin. |
|
java.util.Date |
getDateLoaded()
The date this plugin was loaded into the system. |
|
java.lang.String |
getKey()
|
|
ModuleDescriptor<?> |
getModuleDescriptor(java.lang.String key)
Get the ModuleDescriptor for a particular key. |
|
java.util.Collection<ModuleDescriptor<?>> |
getModuleDescriptors()
Returns a copy of the module descriptors for this plugin |
|
|
getModuleDescriptorsByModuleClass(java.lang.Class<M> 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()
|
|
int |
getPluginsVersion()
Gets the version of the plugins system to handle this plugin |
|
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. |
|
ResourceDescriptor |
getResourceDescriptor(java.lang.String type,
java.lang.String name)
Get a ResourceDescriptor of a particular type and name. |
|
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. |
|
boolean |
isDeleteable()
Should the plugin file be deleted on unistall? |
|
boolean |
isDynamicallyLoaded()
Whether or not this plugin is loaded dynamically at runtime. |
|
boolean |
isEnabledByDefault()
|
|
boolean |
isSystemPlugin()
Whether the plugin is a "system" plugin that shouldn't be made visible to the user. |
|
boolean |
isUninstallable()
Whether or not this plugin can be 'uninstalled'. |
|
|
loadClass(java.lang.String clazz,
java.lang.Class<?> callingClass)
Get the plugin to load a specific class. |
|
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)
|
|
void |
setPluginsVersion(int version)
Sets the version of the plugins system |
|
void |
setResources(Resourced resources)
|
|
void |
setSystemPlugin(boolean system)
|
|
protected void |
uninstallInternal()
Perform any internal uninstallation logic. |
Methods inherited from class com.atlassian.plugin.impl.AbstractPlugin |
---|
close, compareTo, disable, enable, getI18nNameKey, getLog, getPluginState, getRequiredPlugins, install, installInternal, isBundledPlugin, isEnabled, removeModuleDescriptor, setEnabled, setPluginState, toString, uninstall |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OsgiBundlePlugin(org.osgi.framework.Bundle bundle, java.lang.String key, PluginEventManager pluginEventManager)
Method Detail |
---|
public int getPluginsVersion()
Plugin
getPluginsVersion
in interface Plugin
getPluginsVersion
in class AbstractPlugin
public void setPluginsVersion(int version)
Plugin
setPluginsVersion
in interface Plugin
setPluginsVersion
in class AbstractPlugin
version
- The versionpublic 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
getName
in class AbstractPlugin
Plugin.getI18nNameKey()
public void setName(java.lang.String name)
Plugin
setName
in interface Plugin
setName
in class AbstractPlugin
name
- the name.Plugin.getName()
public void setI18nNameKey(java.lang.String i18nNameKey)
Plugin
setI18nNameKey
in interface Plugin
setI18nNameKey
in class AbstractPlugin
i18nNameKey
- the i18n Name Key.Plugin.getI18nNameKey()
public java.lang.String getKey()
getKey
in interface Plugin
getKey
in class AbstractPlugin
public void setKey(java.lang.String aPackage)
setKey
in interface Plugin
setKey
in class AbstractPlugin
public void addModuleDescriptor(ModuleDescriptor<?> moduleDescriptor)
addModuleDescriptor
in interface Plugin
addModuleDescriptor
in class AbstractPlugin
public java.util.Collection<ModuleDescriptor<?>> getModuleDescriptors()
AbstractPlugin
getModuleDescriptors
in interface Plugin
getModuleDescriptors
in class AbstractPlugin
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
getModuleDescriptor
in class AbstractPlugin
key
- the String
complete key of the module, in the form "org.example.plugin:module-key".
ModuleDescriptor
of the expected type.public <M> java.util.List<ModuleDescriptor<M>> getModuleDescriptorsByModuleClass(java.lang.Class<M> 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
getModuleDescriptorsByModuleClass
in class AbstractPlugin
M
- The expected module type of the returned descriptors
.aClass
- the super class
the descriptors
return.
List
of descriptors
of the expected type.public boolean isEnabledByDefault()
isEnabledByDefault
in interface Plugin
isEnabledByDefault
in class AbstractPlugin
public void setEnabledByDefault(boolean enabledByDefault)
setEnabledByDefault
in interface Plugin
setEnabledByDefault
in class AbstractPlugin
public PluginInformation getPluginInformation()
getPluginInformation
in interface Plugin
getPluginInformation
in class AbstractPlugin
public void setPluginInformation(PluginInformation pluginInformation)
setPluginInformation
in interface Plugin
setPluginInformation
in class AbstractPlugin
public void setResources(Resourced resources)
setResources
in interface Plugin
setResources
in class AbstractPlugin
public boolean isSystemPlugin()
Plugin
isSystemPlugin
in interface Plugin
isSystemPlugin
in class AbstractPlugin
true
if this plugin is a "system" plugin.public boolean containsSystemModule()
containsSystemModule
in interface Plugin
containsSystemModule
in class AbstractPlugin
public void setSystemPlugin(boolean system)
setSystemPlugin
in interface Plugin
setSystemPlugin
in class AbstractPlugin
public java.util.Date getDateLoaded()
Plugin
getDateLoaded
in interface Plugin
getDateLoaded
in class AbstractPlugin
public boolean isUninstallable()
Plugin
true
if this plugin can be 'uninstalled'.public boolean isDeleteable()
Plugin
true
if this plugin file should be deleted on unistall.public boolean isDynamicallyLoaded()
Plugin
true
if this plugin is loaded dynamically at runtime.public java.util.List<ResourceDescriptor> getResourceDescriptors()
Resourced
descriptors
.
Note: since 2.2 this list must be immutable, previously modifying this list could modify the underlying list.
getResourceDescriptors
in interface Resourced
getResourceDescriptors
in class AbstractPlugin
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
getResourceDescriptors
in class AbstractPlugin
public ResourceLocation getResourceLocation(java.lang.String type, java.lang.String name)
Resourced
ResourceLocation
of a particular type and name.
getResourceLocation
in interface Resourced
getResourceLocation
in class AbstractPlugin
public ResourceDescriptor getResourceDescriptor(java.lang.String type, java.lang.String name)
Resourced
ResourceDescriptor
of a particular type and name.
getResourceDescriptor
in interface Resourced
getResourceDescriptor
in class AbstractPlugin
public <T> java.lang.Class<T> loadClass(java.lang.String clazz, java.lang.Class<?> callingClass) throws java.lang.ClassNotFoundException
Plugin
clazz
- The name of the class to be loadedcallingClass
- The class calling the loading (used to help find a classloader)
java.lang.ClassNotFoundException
- if the class cannot be located.public java.net.URL getResource(java.lang.String name)
Plugin
name
- the name of the resource to be loaded
public java.io.InputStream getResourceAsStream(java.lang.String name)
Plugin
name
- The name of the resource to be loaded.
protected void uninstallInternal()
AbstractPlugin
PluginException
.
uninstallInternal
in class AbstractPlugin
protected PluginState enableInternal()
AbstractPlugin
PluginException
.
enableInternal
in class AbstractPlugin
PluginState.ENABLED
or PluginState.ENABLING
protected void disableInternal()
AbstractPlugin
PluginException
.
disableInternal
in class AbstractPlugin
public java.lang.ClassLoader getClassLoader()
Plugin
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |