Package net.sf.basedb.plugins.executor
Class AbstractIOSupport
java.lang.Object
net.sf.basedb.core.plugin.AbstractPlugin
net.sf.basedb.plugins.executor.AbstractIOSupport
- All Implemented Interfaces:
InteractivePlugin
,Plugin
,IOSupport
- Direct Known Subclasses:
BaseFileExporterSupport
,BaseFileImporterSupport
,BfsExporterSupport
,BfsImporterSupport
,FileOnlyImporterSupport
Abstract base class that is useful for plug-ins that need to implement
the
IOSupport
interface and don't want to be visible as
standalone plug-ins.- Since:
- 2.15
- Author:
- nicklas
- See Also:
- Last modified
- $Date $
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin
Plugin.MainType
-
Field Summary
Fields inherited from class net.sf.basedb.core.plugin.AbstractPlugin
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc
Fields inherited from interface net.sf.basedb.plugins.executor.IOSupport
COMMAND_CONFIGURE_IO_JOB, COMMAND_CONFIGURE_IO_PLUGIN, COMMAND_EXECUTE_IO_JOB
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ExternalProgramExecutor
Get the external program executor that invoked the plug-in.Get a set containing all items that the plugin handles.A default implementation to maintain backwards compatibility.void
init
(SessionControl sc, ParameterValues configuration, ParameterValues job, ExternalProgramExecutor executor) Replaces the regular plug-in initialisation method.isInContext
(GuiContext context, Object item) Check if the plugin can be used on the specified object.protected abstract String
performIO
(DbControl dc, ProgressReporter progress) Perform the IO operation.boolean
Returns FALSE, since that is how the plugins used to work before this method was introduced.void
run
(Request request, Response response, ProgressReporter progress) Accepts theIOSupport.COMMAND_EXECUTE_IO_JOB
command.boolean
Returns TRUE, since that is how the plugins used to work before this method was introduced.Methods inherited from class net.sf.basedb.core.plugin.AbstractPlugin
cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, getPermissions, init, isLogging, log, log, storeValue, storeValue, storeValues, validateRequestParameters
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.plugin.InteractivePlugin
configure, getRequestInformation
Methods inherited from interface net.sf.basedb.core.plugin.Plugin
done, getMainType, getPermissions, init
-
Field Details
-
executor
-
-
Constructor Details
-
AbstractIOSupport
public AbstractIOSupport()
-
-
Method Details
-
supportsConfigurations
public boolean supportsConfigurations()Description copied from class:AbstractPlugin
Returns TRUE, since that is how the plugins used to work before this method was introduced.- Specified by:
supportsConfigurations
in interfacePlugin
- Overrides:
supportsConfigurations
in classAbstractPlugin
- Returns:
- Always FALSE
-
requiresConfiguration
public boolean requiresConfiguration()Description copied from class:AbstractPlugin
Returns FALSE, since that is how the plugins used to work before this method was introduced.- Specified by:
requiresConfiguration
in interfacePlugin
- Overrides:
requiresConfiguration
in classAbstractPlugin
- Returns:
- Always FALSE
-
getGuiContexts
Description copied from interface:InteractivePlugin
Get a set containing all items that the plugin handles. Ie. if the plugin imports reporters, return a set containingItem.REPORTER
. This information is used by client applications to put the plugin in the proper place in the user interface.- Specified by:
getGuiContexts
in interfaceInteractivePlugin
- Returns:
- Always null
-
isInContext
Description copied from interface:InteractivePlugin
Check if the plugin can be used on the specified object. The item is either aBasicItem
orBasicData
object, or null if called from a list context. A client application should only call this method for contexts matching one of the contexts in the set returned by theInteractivePlugin.getGuiContexts()
method. ForGuiContext.Type.ITEM
contexts an item of the correct type should be passed as a parameter.The plug-in can response with a null value indicating success, a warning-level message or throw an exception to indicate an error-level message. Client application should normally only show error-level messages to users, unless the user has requested to see warning messages.
NOTE! Before BASE 2.4 all messages were treated as error-level messages.
- Specified by:
isInContext
in interfaceInteractivePlugin
- Parameters:
context
- The current context of the client application, it is one of the values found in set returned byInteractivePlugin.getGuiContexts()
item
- The currently active item, it's type should match theGuiContext.getItem()
type, or null if the context is a list context- Returns:
- Always null
-
run
Accepts theIOSupport.COMMAND_EXECUTE_IO_JOB
command. The default implementation starts a new transaction and then callsperformIO(DbControl, ProgressReporter)
which should be implemented by the subclass.- Specified by:
run
in interfacePlugin
- Parameters:
request
- Request object with the command and parametersresponse
- Response object in for the plugin to response throughprogress
- AProgressReporter
where the plugin can report its progess, can be null
-
getShortName
A default implementation to maintain backwards compatibility. Plug-ins that want to return a different short name should override this method.- Specified by:
getShortName
in interfaceIOSupport
- Returns:
- The name of the plugin (eg. PluginDefinition.getName())
- Since:
- 2.16
-
init
public void init(SessionControl sc, ParameterValues configuration, ParameterValues job, ExternalProgramExecutor executor) Description copied from interface:IOSupport
Replaces the regular plug-in initialisation method. When the plug-in is used as part of the external executor this method is used instead ofPlugin.init(SessionControl, ParameterValues, ParameterValues)
. -
performIO
Perform the IO operation.- Parameters:
dc
- A DbControl that can be used by the subclassprogress
- An optional progress reporter- Returns:
- A message that is returned as to the external program executor
- Throws:
IOException
-
getExecutor
Get the external program executor that invoked the plug-in.
-