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