From 802263ae38d5d54acdd4945dbbce39c5f6bd26eb Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Mon, 23 Jul 2007 17:55:12 +0000
Subject: [PATCH] Fix issue 1819: add support for tagging properties as advanced.

---
 opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
index ad503d5..a82d0d6 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
@@ -482,6 +482,11 @@
   }
 
   /**
+   * The value for the long option advanced.
+   */
+  private static final String OPTION_DSCFG_LONG_ADVANCED = "advanced";
+
+  /**
    * The value for the long option property.
    */
   private static final String OPTION_DSCFG_LONG_PROPERTY = "property";
@@ -502,6 +507,11 @@
   private static final String OPTION_DSCFG_LONG_UNIT_TIME = "unit-time";
 
   /**
+   * The value for the short option advanced.
+   */
+  private static final Character OPTION_DSCFG_SHORT_ADVANCED = null;
+
+  /**
    * The value for the short option property.
    */
   private static final Character OPTION_DSCFG_SHORT_PROPERTY = null;
@@ -521,6 +531,9 @@
    */
   private static final char OPTION_DSCFG_SHORT_UNIT_TIME = 'M';
 
+  // The argument which should be used to request advanced mode.
+  private BooleanArgument advancedModeArgument;
+
   // The argument which should be used to specify zero or more
   // property names.
   private StringArgument propertyArgument;
@@ -809,6 +822,22 @@
 
 
   /**
+   * Determines whether the user requested advanced mode.
+   *
+   * @return Returns <code>true</code> if the user requested
+   *         advanced mode.
+   */
+  protected final boolean isAdvancedMode() {
+    if (advancedModeArgument != null) {
+      return advancedModeArgument.isPresent();
+    } else {
+      return false;
+    }
+  }
+
+
+
+  /**
    * Determines whether the user requested record-mode.
    *
    * @return Returns <code>true</code> if the user requested
@@ -825,6 +854,29 @@
 
 
   /**
+   * Registers the advanced mode argument with the sub-command.
+   *
+   * @param subCommand
+   *          The sub-command.
+   * @param descriptionID
+   *          The usage description message ID to be used for the
+   *          argument.
+   * @param args
+   *          The arguments for the usage description.
+   * @throws ArgumentException
+   *           If the advanced mode argument could not be registered.
+   */
+  protected final void registerAdvancedModeArgument(SubCommand subCommand,
+      int descriptionID, String... args) throws ArgumentException {
+    this.advancedModeArgument = new BooleanArgument(OPTION_DSCFG_LONG_ADVANCED,
+        OPTION_DSCFG_SHORT_ADVANCED, OPTION_DSCFG_LONG_ADVANCED, descriptionID,
+        (Object[]) args);
+    subCommand.addArgument(advancedModeArgument);
+  }
+
+
+
+  /**
    * Registers the property name argument with the sub-command.
    *
    * @param subCommand

--
Gitblit v1.10.0