public abstract class TaskTool extends Object implements TaskScheduleInformation
Modifier and Type | Field and Description |
---|---|
static String |
NOW
Magic value used to indicate that the user would like to schedule
this operation to run immediately as a task as opposed to running
the operation in the local VM.
|
Constructor and Description |
---|
TaskTool() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkVersion()
Checks that binary version and instance version are the same.
|
protected void |
cleanup()
Cleanup task environment after offline run.
|
protected LDAPConnectionArgumentParser |
createArgParser(String className,
LocalizableMessage toolDescription)
Creates an argument parser prepopulated with arguments for processing
input for scheduling tasks with the task backend.
|
List<String> |
getDependencyIds()
Gets a list of task IDs upon which this task is dependent.
|
FailedDependencyAction |
getFailedDependencyAction()
Gets the action to take should one of the dependent task fail.
|
List<String> |
getNotifyUponCompletionEmailAddresses()
Gets a list of email address to which an email will be sent when this
task completes.
|
List<String> |
getNotifyUponErrorEmailAddresses()
Gets a list of email address to which an email will be sent if this
task encounters an error during execution.
|
String |
getRecurringDateTime()
Gets the date/time pattern for recurring task schedule.
|
Date |
getStartDateTime()
Gets the date at which this task should be scheduled to start.
|
protected boolean |
isEmbedded()
Returns
true if the tool is running in embedded mode. |
protected int |
process(LDAPConnectionArgumentParser argParser,
boolean initializeServer,
PrintStream out,
PrintStream err)
Either invokes initiates this tool's local action or schedule this
tool using the tasks interface based on user input.
|
protected abstract int |
processLocal(boolean initializeServer,
PrintStream out,
PrintStream err)
Called when this utility should perform its actions locally in this
JVM.
|
boolean |
runOffline()
Indicates whether we must return if the command must be run in off-line
mode.
|
protected void |
validateTaskArgs()
Validates arguments related to task scheduling.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTaskAttributes, getTaskClass, getTaskId, getTaskObjectclass
public static final String NOW
public TaskTool()
protected abstract int processLocal(boolean initializeServer, PrintStream out, PrintStream err)
initializeServer
- indicates whether to initialize the
directory server in the case of a local actionout
- stream to write messages; may be nullerr
- stream to write messages; may be nullprotected void cleanup()
protected LDAPConnectionArgumentParser createArgParser(String className, LocalizableMessage toolDescription)
className
- of this tooltoolDescription
- of this toolprotected void validateTaskArgs() throws com.forgerock.opendj.cli.ArgumentException, com.forgerock.opendj.cli.ClientException
ArgumentParser.parseArguments
has
been called.com.forgerock.opendj.cli.ArgumentException
- if there is a problem with the arguments.com.forgerock.opendj.cli.ClientException
- if there is a problem with one of the values provided
by the user.public Date getStartDateTime()
TaskScheduleInformation
getStartDateTime
in interface TaskScheduleInformation
public String getRecurringDateTime()
TaskScheduleInformation
getRecurringDateTime
in interface TaskScheduleInformation
public List<String> getDependencyIds()
TaskScheduleInformation
getDependencyIds
in interface TaskScheduleInformation
public FailedDependencyAction getFailedDependencyAction()
TaskScheduleInformation
getFailedDependencyAction
in interface TaskScheduleInformation
public List<String> getNotifyUponCompletionEmailAddresses()
TaskScheduleInformation
getNotifyUponCompletionEmailAddresses
in interface TaskScheduleInformation
public List<String> getNotifyUponErrorEmailAddresses()
TaskScheduleInformation
getNotifyUponErrorEmailAddresses
in interface TaskScheduleInformation
protected int process(LDAPConnectionArgumentParser argParser, boolean initializeServer, PrintStream out, PrintStream err)
argParser
- used to parse user argumentsinitializeServer
- indicates whether to initialize the
directory server in the case of a local actionout
- stream to write messages; may be nullerr
- stream to write messages; may be nullpublic boolean runOffline()
true
if we must return if the command must be run in
off-line mode and false
otherwise.protected boolean isEmbedded()
true
if the tool is running in embedded mode.
Embedded mode would not change JDK logging configuration and will used running jvm slf4j loggers implementation
true
if the tool is running in embedded mode.protected void checkVersion() throws InitializationException
InitializationException
- If versions mismatchCopyright © 2010-2017 ForgeRock AS. All Rights Reserved.