Package com.google.gerrit.server.plugins
Class AbstractPreloadedPluginScanner
java.lang.Object
com.google.gerrit.server.plugins.AbstractPreloadedPluginScanner
- All Implemented Interfaces:
PluginContentScanner
Base plugin scanner for a set of pre-loaded classes.
Utility base class for simplifying the development of Server plugin scanner based on a set of externally pre-loaded classes.
Extending this class you can implement very easily a PluginContentScanner from a set of pre-loaded Java Classes and an API Type. The convention used by this class is: - there is at most one Guice module per Gerrit module type (SysModule, HttpModule, SshModule) - plugin is set to be restartable in Gerrit Plugin MANIFEST - only Export and Listen annotated classes can be self-discovered
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.gerrit.server.plugins.PluginContentScanner
PluginContentScanner.ExtensionMetaData -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Plugin.ApiTypeprotected final Stringprotected final StringFields inherited from interface com.google.gerrit.server.plugins.PluginContentScanner
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionAbstractPreloadedPluginScanner(String pluginName, String pluginVersion, Set<Class<?>> preloadedClasses, Plugin.ApiType apiType) -
Method Summary
Modifier and TypeMethodDescriptionReturn 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 classesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.gerrit.server.plugins.PluginContentScanner
entries, getEntry, getInputStream
-
Field Details
-
pluginName
-
pluginVersion
-
preloadedClasses
-
apiType
-
-
Constructor Details
-
AbstractPreloadedPluginScanner
public AbstractPreloadedPluginScanner(String pluginName, String pluginVersion, Set<Class<?>> preloadedClasses, Plugin.ApiType apiType)
-
-
Method Details
-
getManifest
Description copied from interface:PluginContentScannerReturn the plugin meta-data manifest- Specified by:
getManifestin interfacePluginContentScanner- 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
public Map<Class<? extends Annotation>,Iterable<PluginContentScanner.ExtensionMetaData>> scan(String pluginName, Iterable<Class<? extends Annotation>> annotations) throws InvalidPluginException Description copied from interface:PluginContentScannerScans the plugin for declared public annotated classes- Specified by:
scanin interfacePluginContentScanner- 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
-