Class FilePluginInstaller
java.lang.Object
com.atlassian.plugin.repositories.FilePluginInstaller
- All Implemented Interfaces:
PluginInstaller,RevertablePluginInstaller
File-based implementation of a PluginInstaller which writes plugin artifact
to a specified directory. Handles reverting installs by keeping track of the first installation for a given
instance, and restores it. Installation of plugin artifacts with different names will overwrite an existing artifact
of that same name, if it exists, with the only exception being the backup of the first overwritten artifact to
support reverting.
NOTE: This implementation has a limitation. The issue is that when installing a plugin we are only provided the plugin
key and do not know the name of the artifact that provided the original plugin. So if someone installs a new version
of an existing plugin in an artifact that has a different name we have no way of telling what artifact provided
the original plugin and therefore which artifact to delete. This will result in two of the same plugins, but in
different artifacts being left in the plugins directory. Hopefully the versions will differ so that the plugins
framework can decide which plugin to enable.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeletes all backup files in the plugin directoryvoidinstallPlugin(String key, PluginArtifact pluginArtifact) If there is an existing JAR with the same filename, it is replaced.voidrevertInstalledPlugin(String pluginKey) Reverts an installed plugin.
-
Field Details
-
ORIGINAL_PREFIX
- See Also:
-
-
Constructor Details
-
FilePluginInstaller
- Parameters:
directory- where plugin JARs will be installed.
-
-
Method Details
-
installPlugin
If there is an existing JAR with the same filename, it is replaced.- Specified by:
installPluginin interfacePluginInstaller- Throws:
RuntimeException- if there was an exception reading or writing files.
-
revertInstalledPlugin
Reverts an installed plugin. Handles plugin file overwrites and different names over time.- Specified by:
revertInstalledPluginin interfaceRevertablePluginInstaller- Parameters:
pluginKey- The plugin key to revert- Since:
- 2.5.0
-
clearBackups
public void clearBackups()Deletes all backup files in the plugin directory- Specified by:
clearBackupsin interfaceRevertablePluginInstaller- Since:
- 2.5.0
-