public class

FilePluginInstaller

extends Object
implements RevertablePluginInstaller
java.lang.Object
   ↳ com.atlassian.plugin.repositories.FilePluginInstaller

Class Overview

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.

Summary

Constants
String ORIGINAL_PREFIX
Public Constructors
FilePluginInstaller(File directory)
Public Methods
void clearBackups()
Deletes all backup files in the plugin directory
void installPlugin(String key, PluginArtifact pluginArtifact)
If there is an existing JAR with the same filename, it is replaced.
void revertInstalledPlugin(String pluginKey)
Reverts an installed plugin.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.PluginInstaller
From interface com.atlassian.plugin.RevertablePluginInstaller

Constants

public static final String ORIGINAL_PREFIX

Constant Value: ".original-"

Public Constructors

public FilePluginInstaller (File directory)

Parameters
directory where plugin JARs will be installed.

Public Methods

public void clearBackups ()

Deletes all backup files in the plugin directory

public void installPlugin (String key, PluginArtifact pluginArtifact)

If there is an existing JAR with the same filename, it is replaced.

Throws
RuntimeException if there was an exception reading or writing files.

public void revertInstalledPlugin (String pluginKey)

Reverts an installed plugin. Handles plugin file overwrites and different names over time.

Parameters
pluginKey The plugin key to revert