From 1b9f39db0f5450de6c3bb97cec681c342fff5944 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Tue, 08 Dec 2009 10:52:42 +0000
Subject: [PATCH] Move Message/MessageBuilder/LocalizableException/LocalizableIllegalArgumentException to public API since other public API elements reference them. Prefix Message/MessageBuilder with Localizable to emphasize that these classes are I18N related and not protocol messages. Keep MessageDescriptor private since users should not need access to it for now.

---
 sdk/src/com/sun/opends/sdk/tools/Utils.java |   42 +++++++++++++++++++-----------------------
 1 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/sdk/src/com/sun/opends/sdk/tools/Utils.java b/sdk/src/com/sun/opends/sdk/tools/Utils.java
index ed04169..bc17110 100644
--- a/sdk/src/com/sun/opends/sdk/tools/Utils.java
+++ b/sdk/src/com/sun/opends/sdk/tools/Utils.java
@@ -36,15 +36,11 @@
 import java.io.IOException;
 import java.util.StringTokenizer;
 
-import org.opends.sdk.ByteString;
-import org.opends.sdk.Connection;
-import org.opends.sdk.DecodeException;
-import org.opends.sdk.ErrorResultException;
+import org.opends.sdk.*;
 import org.opends.sdk.AuthenticatedConnectionFactory.AuthenticatedConnection;
 import org.opends.sdk.controls.*;
 import org.opends.sdk.responses.BindResult;
 
-import com.sun.opends.sdk.util.Message;
 import com.sun.opends.sdk.util.StaticUtils;
 
 
@@ -106,9 +102,9 @@
    *          there is a suitable breaking point.
    * @return The wrapped text.
    */
-  static String wrapText(Message message, int width)
+  static String wrapText(LocalizableMessage message, int width)
   {
-    return wrapText(Message.toString(message), width, 0);
+    return wrapText(message.toString(), width, 0);
   }
 
 
@@ -152,9 +148,9 @@
    *          The number of columns to indent each line.
    * @return The wrapped text.
    */
-  static String wrapText(Message message, int width, int indent)
+  static String wrapText(LocalizableMessage message, int width, int indent)
   {
-    return wrapText(Message.toString(message), width, indent);
+    return wrapText(message.toString(), width, indent);
   }
 
 
@@ -412,7 +408,7 @@
       else
       {
         // TODO: I18N
-        throw DecodeException.error(Message
+        throw DecodeException.error(LocalizableMessage
             .raw("Invalid format for criticality value:" + remainder));
       }
       return new GenericControl(controlOID, controlCriticality);
@@ -431,7 +427,7 @@
     else
     {
       // TODO: I18N
-      throw DecodeException.error(Message
+      throw DecodeException.error(LocalizableMessage
           .raw("Invalid format for criticality value:" + critical));
     }
 
@@ -532,7 +528,7 @@
     // if ((ere.getMessage() != null) && (ere.getMessage().length() >
     // 0))
     // {
-    // app.println(Message.raw(ere.getMessage()));
+    // app.println(LocalizableMessage.raw(ere.getMessage()));
     // }
 
     if (ere.getResult().getResultCode().intValue() >= 0)
@@ -577,7 +573,7 @@
    * @return The user-friendly representation of the specified number of
    *         seconds.
    */
-  static Message secondsToTimeString(int numSeconds)
+  static LocalizableMessage secondsToTimeString(int numSeconds)
   {
     if (numSeconds < 60)
     {
@@ -625,7 +621,7 @@
       if (control != null)
       {
         AuthorizationIdentityControl.Response dc = (AuthorizationIdentityControl.Response) control;
-        Message message = INFO_BIND_AUTHZID_RETURNED.get(dc
+        LocalizableMessage message = INFO_BIND_AUTHZID_RETURNED.get(dc
             .getAuthorizationID());
         app.println(message);
       }
@@ -633,7 +629,7 @@
           .getControl(PasswordExpiredControl.OID_NS_PASSWORD_EXPIRED);
       if (control != null)
       {
-        Message message = INFO_BIND_PASSWORD_EXPIRED.get();
+        LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRED.get();
         app.println(message);
       }
       control = result
@@ -641,9 +637,9 @@
       if (control != null)
       {
         PasswordExpiringControl dc = (PasswordExpiringControl) control;
-        Message timeString = Utils.secondsToTimeString(dc
+        LocalizableMessage timeString = Utils.secondsToTimeString(dc
             .getSecondsUntilExpiration());
-        Message message = INFO_BIND_PASSWORD_EXPIRING.get(timeString);
+        LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRING.get(timeString);
         app.println(message);
       }
       control = result
@@ -654,32 +650,32 @@
         PasswordPolicyErrorType errorType = dc.getErrorType();
         if (errorType == PasswordPolicyErrorType.PASSWORD_EXPIRED)
         {
-          Message message = INFO_BIND_PASSWORD_EXPIRED.get();
+          LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRED.get();
           app.println(message);
         }
         else if (errorType == PasswordPolicyErrorType.ACCOUNT_LOCKED)
         {
-          Message message = INFO_BIND_ACCOUNT_LOCKED.get();
+          LocalizableMessage message = INFO_BIND_ACCOUNT_LOCKED.get();
           app.println(message);
         }
         else if (errorType == PasswordPolicyErrorType.CHANGE_AFTER_RESET)
         {
 
-          Message message = INFO_BIND_MUST_CHANGE_PASSWORD.get();
+          LocalizableMessage message = INFO_BIND_MUST_CHANGE_PASSWORD.get();
           app.println(message);
         }
 
         PasswordPolicyWarningType warningType = dc.getWarningType();
         if (warningType == PasswordPolicyWarningType.TIME_BEFORE_EXPIRATION)
         {
-          Message timeString = Utils.secondsToTimeString(dc
+          LocalizableMessage timeString = Utils.secondsToTimeString(dc
               .getWarningValue());
-          Message message = INFO_BIND_PASSWORD_EXPIRING.get(timeString);
+          LocalizableMessage message = INFO_BIND_PASSWORD_EXPIRING.get(timeString);
           app.println(message);
         }
         else if (warningType == PasswordPolicyWarningType.GRACE_LOGINS_REMAINING)
         {
-          Message message = INFO_BIND_GRACE_LOGINS_REMAINING.get(dc
+          LocalizableMessage message = INFO_BIND_GRACE_LOGINS_REMAINING.get(dc
               .getWarningValue());
           app.println(message);
         }

--
Gitblit v1.10.0