From bdeda8fee4678025697882f4a8529bf57cb18cb5 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 17 Sep 2010 22:54:11 +0000
Subject: [PATCH] Split some of the parameters of the task schedule interaction in two: those who are always required and do not have a possible default and those who have a default value and can be optionally set.

---
 opends/src/server/org/opends/server/tools/tasks/TaskScheduleInteraction.java |   51 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/tasks/TaskScheduleInteraction.java b/opends/src/server/org/opends/server/tools/tasks/TaskScheduleInteraction.java
index acd57c0..8b8c263 100644
--- a/opends/src/server/org/opends/server/tools/tasks/TaskScheduleInteraction.java
+++ b/opends/src/server/org/opends/server/tools/tasks/TaskScheduleInteraction.java
@@ -37,6 +37,7 @@
 import java.util.List;
 
 import org.opends.messages.Message;
+import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
 import org.opends.quicksetup.util.ProgressMessageFormatter;
 import org.opends.server.admin.client.cli.TaskScheduleArgs;
 import org.opends.server.backends.task.FailedDependencyAction;
@@ -64,8 +65,10 @@
   private final TaskScheduleArgs args;
   private final ConsoleApplication app;
   private final Message taskName;
-  private final List<? extends TaskEntry> taskEntries;
-  private final ProgressMessageFormatter formatter;
+  private List<? extends TaskEntry> taskEntries =
+    Collections.emptyList();
+  private ProgressMessageFormatter formatter =
+    new PlainTextProgressMessageFormatter();
 
   /**
    * The enumeration used by the menu displayed to ask the user about the
@@ -103,21 +106,16 @@
    * @param args the object with the arguments provided by the user.  The code
    * assumes that the arguments have already been parsed.
    * @param app the console application object used to prompt for data.
-   * @param formatter the formatter to be used to generated the messages.
-   * @param taskEntries the list of task entries defined in the server.
    * @param taskName the name of the task to be used in the prompt messages.
    */
   public TaskScheduleInteraction(TaskScheduleUserData uData,
       TaskScheduleArgs args, ConsoleApplication app,
-      ProgressMessageFormatter formatter, List<? extends TaskEntry> taskEntries,
       Message taskName)
   {
     this.uData = uData;
     this.args = args;
     this.app = app;
     this.taskName = taskName;
-    this.taskEntries = taskEntries;
-    this.formatter = formatter;
   }
 
   /**
@@ -142,6 +140,45 @@
     }
   }
 
+  /**
+   * Returns the task entries that are defined in the server.  These are
+   * used to prompt the user about the task dependencies.
+   * @return the task entries that are defined in the server.
+   */
+  public List<? extends TaskEntry> getTaskEntries()
+  {
+    return taskEntries;
+  }
+
+  /**
+   * Sets the task entries that are defined in the server.  These are
+   * used to prompt the user about the task dependencies.  If no task entries
+   * are provided, the user will not be prompted for task dependencies.
+   * @param taskEntries the task entries that are defined in the server.
+   */
+  public void setTaskEntries(List<? extends TaskEntry> taskEntries)
+  {
+    this.taskEntries = taskEntries;
+  }
+
+  /**
+   * Returns the formatter that is used to generate messages.
+   * @return the formatter that is used to generate messages.
+   */
+  public ProgressMessageFormatter getFormatter()
+  {
+    return formatter;
+  }
+
+  /**
+   * Sets the formatter that is used to generate messages.
+   * @param formatter the formatter that is used to generate messages.
+   */
+  public void setFormatter(ProgressMessageFormatter formatter)
+  {
+    this.formatter = formatter;
+  }
+
   private void runFailedDependencyAction() throws CLIException
   {
     if (args.dependencyArg.isPresent())

--
Gitblit v1.10.0