com.atlassian.plugin.repositories
Class FilePluginInstaller
java.lang.Object
com.atlassian.plugin.repositories.FilePluginInstaller
- All Implemented Interfaces:
- PluginInstaller, RevertablePluginInstaller
public class FilePluginInstaller
- extends java.lang.Object
- implements 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:
RevertablePluginInstaller
|
Method Summary |
void |
clearBackups()
Deletes all backup files in the plugin directory |
void |
installPlugin(java.lang.String key,
PluginArtifact pluginArtifact)
If there is an existing JAR with the same filename, it is replaced. |
void |
revertInstalledPlugin(java.lang.String pluginKey)
Reverts an installed plugin. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ORIGINAL_PREFIX
public static final java.lang.String ORIGINAL_PREFIX
- See Also:
- Constant Field Values
FilePluginInstaller
public FilePluginInstaller(java.io.File directory)
- Parameters:
directory - where plugin JARs will be installed.
installPlugin
public void installPlugin(java.lang.String key,
PluginArtifact pluginArtifact)
- If there is an existing JAR with the same filename, it is replaced.
- Specified by:
installPlugin in interface PluginInstaller
- Throws:
java.lang.RuntimeException - if there was an exception reading or writing files.
revertInstalledPlugin
public void revertInstalledPlugin(java.lang.String pluginKey)
- Reverts an installed plugin. Handles plugin file overwrites and different names over time.
- Specified by:
revertInstalledPlugin in interface RevertablePluginInstaller
- 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:
clearBackups in interface RevertablePluginInstaller
- Since:
- 2.5.0
Copyright © 2010 Atlassian. All Rights Reserved.