public abstract class AbstractPlugin extends java.lang.Object implements Plugin
It includes methods:
for readers management: initializes and manages the list of connected readers, allows to retrieve
them all or individually by their names,
for the plugin registration cycle: register, unregister and check registration.
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,Reader> |
readers
The list of readers
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractPlugin(java.lang.String name)
Instantiates a new Plugin.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName()
Gets the name of the plugin
|
Reader |
getReader(java.lang.String name)
Gets a specific reader designated by its name in the current readers list
|
java.util.Set<java.lang.String> |
getReaderNames()
Returns the current list of reader names.
|
java.util.Map<java.lang.String,Reader> |
getReaders()
Returns the current readers name instance map.
|
protected abstract java.util.Map<java.lang.String,Reader> |
initNativeReaders()
Init connected native readers (from third party library) and returns a map of corresponding
Reader with their name as key. |
void |
register()
Deprecated.
|
void |
unregister()
Deprecated.
|
protected java.util.Map<java.lang.String,Reader> readers
protected AbstractPlugin(java.lang.String name)
Initialize the list of readers calling the abstract method initNativeReaders
When readers initialisation failed, a KeypleReaderException is thrown
The registered status is set to true as soon as the plugin is created.
name
- name of the pluginKeypleReaderException
- when an issue is raised with readerpublic final java.lang.String getName()
public final java.util.Map<java.lang.String,Reader> getReaders()
getReaders
in interface Plugin
java.lang.IllegalStateException
- is thrown when plugin is not (or no longer) registered.public final java.util.Set<java.lang.String> getReaderNames()
The list of names is built from the current readers list
getReaderNames
in interface Plugin
java.lang.IllegalStateException
- is thrown when plugin is not (or no longer) registered.protected abstract java.util.Map<java.lang.String,Reader> initNativeReaders()
Reader
with their name as key.
Reader
are new instances.
this method is called once when the plugin is registered.
KeypleReaderIOException
- if the communication with the reader has failedpublic final Reader getReader(java.lang.String name)
getReader
in interface Plugin
name
- of the readerKeypleReaderNotFoundException
- if the wanted reader is not foundjava.lang.IllegalStateException
- is thrown when plugin is not (or no longer) registered.@Deprecated public void register()
@Deprecated public void unregister()
java.lang.IllegalStateException
- is thrown when plugin is already unregistered.