public class OsgiBundlePlugin extends AbstractPlugin implements OsgiBackedPlugin, ContainerManagedPlugin, org.osgi.framework.SynchronousBundleListener
That kind of plugins might have or do not have plugin descriptor and must manage internal IoC by themselves if it is present. Note that some modules require access to plugin IoC to work properly so it is plugin responsibility to provide a such access and manage internal container lifecycle.
To export any container to PluginsFramework bundle should export ContainerAccessor interface implementation as a service before move to ACTIVE state. Behavior is not defined if plugin provides more then one instances of ContainerAccessor Plugin of that type has lifecycle duplicates underlying OSGi Bundle natural states
pluginArtifact| Constructor and Description |
|---|
OsgiBundlePlugin(OsgiContainerManager osgiContainerManager,
String pluginKey,
PluginArtifact pluginArtifact)
Create a plugin wrapper which installs the bundle when the plugin is installed.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bundleChanged(org.osgi.framework.BundleEvent event) |
protected void |
disableInternal()
Perform any internal disabling logic.
|
protected PluginState |
enableInternal()
Perform any internal enabling logic.
|
org.osgi.framework.Bundle |
getBundle()
Returns
OSGi Bundle that corresponds to the current plugin |
ClassLoader |
getClassLoader()
Get the classloader for the plugin.
|
ContainerAccessor |
getContainerAccessor() |
Date |
getDateInstalled()
The date this plugin was installed into the system, is the same as the loaded date for non artifact backed plugins
|
Date |
getDateLoaded()
The date this plugin was loaded into the system.
|
PluginDependencies |
getDependencies()
Determines which plugin keys are dependencies, categorising them as mandatory, optional or dynamic.
|
URL |
getResource(String name)
Retrieve the URL of the resource from the plugin.
|
InputStream |
getResourceAsStream(String name)
Load a given resource from the plugin.
|
protected void |
installInternal()
Perform any internal installation logic.
|
boolean |
isDeleteable()
Should the plugin file be deleted on uninstall?
|
boolean |
isDynamicallyLoaded()
Whether or not this plugin is loaded dynamically at runtime.
|
boolean |
isUninstallable()
Whether or not this plugin can be 'uninstalled'.
|
<T> Class<T> |
loadClass(String clazz,
Class<?> callingClass)
Get the plugin to load a specific class.
|
void |
resolve()
Perform any required resolution.
|
protected void |
uninstallInternal()
Perform any internal uninstallation logic.
|
addDynamicModuleDescriptor, addModuleDescriptor, cleanVersionString, close, compareAndSetPluginState, compareTo, containsSystemModule, disable, enable, getActivePermissions, getDateEnabled, getDateEnabling, getDynamicModuleDescriptors, getI18nNameKey, getInstallationMode, getKey, getLog, getModuleDescriptor, getModuleDescriptors, getModuleDescriptorsByModuleClass, getName, getPluginArtifact, getPluginInformation, getPluginState, getPluginsVersion, getRequiredPlugins, getResourceDescriptor, getResourceDescriptors, getResourceLocation, getScopeKey, hasAllPermissions, install, isBundledPlugin, isEnabledByDefault, isSystemPlugin, removeDynamicModuleDescriptor, removeModuleDescriptor, setBundledPlugin, setEnabledByDefault, setI18nNameKey, setKey, setName, setPluginInformation, setPluginState, setPluginsVersion, setResources, setSystemPlugin, toString, uninstallclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddModuleDescriptor, containsSystemModule, disable, enable, getActivePermissions, getDateEnabled, getDateEnabling, getI18nNameKey, getInstallationMode, getKey, getModuleDescriptor, getModuleDescriptors, getModuleDescriptorsByModuleClass, getName, getPluginArtifact, getPluginInformation, getPluginState, getPluginsVersion, hasAllPermissions, install, isBundledPlugin, isEnabledByDefault, isSystemPlugin, setEnabledByDefault, setI18nNameKey, setKey, setName, setPluginInformation, setPluginsVersion, setResources, setSystemPlugin, uninstallgetScopeKeygetResourceDescriptor, getResourceDescriptors, getResourceLocationcompareTopublic OsgiBundlePlugin(OsgiContainerManager osgiContainerManager, String pluginKey, PluginArtifact pluginArtifact)
osgiContainerManager - the container to install into when the plugin is installed.pluginKey - The plugin key.pluginArtifact - The The plugin artifact to install.public org.osgi.framework.Bundle getBundle()
throws IllegalPluginStateException
OsgiBackedPluginOSGi Bundle that corresponds to the current plugin
Note that Bundle could be not available on some of Plugin lifecycle
stages. In that case method call results in IllegalPluginStateException
getBundle in interface OsgiBackedPluginOSGi representation of the current pluginIllegalPluginStateException - if plugin has no OSGi representation yetpublic Date getDateLoaded()
PlugingetDateLoaded in interface PlugingetDateLoaded in class AbstractPluginpublic Date getDateInstalled()
PlugingetDateInstalled in interface PlugingetDateInstalled in class AbstractPluginpublic boolean isUninstallable()
PluginisUninstallable in interface Plugintrue if this plugin can be 'uninstalled'.public boolean isDeleteable()
PluginisDeleteable in interface Plugintrue if this plugin file should be deleted on uninstall.public boolean isDynamicallyLoaded()
PluginisDynamicallyLoaded in interface Plugintrue if this plugin is loaded dynamically at runtime.public <T> Class<T> loadClass(String clazz, Class<?> callingClass) throws ClassNotFoundException
PluginloadClass in interface Pluginclazz - The name of the class to be loadedcallingClass - The class calling the loading (used to help find a classloader)ClassNotFoundException - if the class cannot be located.public URL getResource(String name)
PlugingetResource in interface Pluginname - the name of the resource to be loadedpublic InputStream getResourceAsStream(String name)
PlugingetResourceAsStream in interface Pluginname - The name of the resource to be loaded.public void resolve()
Pluginresolve in interface Pluginresolve in class AbstractPlugin@Nonnull public PluginDependencies getDependencies()
PlugingetDependencies in interface PlugingetDependencies in class AbstractPluginPlugin.getDependencies()protected void installInternal()
throws OsgiContainerException,
IllegalPluginStateException
AbstractPluginPluginException.installInternal in class AbstractPluginOsgiContainerExceptionIllegalPluginStateExceptionprotected void uninstallInternal()
AbstractPluginPluginException.uninstallInternal in class AbstractPluginprotected PluginState enableInternal()
AbstractPluginPluginState.PENDING is returned, it will be passed to AbstractPlugin.setPluginState(PluginState). If a subclass
returns PluginState.PENDING, no state is set, and it is assumed the subclass has taken responsibility for
transitioning state via direct calls to AbstractPlugin.setPluginState(PluginState).
Subclasses should only throw PluginException.enableInternal in class AbstractPluginPluginState.ENABLED, PluginState.ENABLING, or PluginState.PENDINGprotected void disableInternal()
AbstractPluginPluginException.disableInternal in class AbstractPluginpublic void bundleChanged(org.osgi.framework.BundleEvent event)
bundleChanged in interface org.osgi.framework.BundleListenerpublic ContainerAccessor getContainerAccessor()
getContainerAccessor in interface ContainerManagedPluginpublic ClassLoader getClassLoader()
PlugingetClassLoader in interface PluginCopyright © 2019 Atlassian. All rights reserved.