public class OsgiPlugin extends AbstractPlugin implements OsgiBackedPlugin, ContainerManagedPlugin, Plugin.Resolvable
AbstractPlugin.install() method is invoked. Any attempt to access a method that requires a bundle will throw an
IllegalPluginStateException.
This class uses a OsgiPluginHelper to represent different behaviors of key methods in different states.
OsgiPluginUninstalledHelper implements the methods when the plugin hasn't yet been installed into the
OSGi container, while OsgiPluginInstalledHelper implements the methods when the bundle is available. This
leaves this class to manage the PluginState and interactions with the event system.
Plugin.EnabledMetricsSource, Plugin.ResolvablePlugin.Resolvable.DefaultPlugin.EnabledMetricsSource.Default| Modifier and Type | Field and Description |
|---|---|
static String |
ATLASSIAN_PLUGIN_KEY
Manifest key for the Atlassian plugin key entry
|
static String |
ATLASSIAN_SCAN_FOLDERS
Manifest key for additional scan folders
|
static String |
REMOTE_PLUGIN_KEY
Manifest key denoting Atlassian remote plugins
|
pluginArtifactNAME_COMPARATOR, VERSION_1, VERSION_2, VERSION_3| Constructor and Description |
|---|
OsgiPlugin(String key,
OsgiContainerManager mgr,
PluginArtifact artifact,
PluginArtifact originalPluginArtifact,
com.atlassian.plugin.event.PluginEventManager pluginEventManager) |
addDynamicModuleDescriptor, addModuleDescriptor, cleanVersionString, close, compareAndSetPluginState, compareTo, containsSystemModule, disable, enable, getActivePermissions, getDateEnabled, getDateEnabling, getDateLoaded, getDynamicModuleDescriptors, getI18nNameKey, getKey, getLog, getModuleDescriptor, getModuleDescriptors, getModuleDescriptorsByModuleClass, getName, getPluginArtifact, getPluginInformation, getPluginState, getPluginsVersion, getRequiredPlugins, getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation, getScopeKey, hasAllPermissions, install, isBundledPlugin, isEnabled, isEnabledByDefault, isSystemPlugin, removeDynamicModuleDescriptor, removeModuleDescriptor, setBundledPlugin, setEnabled, setEnabledByDefault, setI18nNameKey, setName, setPluginInformation, setPluginState, setPluginsVersion, setResources, setSystemPlugin, uninstallclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddModuleDescriptor, close, containsSystemModule, disable, enable, getActivePermissions, getDateEnabled, getDateEnabling, getDateLoaded, getI18nNameKey, getKey, getModuleDescriptor, getModuleDescriptors, getModuleDescriptorsByModuleClass, getName, getPluginArtifact, getPluginInformation, getPluginState, getPluginsVersion, getRequiredPlugins, hasAllPermissions, install, isBundledPlugin, isEnabled, isEnabledByDefault, isSystemPlugin, setEnabled, setEnabledByDefault, setI18nNameKey, setName, setPluginInformation, setPluginsVersion, setResources, setSystemPlugin, uninstallgetScopeKeygetResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocationcompareTopublic static final String ATLASSIAN_PLUGIN_KEY
public static final String ATLASSIAN_SCAN_FOLDERS
public static final String REMOTE_PLUGIN_KEY
public OsgiPlugin(String key, OsgiContainerManager mgr, PluginArtifact artifact, PluginArtifact originalPluginArtifact, com.atlassian.plugin.event.PluginEventManager pluginEventManager)
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 InstallationMode getInstallationMode()
getInstallationMode in interface PlugingetInstallationMode in class AbstractPluginpublic boolean isUninstallable()
isUninstallable in interface Pluginpublic boolean isDynamicallyLoaded()
isDynamicallyLoaded in interface Pluginpublic boolean isDeleteable()
isDeleteable in interface Pluginpublic Date getDateInstalled()
getDateInstalled in interface PlugingetDateInstalled in class AbstractPlugin@Deprecated public void setKey(String key)
setKey in interface PluginsetKey in class AbstractPluginpublic <T> Class<T> loadClass(String clazz, Class<?> callingClass) throws ClassNotFoundException, IllegalPluginStateException
loadClass in interface PluginT - The class typeclazz - 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 foundIllegalPluginStateException - if the bundle hasn't been created yetpublic URL getResource(String name) throws IllegalPluginStateException
getResource in interface Pluginname - The resource nameIllegalPluginStateException - if the bundle hasn't been created yetpublic InputStream getResourceAsStream(String name) throws IllegalPluginStateException
getResourceAsStream in interface Pluginname - The name of the resource to be loaded.IllegalPluginStateException - if the bundle hasn't been created yetpublic ClassLoader getClassLoader() throws IllegalPluginStateException
getClassLoader in interface PluginIllegalPluginStateException - if the bundle hasn't been created yetpublic void onPluginContainerFailed(com.atlassian.plugin.event.events.PluginContainerFailedEvent event) throws IllegalPluginStateException
event - The plugin container failed eventIllegalPluginStateException - If the plugin key hasn't been set yetpublic void onPluginFrameworkStartedEvent(com.atlassian.plugin.event.events.PluginFrameworkStartedEvent event)
public void onPluginFrameworkShutdownEvent(com.atlassian.plugin.event.events.PluginFrameworkShutdownEvent event)
public void onPluginFrameworkShuttingDownEvent(com.atlassian.plugin.event.events.PluginFrameworkShuttingDownEvent event)
public void onServiceDependencyWaitStarting(PluginServiceDependencyWaitStartingEvent event)
public void onServiceDependencyWaitEnded(PluginServiceDependencyWaitEndedEvent event)
public void onServiceDependencyWaitEnded(PluginServiceDependencyWaitTimedOutEvent event)
public void onPluginContainerRefresh(com.atlassian.plugin.event.events.PluginContainerRefreshedEvent event) throws IllegalPluginStateException
event - The eventIllegalPluginStateException - If the plugin key hasn't been set yet@Nonnull public PluginDependencies getDependencies()
Namespace.RESOLUTION_OPTIONAL and PackageNamespace.RESOLUTION_DYNAMIC are mapped to
optional and dynamic, respectively. Any others are mapped to mandatory.getDependencies in interface PlugingetDependencies in class AbstractPluginPlugin.getDependencies()public String toString()
toString in class AbstractPluginprotected void installInternal()
throws IllegalPluginStateException
installInternal in class AbstractPluginIllegalPluginStateException - if the bundle hasn't been created yetprotected PluginState enableInternal() throws OsgiContainerException, IllegalPluginStateException
enableInternal in class AbstractPluginPluginState.ENABLEDif the container is being refreshed or PluginState.ENABLING if we are waiting
on a plugin container (first time being activated, as all subsequent times are considered refreshes)OsgiContainerException - If the underlying OSGi system threw an exception or we tried to enable the bundle
when it was in an invalid stateIllegalPluginStateException - if the bundle hasn't been created yetprotected void disableInternal()
throws OsgiContainerException,
IllegalPluginStateException
disableInternal in class AbstractPluginOsgiContainerException - If the OSGi system threw an exceptionIllegalPluginStateException - if the bundle hasn't been created yetprotected void uninstallInternal()
throws OsgiContainerException,
IllegalPluginStateException
uninstallInternal in class AbstractPluginOsgiContainerException - If the underlying OSGi system threw an exceptionIllegalPluginStateException - if the bundle hasn't been created yetpublic ContainerAccessor getContainerAccessor()
getContainerAccessor in interface ContainerManagedPluginpublic void resolve()
resolve in interface Pluginresolve in interface Plugin.Resolvableresolve in class AbstractPluginCopyright © 2018 Atlassian. All rights reserved.