From 80c58327faaa4873369f6bb949e62792c2f708e0 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Wed, 15 Aug 2007 21:34:53 +0000
Subject: [PATCH] This commit is a step toward getting OpenDS internationalized. There are still issues to be resolved before we can declare that we are internationalized but this commit covers the bulk of changes needed at this time.

---
 opends/src/server/org/opends/server/util/args/FileBasedArgument.java |   51 ++++++++++++++++++++++++---------------------------
 1 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/opends/src/server/org/opends/server/util/args/FileBasedArgument.java b/opends/src/server/org/opends/server/util/args/FileBasedArgument.java
index 909bc45..9e57c9a 100644
--- a/opends/src/server/org/opends/server/util/args/FileBasedArgument.java
+++ b/opends/src/server/org/opends/server/util/args/FileBasedArgument.java
@@ -25,6 +25,7 @@
  *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  */
 package org.opends.server.util.args;
+import org.opends.messages.Message;
 
 
 
@@ -33,8 +34,8 @@
 import java.io.FileReader;
 import java.util.LinkedHashMap;
 
-import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.messages.UtilityMessages.*;
+import static org.opends.messages.UtilityMessages.*;
+import org.opends.messages.MessageBuilder;
 import static org.opends.server.util.StaticUtils.*;
 
 
@@ -78,22 +79,20 @@
    *                           be displayed in usage information, or
    *                           <CODE>null</CODE> if this argument does not
    *                           require a value.
-   * @param  descriptionID     The unique ID of the description for this
+   * @param  description       Message for the description of this
    *                           argument.
-   * @param  descriptionArgs   The arguments that are to be used when generating
-   *                           the description for this argument.
    *
    * @throws  ArgumentException  If there is a problem with any of the
    *                             parameters used to create this argument.
    */
   public FileBasedArgument(String name, Character shortIdentifier,
                            String longIdentifier, boolean isRequired,
-                           String valuePlaceholder, int descriptionID,
-                           Object... descriptionArgs)
+                           String valuePlaceholder,
+                           Message description)
          throws ArgumentException
   {
     super(name, shortIdentifier, longIdentifier, isRequired, false, true,
-          valuePlaceholder, null, null, descriptionID, descriptionArgs);
+          valuePlaceholder, null, null, description);
 
 
     namesToValues = new LinkedHashMap<String,String>();
@@ -125,10 +124,8 @@
    * @param  propertyName      The name of the property in a property file that
    *                           may be used to override the default value but
    *                           will be overridden by a command-line argument.
-   * @param  descriptionID     The unique ID of the description for this
+   * @param  description       Message for the description of this
    *                           argument.
-   * @param  descriptionArgs   The arguments that are to be used when generating
-   *                           the description for this argument.
    *
    * @throws  ArgumentException  If there is a problem with any of the
    *                             parameters used to create this argument.
@@ -137,12 +134,12 @@
                            String longIdentifier, boolean isRequired,
                            boolean isMultiValued, String valuePlaceholder,
                            String defaultValue, String propertyName,
-                           int descriptionID, Object... descriptionArgs)
+                           Message description)
          throws ArgumentException
   {
     super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued,
           true, valuePlaceholder, defaultValue, propertyName,
-          descriptionID, descriptionArgs);
+          description);
 
     namesToValues = new LinkedHashMap<String,String>();
   }
@@ -175,7 +172,7 @@
    *          <CODE>false</CODE> if it is not.
    */
   public boolean valueIsAcceptable(String valueString,
-                                   StringBuilder invalidReason)
+                                   MessageBuilder invalidReason)
   {
     // First, make sure that the specified file exists.
     File valueFile;
@@ -184,16 +181,16 @@
       valueFile = new File(valueString);
       if (! valueFile.exists())
       {
-        int msgID = MSGID_FILEARG_NO_SUCH_FILE;
-        invalidReason.append(getMessage(msgID, valueString, getName()));
+        invalidReason.append(ERR_FILEARG_NO_SUCH_FILE.get(
+                valueString, getName()));
         return false;
       }
     }
     catch (Exception e)
     {
-      int msgID = MSGID_FILEARG_CANNOT_VERIFY_FILE_EXISTENCE;
-      invalidReason.append(getMessage(msgID, valueString, getName(),
-                                      getExceptionMessage(e)));
+      invalidReason.append(ERR_FILEARG_CANNOT_VERIFY_FILE_EXISTENCE.get(
+              valueString, getName(),
+              getExceptionMessage(e)));
       return false;
     }
 
@@ -206,9 +203,9 @@
     }
     catch (Exception e)
     {
-      int msgID = MSGID_FILEARG_CANNOT_OPEN_FILE;
-      invalidReason.append(getMessage(msgID, valueString, getName(),
-                                      getExceptionMessage(e)));
+      invalidReason.append(ERR_FILEARG_CANNOT_OPEN_FILE.get(
+              valueString, getName(),
+              getExceptionMessage(e)));
       return false;
     }
 
@@ -221,9 +218,9 @@
     }
     catch (Exception e)
     {
-      int msgID = MSGID_FILEARG_CANNOT_READ_FILE;
-      invalidReason.append(getMessage(msgID, valueString, getName(),
-                                      getExceptionMessage(e)));
+      invalidReason.append(ERR_FILEARG_CANNOT_READ_FILE.get(
+              valueString, getName(),
+              getExceptionMessage(e)));
       return false;
     }
     finally
@@ -238,8 +235,8 @@
     // If the line read is null, then that means the file was empty.
     if (line == null)
     {
-      int msgID = MSGID_FILEARG_EMPTY_FILE;
-      invalidReason.append(getMessage(msgID, valueString, getName()));
+
+      invalidReason.append(ERR_FILEARG_EMPTY_FILE.get(valueString, getName()));
       return false;
     }
 

--
Gitblit v1.10.0