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 ClassesModifier and TypeInterfaceDescriptionstatic class
Plugin class extension meta-data -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionentries()
Return all the resources inside a pluginReturn the plugin resource associated to a pathgetInputStream
(PluginEntry entry) Return the InputStream of the resource entryReturn 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 Details
-
EMPTY
Scanner without resources.
-
-
Method Details
-
getManifest
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
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
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
-