Class ScriptedTask

  • All Implemented Interfaces:
    Configurable

    @Extensible
    @DirectoryServerExtension
    @DirectoryProxyServerExtension(appliesToLocalContent=true,
                                   appliesToRemoteContent=false)
    @SynchronizationServerExtension(appliesToLocalContent=true,
                                    appliesToSynchronizedContent=false)
    @ThreadSafety(level=INTERFACE_THREADSAFE)
    public abstract class ScriptedTask
    extends java.lang.Object
    implements Configurable
    This class defines an API that must be implemented by scripted extensions which may be used as administrative tasks. Administrative tasks have the ability to perform arbitrary processing within the server whenever a particular kind of entry is added, and that processing can be performed immediately or at some specified time in the future. Tasks may be scheduled by adding an entry below "cn=Scheduled Tasks,cn=tasks" with a format like the following:
       dn:  ds-task-id=TASKID,cn=Scheduled Tasks,cn=tasks
       objectClass: top
       objectClass: ds-task
       objectClass: ds-groovy-scripted-task
       ds-task-id: TASKID
       ds-task-class-name: com.unboundid.directory.sdk.extensions.GroovyScrip
        tedTask
       ds-scripted-task-class: com.example.ExampleGroovyTask
       ds-scripted-task-argument: name=value
     
    In this example, TASKID should be replaced with a string that uniquely identifies the task. The value of the ds-scripted-task-class attribute should contain the fully-qualified name of the non-abstract Groovy class that extends this com.unboundid.directory.sdk.scripting.ScriptedTask class, and the ds-scripted-task-argument values (if any) should reflect the set of arguments to be provided for the task. method.

    Alternately, the com.unboundid.ldap.sdk.unboundidds.tasks.GroovyScriptedTask class included in the Commercial Edition of the UnboundID LDAP SDK for Java may be used to schedule and interact with these kinds of tasks. See the documentation for the Commercial Edition of the LDAP SDK for more information on using the UnboundID LDAP SDK for Java to schedule and interact with administrative tasks.
    See Also:
    Task
    • Constructor Detail

      • ScriptedTask

        public ScriptedTask()
        Creates a new instance of this task. All task implementations must include a default constructor, but any initialization should generally be done in the initializeTask method.
    • Method Detail

      • defineConfigArguments

        public void defineConfigArguments​(ArgumentParser parser)
                                   throws ArgumentException
        Updates the provided argument parser to define any configuration arguments which may be used by this extension. The argument parser may also be updated to define relationships between arguments (e.g., to specify required, exclusive, or dependent argument sets).
        Specified by:
        defineConfigArguments in interface Configurable
        Parameters:
        parser - The argument parser to be updated with the configuration arguments which may be used by this extension.
        Throws:
        ArgumentException - If a problem is encountered while updating the provided argument parser.
      • initializeTask

        public void initializeTask​(DirectoryServerContext serverContext,
                                   ArgumentParser parser)
                            throws LDAPException
        Initializes this task.
        Parameters:
        serverContext - A handle to the server context for the server in which this extension is running.
        parser - The argument parser which has been initialized from the configuration for this task.
        Throws:
        LDAPException - If a problem occurs while initializing this task.
      • runTask

        public abstract TaskReturnState runTask​(TaskContext taskContext)
        Performs the appropriate processing for this task.
        Parameters:
        taskContext - Information about the task to be run.
        Returns:
        Information about the state of the task after processing has completed.