Build your own DataMinder plugins and let DataMinder run them for you
Seriously! It's not that hard!
There are just 8 plugin interfaces you need to know!
- What to do? : DMTask, DMInput, DMOutput
- What to do, but with possibility to change process flow? : DMDecision
- When to do it? : DMScheduler or the combination of DMService and DMListener
- Need a shared object with some common functionality? : DMCommonObject
Or put in another way. There are plugins that are part of process flow and actively modify process data. Those plugins all have some kind of run(...) method.
- DMTask: The main plugin for building process flow.
- DMInput: Same as DMTask, but indicates that it gets data externally.
- DMOutput: Same as DMTask, but indicates that it sends data externally.
- DMDecision: Same as DMTask, but with the possibility to alter process flow e.g. stop the process, include another process, redirect to another process or just continue the process.
And then there are plugins (without the run(...) method) . And they are not part of the standard flow. Instead, they are used to start processes or have some common functionality that other plugins may use.
- DMCommonObject: Implements some common functionality used by multiple plugins. For example connections to a data sources.
- DMScheduler: Starts a process based on time. And decides how often a process should run and how many times it is to run (or run until DataMinder is shut down).
- DMService: A plugin that listens to the outside world. If something happens it calls a listener (DMListener) and sends data to initialize the process. For example a web service or a file alternation listener service.
- DMListener: Connects a service (DMService) to a process. When something happens like a web service call or a file is uploaded, then the service checks if any listener is interested in the event. If so it calls the process with data about what has happened. With things like web parameters or the location of an uploaded file.
Choose a plugin-interface to implement based on what it should do.
All plugins should preform a single well-defined action. To get an idea check out the plugins provided with DataMinder.
A process contains a table that is sent to each plugin in the process. One by one. Each plugin has full access to the table and can modify it.
You build a process by connecting a number of plugins together. The data table is passed on to one plugin at a time.
Javadoc, code generator page and help files
DataMinder help files can be found at Support.
More information about plugin development can be found in the help files at "Plugin Development".
For Java doc for the plugin interfaces go to JavaDoc.
And you can autogenerate plugin code using our code generation page here.
How it works: A very simple illustration of how plugins make up a process
In case you think this is "to simple", please have a look at all the plugin types listed at How it works and consider what YOU could build using them.
Short plugin description
A more detailed description further down.
Plugin interface type 1-3:
Data plugins. Do something with data, input data to table or output data from table
Implement a DMTask, DMInput or DMOutput.
Plugin interface type 4:
Process flow plugin. End process, switch flow to another process or include a process
Implement a DMDecision. A DMDecision can work with data and when it returns tells DataMinder what to do next: continue with process, end process, redirect flow to another process or include some other process in the flow.
Plugin interface type 5-7:
Start process plugins. Based on an event, scheduled or run manually
Implement a DMService and DMListener combination or create a DMScheduler to start process on specific times.
You can always run a process manually if you like.
Plugin interface type 8:
Share common functionality plugin
Implement a DMCommonObject to allow other plugins to share common functionality like connection to data sources or a cache.
Checkout examples of all plugin interfaces implemented
We have implemented an example library which shows the code for each plugin type.
Download it at our DOWNLOAD page.
To compile the examples you only need to add our public api jar-file. It comes with each DataMinder installation:
{installation folder}/DataMinder/Server/PluginDevelopment/DMPublicAPI.jar
DataMinder help files can be found at Support.
More information about plugin development can be found in the help files at "Plugin Development".
For Java doc for the plugin interfaces go to JavaDoc.
And you can autogenerate plugin code using our code generation page here.
More detailed description of each plugin interface
DMObject: Superinterface with common methods
Each plugin must have: name , description of what it does and how it works, parameters to configure behaviour, author and version.
String getName() String getDescription() DMParameter[] getParameters() float getVersion() String getAuthor()
and the lifecycle methods called when the plugin is first created, deactivated or when its parameters have been updated.
void activate( context, initParameterValues) void deActivate() void initParametersHaveBeenUpdated(initParameterValues)
We collect all common methods in superinterface DMObject [javadoc]
The activate and gets value for parameters DMInitParameterValues [javadoc] and the plugin context DMPluginContext [javadoc]
DMTask, DMInput, DMOutput: Work with data
The most common interfaces you will implement. DMTask, DMInput, DMOutput [javadoc] These 3 plugins work with table data. The DMInput and DMOutput are sub-interfaces to DMTask and are just "marker" interfaces to inform users that a plugin retrieves or writes data from/to an external data source.
All you need to do is implement the run-method and work with data, get or output data externally.
You get access to all data using the DMTable [javadoc] object and you get all values for the plugin parameters from DMRunParameterValues [javadoc].
//The run method where you put implementation DMResult run(DMTable, DMRunParameterValues) { }
DMDecision: Decide what to do next
DMDecision [javadoc] is basically a DMTask that may redirect the flow of process depending on what happens during the run.
The run method for a DMDecision returns a DMResultWithDecisionOption [javadoc] with one of the following directives (from the DMWhatNext [javadoc] object ) back to DataMinder.
For more information please see our example implementation available for download Download.
- CONTINUE: Continue the process. For example only if a value is present in table like in an authorization use case or if the values have correct format.
- REDIRECT_TO_PROCESS: Redirect flow to another process e.g. authentication failed redirect to process creating an error message.
- INCLUDE_PROCESS: Useful when a process may be reused by many other processes e.g. correcting input parameters or when a complex and large process consisting of many tasks is broken up in smaller processes and then the smaller processes are used to build the first process.
- END_THIS_PROCESS:End this process flow: When this process should end and not continue e.g. when reading a file the was not there, meaning there is no data for the process to manage.
- END_ALL_PROCESSES: End all processes including the calling process. May be used when some data is missing e.g. when doing authorizations.
DMScheduler: When to star a process
DMScheduler [javadoc] lets DataMinder know when the process is to be run the next time.
long getNextRunTimeInMilliseconds(nowInMilliseconds) void setLastStartedTimeInMilliseconds(lastStartedTimeInMilliseconds)
DMService and DMListener: Start processes based on external events
DMService and DMListener [javadoc] start a process when something happens. Most common are the Http Services and Http listeners found in the default plugins. Used to create microservices.
In the sample implementation we have a file alternation service that starts processes when files are created, modified or deleted.
The DMService methods that keep track of the listeners listening to this service.
List<String> getRegisteredServiceListenerUids() void registerServiceListener( listenerUid, listenerInitParameters, listenerInitParameterValues) void unRegisterServiceListener(java.lang.String listenerUid)
And the DMListener method. It only lets DataMinder know which DMServices this DMListener can work with.
String[] getDMServiceInterfaces()
DMCommonObject: Shared functionality to reuse among plugins
DMCommonObject [javadoc] contains common functionality to be reused by plugins.
For example a reusable connection to data sources or a server cache for objects.
Other plugins send a data table to DMCommonObject with optional parameters. The DMCommonObject updates the table with data.
DMResult call( table, nameValues[]): Called by other plugins e.g. connecting to a data source.