Package com.google.gerrit.server.plugins
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
PluginContentScanner.ExtensionMetaData
Plugin class extension meta-data
-
Field Summary
Fields Modifier and Type Field Description static PluginContentScanner
EMPTY
Scanner without resources.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Stream<PluginEntry>
entries()
Return all the resources inside a pluginOptional<PluginEntry>
getEntry(String resourcePath)
Return the plugin resource associated to a pathInputStream
getInputStream(PluginEntry entry)
Return the InputStream of the resource entryManifest
getManifest()
Return the plugin meta-data manifestMap<Class<? extends Annotation>,Iterable<PluginContentScanner.ExtensionMetaData>>
scan(String pluginName, Iterable<Class<? extends Annotation>> annotations)
Scans the plugin for declared public annotated classes
-
-
-
Field Detail
-
EMPTY
static final PluginContentScanner EMPTY
Scanner without resources.
-
-
Method Detail
-
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
Map<Class<? extends Annotation>,Iterable<PluginContentScanner.ExtensionMetaData>> scan(String pluginName, Iterable<Class<? extends Annotation>> annotations) throws InvalidPluginException
Scans the plugin for declared public annotated classes- Parameters:
pluginName
- the plugin nameannotations
- 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
-
-