Custom Task Definition
Simply import the XML object definition similar to the following:
The important part is the handler URI. The handler URI associates the task definition with the code.
Custom Task Code
The task code must be part of midPoint code. Currently perhaps the only feasible way is to recompile midPoint with your custom code in it (see Source Code Customization). The code itself is simply one class that implements the task handler:
The code is using Spring annotations to manage the class lifecycle. The class registers itself in the task manager in the post-construct method. The same handler instance will be invoked for all task instances. The task instance is passed as a parameter.