Interface PluginContentScanner

All Known Implementing Classes:
AbstractPreloadedPluginScanner, JarScanner

public interface PluginContentScanner
Scans the plugin returning classes and resources.

Gerrit uses the scanner to automatically discover the classes and resources exported by the plugin for auto discovery of exported SSH commands, Servlets and listeners.

  • Field Details

  • Method Details

    • getManifest

      Manifest getManifest() throws IOException
      Return the plugin meta-data manifest
      Returns:
      Manifest of the plugin or null if plugin has no meta-data
      Throws:
      IOException - if an I/O problem occurred whilst accessing the Manifest
    • scan

      Scans the plugin for declared public annotated classes
      Parameters:
      pluginName - the plugin name
      annotations - annotations declared by the plugin classes
      Returns:
      map of annotations and associated plugin classes found
      Throws:
      InvalidPluginException - if the plugin is not valid or corrupted
    • getEntry

      Optional<PluginEntry> getEntry(String resourcePath) throws IOException
      Return the plugin resource associated to a path
      Parameters:
      resourcePath - full path of the resource inside the plugin package
      Returns:
      the resource object or Optional.absent() if the resource was not found
      Throws:
      IOException - if there was a problem retrieving the resource
    • getInputStream

      InputStream getInputStream(PluginEntry entry) throws IOException
      Return the InputStream of the resource entry
      Parameters:
      entry - resource entry inside the plugin package
      Returns:
      the resource input stream
      Throws:
      IOException - if there was an I/O problem accessing the resource
    • entries

      Stream<PluginEntry> entries()
      Return all the resources inside a plugin
      Returns:
      the enumeration of all resources found