Package com.google.gerrit.server.plugins
Class JarPluginProvider
- java.lang.Object
-
- com.google.gerrit.server.plugins.JarPluginProvider
-
- All Implemented Interfaces:
ServerPluginProvider
public class JarPluginProvider extends Object implements ServerPluginProvider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.gerrit.server.plugins.ServerPluginProvider
ServerPluginProvider.PluginDescription
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerPlugin
get(Path srcPath, org.eclipse.jgit.internal.storage.file.FileSnapshot snapshot, ServerPluginProvider.PluginDescription description)
Loads an external file or directory into a Server plugin.static String
getJarPluginName(Path srcPath)
String
getPluginName(Path srcPath)
Returns the plugin name of an external file or directoryString
getProviderPluginName()
Returns the plugin name of this provider.boolean
handles(Path srcPath)
Declares the availability to manage an external file or directorystatic Path
storeInTemp(String pluginName, InputStream in, SitePaths sitePaths)
-
-
-
Method Detail
-
handles
public boolean handles(Path srcPath)
Description copied from interface:ServerPluginProvider
Declares the availability to manage an external file or directory- Specified by:
handles
in interfaceServerPluginProvider
- Parameters:
srcPath
- the external file or directory- Returns:
- true if file or directory can be loaded into a Server Plugin
-
getPluginName
public String getPluginName(Path srcPath)
Description copied from interface:ServerPluginProvider
Returns the plugin name of an external file or directoryShould be called only if
handles(srcFile)
returns true and thus srcFile is a supported plugin format. An IllegalArgumentException is thrown otherwise as srcFile is not a valid file format for extracting its plugin name.- Specified by:
getPluginName
in interfaceServerPluginProvider
- Parameters:
srcPath
- external file or directory- Returns:
- plugin name
-
getJarPluginName
public static String getJarPluginName(Path srcPath) throws IOException
- Throws:
IOException
-
get
public ServerPlugin get(Path srcPath, org.eclipse.jgit.internal.storage.file.FileSnapshot snapshot, ServerPluginProvider.PluginDescription description) throws InvalidPluginException
Description copied from interface:ServerPluginProvider
Loads an external file or directory into a Server plugin.Should be called only if
handles(srcFile)
returns true and thus srcFile is a supported plugin format. An IllegalArgumentException is thrown otherwise as srcFile is not a valid file format for extracting its plugin name.- Specified by:
get
in interfaceServerPluginProvider
- Parameters:
srcPath
- external file or directorysnapshot
- snapshot of the external filedescription
- descriptor of the ServerPlugin to load- Throws:
InvalidPluginException
- if plugin is supposed to be handled but cannot be loaded for any other reason
-
getProviderPluginName
public String getProviderPluginName()
Description copied from interface:ServerPluginProvider
Returns the plugin name of this provider.Allows to identify which plugin provided the current ServerPluginProvider by returning the plugin name. Helpful for troubleshooting plugin loading problems.
- Specified by:
getProviderPluginName
in interfaceServerPluginProvider
- Returns:
- plugin name of this provider
-
storeInTemp
public static Path storeInTemp(String pluginName, InputStream in, SitePaths sitePaths) throws IOException
- Throws:
IOException
-
-