@Extensible @DirectoryServerExtension @DirectoryProxyServerExtension(appliesToLocalContent=true, appliesToRemoteContent=false) @SynchronizationServerExtension(appliesToLocalContent=true, appliesToSynchronizedContent=false) @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class Task extends java.lang.Object implements UnboundIDExtension, ExampleUsageProvider
dsconfig set-global-configuration-prop --add allowed-task:com.unboundid.directory.sdk.extensions.ThirdPartyTaskTasks may then 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-third-party-task ds-task-id: TASKID ds-task-class-name: com.unboundid.directory.sdk.extensions.ThirdPartyTask ds-third-party-task-java-class: com.example.ExampleTask ds-third-party-task-argument: name=valueIn this example, TASKID should be replaced with a string that uniquely identifies the task. The value of the ds-third-party-task-java-class attribute should contain the fully-qualified name of the non-abstract Java class that extends this com.unboundid.directory.sdk.api.Task class, and the ds-third-party-task-argument values (if any) should reflect the set of arguments allowed for the task as per the
defineConfigArguments(com.unboundid.util.args.ArgumentParser)
method.
ScriptedTask
Constructor and Description |
---|
Task()
Creates a new instance of this task.
|
Modifier and Type | Method and Description |
---|---|
void |
defineConfigArguments(com.unboundid.util.args.ArgumentParser parser)
Updates the provided argument parser to define any configuration arguments
which may be used by this extension.
|
java.util.Map<java.util.List<java.lang.String>,java.lang.String> |
getExamplesArgumentSets()
Retrieves a map containing examples of configurations that may be used for
this extension.
|
abstract java.lang.String[] |
getExtensionDescription()
Retrieves a human-readable description for this extension.
|
abstract java.lang.String |
getExtensionName()
Retrieves a human-readable name for this extension.
|
abstract java.lang.String |
getTaskName()
Retrieves a human-readable name that may be used for this task.
|
void |
initializeTask(DirectoryServerContext serverContext,
com.unboundid.util.args.ArgumentParser parser)
Initializes this task.
|
void |
interruptTask(TaskReturnState interruptState,
java.lang.String interruptReason)
Attempts to interrupt the execution of this task.
|
boolean |
isInterruptible()
Indicates whether this task may be interrupted before it has completed
(e.g., canceled by an administrator or aborted at server shutdown).
|
abstract TaskReturnState |
runTask(TaskContext taskContext)
Performs the appropriate processing for this task.
|
public Task()
initializeTask
method.public abstract java.lang.String getExtensionName()
getExtensionName
in interface UnboundIDExtension
public abstract java.lang.String[] getExtensionDescription()
getExtensionDescription
in interface UnboundIDExtension
null
or an empty array if no description should be available.public void defineConfigArguments(com.unboundid.util.args.ArgumentParser parser) throws com.unboundid.util.args.ArgumentException
defineConfigArguments
in interface Configurable
parser
- The argument parser to be updated with the configuration
arguments which may be used by this extension.com.unboundid.util.args.ArgumentException
- If a problem is encountered while updating the
provided argument parser.public void initializeTask(DirectoryServerContext serverContext, com.unboundid.util.args.ArgumentParser parser) throws com.unboundid.ldap.sdk.LDAPException
serverContext
- A handle to the server context for the server in
which this task is running.parser
- The argument parser which has been initialized from
the configuration for this task.com.unboundid.ldap.sdk.LDAPException
- If a problem occurs while initializing this task.public abstract java.lang.String getTaskName()
public abstract TaskReturnState runTask(TaskContext taskContext)
taskContext
- Information about the task to be run.public boolean isInterruptible()
true
if this task may be interrupted before it has
completed, or false
if it cannot be interrupted.public void interruptTask(TaskReturnState interruptState, java.lang.String interruptReason)
isInterruptible()
method returns true
.interruptState
- The return state that should be used for the task
if it is successfully interrupted.interruptReason
- A message that provides a reason that the task has
been interrupted.public java.util.Map<java.util.List<java.lang.String>,java.lang.String> getExamplesArgumentSets()
getExamplesArgumentSets
in interface ExampleUsageProvider
null
or empty if there should
not be any example argument sets.