Class JarPluginProvider

java.lang.Object
com.google.gerrit.server.plugins.JarPluginProvider
All Implemented Interfaces:
ServerPluginProvider

public class JarPluginProvider extends Object implements ServerPluginProvider
  • Method Details

    • 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 interface ServerPluginProvider
      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 directory

      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:
      getPluginName in interface ServerPluginProvider
      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 interface ServerPluginProvider
      Parameters:
      srcPath - external file or directory
      snapshot - snapshot of the external file
      description - 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 interface ServerPluginProvider
      Returns:
      plugin name of this provider
    • storeInTemp

      public static Path storeInTemp(String pluginName, InputStream in, SitePaths sitePaths) throws IOException
      Throws:
      IOException