Class DummyPlugin
- All Implemented Interfaces:
Plugin,Resourced,ScopeAware,Comparable<Plugin>
Should be extended when a Plugin implementation is required, however must be compatible with multiple
versions of that interface.
All methods are guaranteed to be implemented.
- Since:
- 3.2.22
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModuleDescriptor(ModuleDescriptor<?> moduleDescriptor) intbooleanvoiddisable()Disables the plugin.voidenable()Enables the plugin.Get the classloader for the plugin.Obtain the date that the plugin system most recently completed enabling of this plugin.Obtain the date that the plugin system most recently commenced enabling this plugin.The date this plugin was installed into the system, is the same as the loaded date for non artifact backed pluginsThe date this plugin was loaded into the system.Determines which plugin keys are dependencies, categorising them as mandatory, optional or dynamic.Returns the i18nKey used to get an internationalised name for this plugin.Gets the installation modegetKey()Get theModuleDescriptorfor a particular key.Get theCollectionofdescriptors.<M> List<ModuleDescriptor<M>>getModuleDescriptorsByModuleClass(Class<M> moduleClass) Get thedescriptorswhose module class implements or is assignable from the suppliedClass.getName()Returns the non-localised name of this plugin if defined.Retrieve the original, unprocessed or transformedPluginArtifactused to create this plugin instance.Returns this plugin's current state.intGets the version of the plugins system to handle this plugingetResource(String path) Retrieve the URL of the resource from the plugin.getResourceAsStream(String name) Load a given resource from the plugin.getResourceDescriptor(String type, String name) Get aResourceDescriptorof a particular type and name.Get aListof all thedescriptors.getResourceLocation(String type, String name) Get aResourceLocationof a particular type and name.booleanvoidinstall()Installs the plugin into any internal, managing container.booleanWhether the plugin is a "bundled" plugin that can't be removed.booleanShould the plugin file be deleted on uninstall?booleanWhether or not this plugin is loaded dynamically at runtime.booleanbooleanWhether the plugin is a "system" plugin that shouldn't be made visible to the user.booleanWhether or not this plugin can be 'uninstalled'.<T> Class<T>Get the plugin to load a specific class.voidresolve()Perform any required resolution.voidsetEnabledByDefault(boolean enabledByDefault) voidsetI18nNameKey(String i18nNameKey) Sets the i18nKey used to get an internationalised name for this plugin.voidvoidSets the non-localised name of this plugin.voidsetPluginInformation(PluginInformation pluginInformation) voidsetPluginsVersion(int version) Sets the version of the plugins systemvoidsetResources(Resourced resources) voidsetSystemPlugin(boolean system) voidUninstalls the plugin from any internal container.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.plugin.ScopeAware
getScopeKey
-
Constructor Details
-
DummyPlugin
public DummyPlugin()
-
-
Method Details
-
getPluginsVersion
public int getPluginsVersion()Description copied from interface:PluginGets the version of the plugins system to handle this plugin- Specified by:
getPluginsVersionin interfacePlugin- Returns:
- The plugins version. If undefined, assumed to be 1.
-
setPluginsVersion
public void setPluginsVersion(int version) Description copied from interface:PluginSets the version of the plugins system- Specified by:
setPluginsVersionin interfacePlugin- Parameters:
version- The version
-
getName
Description copied from interface:PluginReturns the non-localised name of this plugin if defined.This corresponds to the value of the
namefield in the plugin's XML configuration file.You would expect a plugin developer to fill in one of either
name, ori18n-name-key, but the framework does no validation and makes no guarantees that this is the case. -
setName
Description copied from interface:PluginSets the non-localised name of this plugin. -
getI18nNameKey
Description copied from interface:PluginReturns the i18nKey used to get an internationalised name for this plugin.This corresponds to the value of the
i18n-name-keyfield in the plugin's XML configuration file.You would expect a plugin developer to fill in one of either
name, ori18n-name-key, but the framework does no validation and makes no guarantees that this is the case.- Specified by:
getI18nNameKeyin interfacePlugin- Returns:
- the i18n Name Key for this plugin if defined, or null.
- See Also:
-
setI18nNameKey
Description copied from interface:PluginSets the i18nKey used to get an internationalised name for this plugin.- Specified by:
setI18nNameKeyin interfacePlugin- Parameters:
i18nNameKey- the i18n Name Key.- See Also:
-
getKey
-
setKey
-
addModuleDescriptor
- Specified by:
addModuleDescriptorin interfacePlugin
-
getModuleDescriptors
Description copied from interface:PluginGet theCollectionofdescriptors.The iteration order of the collection is the order that the modules will be enabled, and should be the same order that the modules appear in the plugin descriptor.
- Specified by:
getModuleDescriptorsin interfacePlugin- Returns:
- the modules contained by this plugin in the order they are to be enabled
-
getModuleDescriptor
Description copied from interface:PluginGet theModuleDescriptorfor a particular key. Returnsnullif the plugin does not exist.Note: The
ModuleDescriptor.getModule()may throwClassCastExceptionif the expected type is incorrect.- Specified by:
getModuleDescriptorin interfacePlugin- Parameters:
key- theStringcomplete key of the module, in the form "org.example.plugin:module-key".- Returns:
- the
ModuleDescriptorof the expected type.
-
getModuleDescriptorsByModuleClass
Description copied from interface:PluginGet thedescriptorswhose module class implements or is assignable from the suppliedClass.Note: The
ModuleDescriptor.getModule()may throwClassCastExceptionif the expected type is incorrect. Normally this method would not be supplied with anything other thanObjector <?>, unless you are confident in the super type of the module classes thisPluginprovides.- Specified by:
getModuleDescriptorsByModuleClassin interfacePlugin- Type Parameters:
M- The expected module type of the returneddescriptors.- Parameters:
moduleClass- thesuper classthedescriptorsreturn.- Returns:
- the
Listofdescriptorsof the expected type.
-
getInstallationMode
Description copied from interface:PluginGets the installation mode- Specified by:
getInstallationModein interfacePlugin- Returns:
- the plugin's installation mode, local or remote.
-
isEnabledByDefault
public boolean isEnabledByDefault()- Specified by:
isEnabledByDefaultin interfacePlugin
-
setEnabledByDefault
public void setEnabledByDefault(boolean enabledByDefault) - Specified by:
setEnabledByDefaultin interfacePlugin
-
getPluginInformation
- Specified by:
getPluginInformationin interfacePlugin
-
setPluginInformation
- Specified by:
setPluginInformationin interfacePlugin
-
setResources
- Specified by:
setResourcesin interfacePlugin
-
getPluginState
Description copied from interface:PluginReturns this plugin's current state.- Specified by:
getPluginStatein interfacePlugin- Returns:
- the current state of the plugin.
-
isSystemPlugin
public boolean isSystemPlugin()Description copied from interface:PluginWhether the plugin is a "system" plugin that shouldn't be made visible to the user.- Specified by:
isSystemPluginin interfacePlugin- Returns:
trueif this plugin is a "system" plugin.
-
setSystemPlugin
public void setSystemPlugin(boolean system) - Specified by:
setSystemPluginin interfacePlugin- Parameters:
system- whether the plugin is a "system" plugin that shouldn't be made visible to the user.
-
containsSystemModule
public boolean containsSystemModule()- Specified by:
containsSystemModulein interfacePlugin
-
isBundledPlugin
public boolean isBundledPlugin()Description copied from interface:PluginWhether the plugin is a "bundled" plugin that can't be removed.- Specified by:
isBundledPluginin interfacePlugin- Returns:
trueif this plugin is a "bundled" plugin.
-
getDateLoaded
Description copied from interface:PluginThe date this plugin was loaded into the system.- Specified by:
getDateLoadedin interfacePlugin- Returns:
- The date this plugin was loaded into the system.
-
getDateInstalled
Description copied from interface:PluginThe date this plugin was installed into the system, is the same as the loaded date for non artifact backed plugins- Specified by:
getDateInstalledin interfacePlugin- Returns:
- The date this plugin was installed into the system
-
isUninstallable
public boolean isUninstallable()Description copied from interface:PluginWhether or not this plugin can be 'uninstalled'.- Specified by:
isUninstallablein interfacePlugin- Returns:
trueif this plugin can be 'uninstalled'.
-
isDeleteable
public boolean isDeleteable()Description copied from interface:PluginShould the plugin file be deleted on uninstall?- Specified by:
isDeleteablein interfacePlugin- Returns:
trueif this plugin file should be deleted on uninstall.
-
isDynamicallyLoaded
public boolean isDynamicallyLoaded()Description copied from interface:PluginWhether or not this plugin is loaded dynamically at runtime.- Specified by:
isDynamicallyLoadedin interfacePlugin- Returns:
trueif this plugin is loaded dynamically at runtime.
-
loadClass
Description copied from interface:PluginGet the plugin to load a specific class.- Specified by:
loadClassin interfacePlugin- Parameters:
clazz- The name of the class to be loadedcallingClass- The class calling the loading (used to help find a classloader)- Returns:
- The loaded class.
- Throws:
ClassNotFoundException- if the class cannot be located.
-
getClassLoader
Description copied from interface:PluginGet the classloader for the plugin.- Specified by:
getClassLoaderin interfacePlugin- Returns:
- The classloader used to load classes for this plugin
-
getResource
Description copied from interface:PluginRetrieve the URL of the resource from the plugin.- Specified by:
getResourcein interfacePlugin- Parameters:
path- the name of the resource to be loaded- Returns:
- The URL to the resource, or null if the resource is not found
-
getResourceAsStream
Description copied from interface:PluginLoad a given resource from the plugin. Plugins that are loaded dynamically will need to implement this in a way that loads the resource from the same context as the plugin. Static plugins can just pull them from their own classloader.- Specified by:
getResourceAsStreamin interfacePlugin- Parameters:
name- The name of the resource to be loaded.- Returns:
- An InputStream for the resource, or null if the resource is not found.
-
install
public void install()Description copied from interface:PluginInstalls the plugin into any internal, managing container. This method will be called on every startup. Unless an exception is thrown, the plugin should be in thePluginState.INSTALLEDstate. If the plugin is already in thePluginState.INSTALLEDstate, nothing will happen. -
uninstall
public void uninstall()Description copied from interface:PluginUninstalls the plugin from any internal container. This method will be called on every shutdown. Unless an exception is thrown, the plugin should be in thePluginState.UNINSTALLEDstate. If the plugin is already in thePluginState.UNINSTALLEDstate, nothing will happen. -
enable
public void enable()Description copied from interface:PluginEnables the plugin. Unless an exception is thrown, the plugin should then be in either thePluginState.ENABLINGorPluginState.ENABLEDstate. If the plugin is already in thePluginState.ENABLINGorPluginState.ENABLEDstate, nothing will happen. -
disable
public void disable()Description copied from interface:PluginDisables the plugin. Unless an exception is thrown, the plugin should be in thePluginState.DISABLEDstate. If the plugin is already in thePluginState.DISABLEDstate, nothing will happen. -
getDependencies
Description copied from interface:PluginDetermines which plugin keys are dependencies, categorising them as mandatory, optional or dynamic.- Specified by:
getDependenciesin interfacePlugin- Returns:
- not null, possibly empty
-
getActivePermissions
- Specified by:
getActivePermissionsin interfacePlugin- Returns:
- the list of permissions currently valid for the plugin
-
hasAllPermissions
public boolean hasAllPermissions()- Specified by:
hasAllPermissionsin interfacePlugin- Returns:
trueif the plugin has all the permissions
-
resolve
public void resolve()Description copied from interface:PluginPerform any required resolution. This is a hook to allow the plugin system to perform a resolution pass over a group of modules before the enable pass. -
getDateEnabling
Description copied from interface:PluginObtain the date that the plugin system most recently commenced enabling this plugin. This may return null if the plugin has never commenced enabling, or if the value is unavailable for other reasons, such as wrappers around legacy implementations.- Specified by:
getDateEnablingin interfacePlugin- Returns:
- the date that the plugin most recently entered
PluginState.ENABLING.
-
getDateEnabled
Description copied from interface:PluginObtain the date that the plugin system most recently completed enabling of this plugin. This will return null if the plugin has never been enabled, has not completed enabling since it most recently started enabling, or if the value is unavailable for any other reason, such as wrappers around legacy implementations.- Specified by:
getDateEnabledin interfacePlugin- Returns:
- the date that the plugin most recently entered
PluginState.ENABLED, if this was not before the most recentPluginState.ENABLING, otherwise null.
-
getPluginArtifact
Description copied from interface:PluginRetrieve the original, unprocessed or transformedPluginArtifactused to create this plugin instance.Note that this method may be removed without notice; it is for use only by the host application.
This method was originally part of the internal
PluginArtifactBackedPlugininterface that is no longer present.- Specified by:
getPluginArtifactin interfacePlugin- Returns:
- null if this plugin has no artifact
-
compareTo
- Specified by:
compareToin interfaceComparable<Plugin>
-
getResourceDescriptors
Description copied from interface:ResourcedGet aListof all thedescriptors.Note: since 2.2 this list must be immutable, previously modifying this list could modify the underlying list.
- Specified by:
getResourceDescriptorsin interfaceResourced- Returns:
- all resource descriptors this object supports.
-
getResourceDescriptor
Description copied from interface:ResourcedGet aResourceDescriptorof a particular type and name.- Specified by:
getResourceDescriptorin interfaceResourced- Returns:
- the specified resource descriptor if found, null otherwise.
-
getResourceLocation
Description copied from interface:ResourcedGet aResourceLocationof a particular type and name.- Specified by:
getResourceLocationin interfaceResourced- Returns:
- the specified resource location if found, null otherwise.
-