From 8f434776744e26ae11fe4d7e395837f62461dc59 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Wed, 29 Jan 2014 11:57:22 +0000
Subject: [PATCH] OPENDJ-1303 Split out CLI support from opendj-ldap-toolkit into a separate Maven module, "opendj-cli" - Add dependency to opendj-cli module. - Classes modified in order to take into account this change. - Fixed comments.

---
 opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java |   38 ++++++++++++++++++++++----------------
 1 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java
index edfacb8..091c644 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java
@@ -21,14 +21,13 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2012-2013 ForgeRock AS
+ *      Copyright 2012-2014 ForgeRock AS
  */
-
 package com.forgerock.opendj.ldap.tools;
 
-import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
+import static com.forgerock.opendj.cli.CliConstants.*;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
-import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
+import static com.forgerock.opendj.cli.Utils.filterExitCode;
 
 import java.io.BufferedReader;
 import java.io.FileInputStream;
@@ -54,6 +53,15 @@
 import org.forgerock.opendj.ldif.LDIFEntryReader;
 import org.forgerock.opendj.ldif.LDIFEntryWriter;
 
+import com.forgerock.opendj.cli.ArgumentException;
+import com.forgerock.opendj.cli.ArgumentParser;
+import com.forgerock.opendj.cli.BooleanArgument;
+import com.forgerock.opendj.cli.CommonArguments;
+import com.forgerock.opendj.cli.ConsoleApplication;
+import com.forgerock.opendj.cli.IntegerArgument;
+import com.forgerock.opendj.cli.MultiChoiceArgument;
+import com.forgerock.opendj.cli.StringArgument;
+
 /**
  * This utility can be used to perform search operations against data in an LDIF
  * file.
@@ -76,8 +84,8 @@
     }
 
     private int run(final String[] args) {
-        // Create the command-line argument parser for use with this
-        // program.
+        /* Create the command-line argument parser for use with this
+         program.*/
 
         final LocalizableMessage toolDescription = INFO_LDIFSEARCH_TOOL_DESCRIPTION.get();
         final ArgumentParser argParser =
@@ -144,9 +152,7 @@
             timeLimit.setPropertyName("timeLimit");
             argParser.addArgument(timeLimit);
 
-            showUsage =
-                    new BooleanArgument("showUsage", OPTION_SHORT_HELP, OPTION_LONG_HELP,
-                            INFO_DESCRIPTION_SHOWUSAGE.get());
+            showUsage = CommonArguments.getShowUsage();
             argParser.addArgument(showUsage);
             argParser.setUsageArgument(showUsage, getOutputStream());
         } catch (final ArgumentException ae) {
@@ -159,8 +165,8 @@
         try {
             argParser.parseArguments(args);
 
-            // If we should just display usage or version information,
-            // then print it and exit.
+            /* If we should just display usage or version information,
+             then print it and exit.*/
             if (argParser.usageOrVersionDisplayed()) {
                 return ResultCode.SUCCESS.intValue();
             }
@@ -177,11 +183,11 @@
             final List<String> filterAndAttributeStrings =
                     trailingArguments.subList(1, trailingArguments.size());
 
-            // the list of trailing arguments should be structured as follow:
-            // - If a filter file is present, trailing arguments are
-            // considered as attributes
-            // - If filter file is not present, the first trailing argument is
-            // considered the filter, the other as attributes.
+            /* The list of trailing arguments should be structured as follow:
+             - If a filter file is present, trailing arguments are
+             considered as attributes
+             - If filter file is not present, the first trailing argument is
+             considered the filter, the other as attributes.*/
             if (!filename.isPresent()) {
                 final String filterString = filterAndAttributeStrings.remove(0);
                 try {

--
Gitblit v1.10.0