public abstract class AbstractPluginQconf extends AbstractPluginBase
This type of plugin opens QCONF/paQP file immediately after run, process it and returns
results. User interface is not directly supported here unless you override executer()
.
For UI plugins use AbstractPluginTemplate
. If AbstractPluginOptions.paramFile
is
not null and not empty, it will be used, otherwise template displays file dialog.
Following workflow specified in AbstractPluginBase
, this implementation calls
loadFile(String)
from executer()
. If default constructor
AbstractPluginQconf(String, AbstractPluginOptions, String)
is called from constructor in
implementing class and any additional configuration is needed before plugin executes (that
typically should go after calling super (this) constructor) that configuration can be added in
overridden loadFile(String)
method before calling super#loadFile.
AbstractPluginBase
Modifier and Type | Field and Description |
---|---|
protected String |
fileExt
Extension of file plugin asks for after execution in IJ mode.
|
protected QconfLoader |
qconfLoader
Loaded configuration file.
|
apiCall, errorSink, logger, options
Modifier | Constructor and Description |
---|---|
protected |
AbstractPluginQconf()
This default constructor must be overridden in concrete class.
|
protected |
AbstractPluginQconf(AbstractPluginOptions options,
String pluginName)
Default constructor.
|
protected |
AbstractPluginQconf(String argString,
AbstractPluginOptions options,
String pluginName)
Constructor that allows to provide own parameters.
|
Modifier and Type | Method and Description |
---|---|
protected void |
executer()
Executed if
AbstractPluginBase.run(String) got parsable parameter string. |
QconfLoader |
getQconfLoader()
Return
QconfLoader object. |
protected void |
loadFile(String paramFile)
Load specified configuration file and execute plugin depending on file type.
|
protected abstract void |
runFromPaqp()
Called if loaded file is paQP.
|
protected abstract void |
runFromQconf()
Called if loaded file is QCONF.
|
void |
unload()
Remove loaded QCONF file and allows to load new one.
|
protected void |
validate()
Override this method to pass your own validation of QCONF structure.
|
run, setPluginName, showUi
getOptions, parseArgumentString, publishMacroString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
about
protected QconfLoader qconfLoader
protected String fileExt
protected AbstractPluginQconf()
AbstractPluginOptions
class should be
created there and then passed to AbstractPluginQconf(AbstractPluginOptions,String)
.protected AbstractPluginQconf(AbstractPluginOptions options, String pluginName)
Set api call to false and assign provided options to object.
options
- Reference to plugin configuration container.pluginName
- name of the plugin that will be displayed in Macro Recorderprotected AbstractPluginQconf(String argString, AbstractPluginOptions options, String pluginName) throws QuimpPluginException
Intended to run from API. Set AbstractOptionsParser.apiCall
to true and AbstractOptionsParser.errorSink
to
QuimpException.MessageSinkTypes.CONSOLE
.
AbstractPluginOptions
is initialised from specified string and assigned to this
instance.
It loads QCONF.paQP file specified in AbstractPluginOptions.paramFile
. If file is
not specified it shows load file window.
argString
- parameters string like that passed in macro. If it is empty string or null
constructor exits before deserialisation.options
- Reference to plugin configuration container.pluginName
- name of the plugin that will be displayed in Macro RecorderQuimpPluginException
- on any error in plugin execution.loadFile(String)
protected void executer() throws QuimpException
AbstractPluginBase
AbstractPluginBase.run(String)
got parsable parameter string.executer
in class AbstractPluginBase
QuimpException
- on any error. Exception is handled depending on
AbstractOptionsParser.errorSink
set by AbstractPluginBase.run(String)
protected void loadFile(String paramFile) throws QuimpException
This method executes only once, if getQconfLoader()
is null. Should be overridden
if there is any additional configuration needed before execution.
If file is QCONF then runFromQconf()
is executed, if it is paQP then
runFromPaqp()
. Validate loaded QCONF file by validate()
.
paramFile
- path to the file. It can be null or empty string to allow user pick the file.QuimpException
- When configuration file could not be loaded or it does not meet
requirements.validate()
protected void validate() throws QuimpException
QuimpException
- if file can not be validated.public QconfLoader getQconfLoader()
QconfLoader
object.public final void unload()
Note that file can be processed once, therefore next call of AbstractPluginBase.run(String)
wil do
nothing unless unload()
is used.
loadFile(String)
protected abstract void runFromQconf() throws QuimpException
This method expects that qconfLoader
is already set up (AbstractPluginBase.run(String)
. In
macro or IJ mode exceptions will be handled in place and displayed as IJERROR or GUI message.
For API call (only if initialised by
AbstractPluginQconf(String, AbstractPluginOptions, String)
)
exceptions are re-thrown.
QuimpException
- on errorprotected abstract void runFromPaqp() throws QuimpException
This method expects that qconfLoader
is already set up (AbstractPluginBase.run(String)
. In
macro or IJ mode exceptions will be handled in place and displayed as IJERROR or GUI message.
For API call (only if initialised by
AbstractPluginQconf(String, AbstractPluginOptions, String)
)
exceptions are re-thrown.
QuimpException
- on errorCopyright © 2002–2019 Department of Computer Science, Warwick University. All rights reserved.