Package com.google.gerrit.server.plugins
Class JarPluginProvider
java.lang.Object
com.google.gerrit.server.plugins.JarPluginProvider
- All Implemented Interfaces:
ServerPluginProvider
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.gerrit.server.plugins.ServerPluginProvider
ServerPluginProvider.PluginDescription
-
Method Summary
Modifier and TypeMethodDescriptionget
(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) getPluginName
(Path srcPath) Returns the plugin name of an external file or directoryReturns the plugin name of this provider.boolean
Declares the availability to manage an external file or directorystatic Path
storeInTemp
(String pluginName, InputStream in, SitePaths sitePaths)
-
Method Details
-
handles
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
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
- 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
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
-