Package com.google.gerrit.server.plugins
Class AbstractPreloadedPluginScanner
- java.lang.Object
-
- com.google.gerrit.server.plugins.AbstractPreloadedPluginScanner
-
- All Implemented Interfaces:
PluginContentScanner
public abstract class AbstractPreloadedPluginScanner extends Object implements 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
Fields Modifier and Type Field Description protected Plugin.ApiType
apiType
protected String
pluginName
protected String
pluginVersion
protected Set<Class<?>>
preloadedClasses
-
Fields inherited from interface com.google.gerrit.server.plugins.PluginContentScanner
EMPTY
-
-
Constructor Summary
Constructors Constructor Description AbstractPreloadedPluginScanner(String pluginName, String pluginVersion, Set<Class<?>> preloadedClasses, Plugin.ApiType apiType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Manifest
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-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.gerrit.server.plugins.PluginContentScanner
entries, getEntry, getInputStream
-
-
-
-
Field Detail
-
pluginName
protected final String pluginName
-
pluginVersion
protected final String pluginVersion
-
apiType
protected final Plugin.ApiType apiType
-
-
Constructor Detail
-
AbstractPreloadedPluginScanner
public AbstractPreloadedPluginScanner(String pluginName, String pluginVersion, Set<Class<?>> preloadedClasses, Plugin.ApiType apiType)
-
-
Method Detail
-
getManifest
public Manifest getManifest() throws IOException
Description copied from interface:PluginContentScanner
Return the plugin meta-data manifest- Specified by:
getManifest
in 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:PluginContentScanner
Scans the plugin for declared public annotated classes- Specified by:
scan
in 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
-
-