public abstract class TaskTool extends com.forgerock.opendj.cli.ConsoleApplication 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.
|
Modifier | Constructor and Description |
---|---|
protected |
TaskTool(OutputStream out,
OutputStream err)
Creates a new task tool instance with provided standard and error out streams.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAttribute(List<RawAttribute> attributes,
String attrName,
com.forgerock.opendj.cli.Argument argument)
Adds the provided attribute with the argument value to the provided list if the argument has has been provided on
the command line.
|
protected void |
addAttributeIfArgumentPresent(List<RawAttribute> attributes,
String attrName,
com.forgerock.opendj.cli.Argument argument)
Adds the provided attribute with the argument value to the provided list if the argument corresponding to the
attribute has been provided on the command line.
|
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(boolean initializeServer)
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)
Called when this utility should perform its actions locally in this JVM.
|
protected 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.
|
askConfirmation, askPort, confirmAction, enableConsoleLoggingIfVerbose, errPrint, errPrintln, errPrintln, errPrintln, errPrintlnSurroundedByBlankLines, errPrintVerboseMessage, flushLogStream, getErrorStream, getErrStream, getInputStream, getOutputStream, isInteractive, isMenuDrivenMode, isPromptingForTrust, isQuiet, isScriptFriendly, isVerbose, logVerboseMessage, pressReturnToContinue, print, println, println, println, println, printlnNoWrap, printlnSurroundedByBlankLines, printNoWrap, printProgressBar, printVerboseMessage, readInput, readInput, readInputAllowEmpty, readLineOfInput, readPassword, readPassword, readPort, readValidatedInput, readValidatedInput, report, run
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTaskAttributes, getTaskClass, getTaskId, getTaskObjectclass
public static final String NOW
protected TaskTool(OutputStream out, OutputStream err)
Provided OutputStream
s will be wrapped as PrintStream
.
out
- The output stream (may be null
).err
- The error stream (may be null
).protected abstract int processLocal(boolean initializeServer)
initializeServer
- indicates whether to initialize the directory server in the case of a local actionprotected 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(boolean initializeServer)
initializeServer
- indicates whether to initialize the directory server in the case of a local actionprotected 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 mismatchprotected void addAttributeIfArgumentPresent(List<RawAttribute> attributes, String attrName, com.forgerock.opendj.cli.Argument argument)
attributes
- The attribute list to updateattrName
- The attribute corresponding to the argumentargument
- The argument representing the attributeprotected void addAttribute(List<RawAttribute> attributes, String attrName, com.forgerock.opendj.cli.Argument argument)
attributes
- The attribute list to updateattrName
- The attribute corresponding to the argumentargument
- The argument representing the attributeCopyright 2010-2020 ForgeRock AS.