From cfc513043c5830b5a967733066068c7097b42e3c 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.

---
 opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/ParentInheritance.java |   67 ++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/ParentInheritance.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/ParentInheritance.java
index c084ce1..d8d61a5 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/ParentInheritance.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/ParentInheritance.java
@@ -26,10 +26,10 @@
  */
 
 package org.opends.server.authorization.dseecompat;
+import org.opends.messages.Message;
 
-import static org.opends.server.messages.AciMessages.*;
+import static org.opends.messages.AccessControlMessages.*;
 import static org.opends.server.authorization.dseecompat.Aci.*;
-import static org.opends.server.messages.MessageHandler.getMessage;
 import java.util.StringTokenizer;
 import java.util.LinkedHashSet;
 import java.util.regex.Pattern;
@@ -103,20 +103,19 @@
         if (skipParse) {
             //The "parent[" pattern is invalid for ROLEDN user attr keyword.
             if(pattern.startsWith(parentPat)) {
-                int msgID =
-                   MSGID_ACI_SYNTAX_INVALID_USERATTR_ROLEDN_INHERITANCE_PATTERN;
-                String message = getMessage(msgID, pattern);
-                throw new AciException(msgID, message);
+                Message message =
+                  WARN_ACI_SYNTAX_INVALID_USERATTR_ROLEDN_INHERITANCE_PATTERN
+                          .get(pattern);
+                throw new AciException(message);
             }  else {
                 pattern=pattern.trim();
                 Pattern pattern1=Pattern.compile(ATTR_NAME);
                 Matcher matcher=pattern1.matcher(pattern);
                //Check if valid attribute type name.
                if(!matcher.find() || matcher.groupCount() != 1) {
-                int msgID =
-                        MSGID_ACI_SYNTAX_INVALID_ATTRIBUTE_TYPE_NAME;
-                String message = getMessage(msgID, pattern);
-                throw new AciException(msgID, message);
+                Message message =
+                    WARN_ACI_SYNTAX_INVALID_ATTRIBUTE_TYPE_NAME.get(pattern);
+                throw new AciException(message);
                }
                if((this.attributeType =
                     DirectoryServer.getAttributeType(pattern)) == null)
@@ -149,19 +148,18 @@
              */
             String[] toks=p.split("\\.");
             if(toks.length != 2) {
-                int msgID =
-                    MSGID_ACI_SYNTAX_INVALID_USERATTR_INHERITANCE_PATTERN;
-                String message = getMessage(msgID, pattern);
-                throw new AciException(msgID, message);
+                Message message =
+                  WARN_ACI_SYNTAX_INVALID_USERATTR_INHERITANCE_PATTERN
+                          .get(pattern);
+                throw new AciException(message);
             }
             Pattern pattern1=Pattern.compile(ATTR_NAME);
             Matcher matcher=pattern1.matcher(toks[1]);
             //Check if valid attribute type name.
             if(!matcher.find() || matcher.groupCount() != 1) {
-                int msgID =
-                    MSGID_ACI_SYNTAX_INVALID_ATTRIBUTE_TYPE_NAME;
-                String message = getMessage(msgID, toks[1]);
-                throw new AciException(msgID, message);
+                Message message =
+                    WARN_ACI_SYNTAX_INVALID_ATTRIBUTE_TYPE_NAME.get(toks[1]);
+                throw new AciException(message);
             }
             if((this.attributeType =
                 DirectoryServer.getAttributeType(toks[1])) == null)
@@ -179,16 +177,15 @@
                     if(numLevels < MAX_LEVELS) {
                         levels[numLevels++]=Integer.decode(v);
                     } else {
-                        int msgID =
-                      MSGID_ACI_SYNTAX_MAX_USERATTR_INHERITANCE_LEVEL_EXCEEDED;
-                        String message = getMessage(msgID, pattern,
-                                               Integer.toString(MAX_LEVELS));
-                        throw new AciException(msgID, message);
+                        Message message =
+                        WARN_ACI_SYNTAX_MAX_USERATTR_INHERITANCE_LEVEL_EXCEEDED.
+                              get(pattern, Integer.toString(MAX_LEVELS));
+                        throw new AciException(message);
                     }
                 } catch (NumberFormatException ex) {
-                    int msgID = MSGID_ACI_SYNTAX_INVALID_INHERITANCE_VALUE;
-                    String message = getMessage(msgID, pattern);
-                    throw new AciException(msgID, message);
+                    Message message =
+                        WARN_ACI_SYNTAX_INVALID_INHERITANCE_VALUE.get(pattern);
+                    throw new AciException(message);
                 }
             }
         } else {
@@ -198,21 +195,21 @@
               LDAPURL url=LDAPURL.decode(pattern, true);
               LinkedHashSet<String>attrs=url.getAttributes();
               if(attrs.size() != 1) {
-                int msgID = MSGID_ACI_SYNTAX_INVALID_USERATTR_ATTR_URL;
-                String message = getMessage(msgID, pattern);
-                throw new AciException(msgID, message);
+                Message message =
+                    WARN_ACI_SYNTAX_INVALID_USERATTR_ATTR_URL.get(pattern);
+                throw new AciException(message);
               }
               baseDN=url.getBaseDN();
               if(baseDN.isNullDN()){
-                int msgID = MSGID_ACI_SYNTAX_INVALID_USERATTR_BASEDN_URL;
-                String message = getMessage(msgID, pattern);
-                throw new AciException(msgID, message);
+                Message message =
+                    WARN_ACI_SYNTAX_INVALID_USERATTR_BASEDN_URL.get(pattern);
+                throw new AciException(message);
               }
               attrTypeStr=attrs.iterator().next();
             } catch (DirectoryException ex) {
-              int msgID = MSGID_ACI_SYNTAX_INVALID_USERATTR_URL;
-              String message = getMessage(msgID, ex.getErrorMessage());
-              throw new AciException(msgID, message);
+              Message message = WARN_ACI_SYNTAX_INVALID_USERATTR_URL.get(
+                  ex.getMessageObject());
+              throw new AciException(message);
             }
           }
           if((this.attributeType =

--
Gitblit v1.10.0