public class JarScanner extends java.lang.Object implements PluginContentScanner, java.lang.AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
JarScanner.ClassData |
PluginContentScanner.ExtensionMetaData
EMPTY
Constructor and Description |
---|
JarScanner(java.nio.file.Path src) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.util.Enumeration<PluginEntry> |
entries()
Return all the resources inside a plugin
|
java.util.List<java.lang.String> |
findSubClassesOf(java.lang.Class<?> superClass) |
java.util.Optional<PluginEntry> |
getEntry(java.lang.String resourcePath)
Return the plugin resource associated to a path
|
java.io.InputStream |
getInputStream(PluginEntry entry)
Return the InputStream of the resource entry
|
java.util.jar.Manifest |
getManifest()
Return the plugin meta-data manifest
|
java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.Iterable<PluginContentScanner.ExtensionMetaData>> |
scan(java.lang.String pluginName,
java.lang.Iterable<java.lang.Class<? extends java.lang.annotation.Annotation>> annotations)
Scans the plugin for declared public annotated classes
|
public JarScanner(java.nio.file.Path src) throws java.io.IOException
java.io.IOException
public java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.Iterable<PluginContentScanner.ExtensionMetaData>> scan(java.lang.String pluginName, java.lang.Iterable<java.lang.Class<? extends java.lang.annotation.Annotation>> annotations) throws InvalidPluginException
PluginContentScanner
scan
in interface PluginContentScanner
pluginName
- the plugin nameannotations
- annotations declared by the plugin classesInvalidPluginException
- if the plugin is not valid or corruptedpublic java.util.List<java.lang.String> findSubClassesOf(java.lang.Class<?> superClass) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
java.io.IOException
public java.util.Optional<PluginEntry> getEntry(java.lang.String resourcePath) throws java.io.IOException
PluginContentScanner
getEntry
in interface PluginContentScanner
resourcePath
- full path of the resource inside the plugin packagejava.io.IOException
- if there was a problem retrieving the resourcepublic java.util.Enumeration<PluginEntry> entries()
PluginContentScanner
entries
in interface PluginContentScanner
public java.io.InputStream getInputStream(PluginEntry entry) throws java.io.IOException
PluginContentScanner
getInputStream
in interface PluginContentScanner
entry
- resource entry inside the plugin packagejava.io.IOException
- if there was an I/O problem accessing the resourcepublic java.util.jar.Manifest getManifest() throws java.io.IOException
PluginContentScanner
getManifest
in interface PluginContentScanner
java.io.IOException
- if an I/O problem occurred whilst accessing the Manifest