directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r919794 - in /directory/shared/trunk: i18n/src/main/java/org/apache/directory/shared/i18n/ i18n/src/main/resources/org/apache/directory/shared/i18n/ ldap-constants/ ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/ ld...
Date Sat, 06 Mar 2010 16:05:58 GMT
Author: felixk
Date: Sat Mar  6 16:05:57 2010
New Revision: 919794

URL: http://svn.apache.org/viewvc?rev=919794&view=rev
Log:
DIRSHARED-49 (i18n)

Next part

More to follow

Modified:
    directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
    directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
    directory/shared/trunk/ldap-constants/pom.xml
    directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/AuthenticationLevel.java
    directory/shared/trunk/ldap-convert/pom.xml
    directory/shared/trunk/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java
    directory/shared/trunk/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java
    directory/shared/trunk/ldap-schema-loader/pom.xml
    directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java
    directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
    directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java
    directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java
    directory/shared/trunk/ldap-schema/pom.xml
    directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java

Modified: directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java (original)
+++ directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java Sat
Mar  6 16:05:57 2010
@@ -586,46 +586,60 @@
 
 	// ldap-constants
 	public static final String ERR_05001 = "ERR_05001";
-	public static final String ERR_05002 = "ERR_05002";
-	public static final String ERR_05003 = "ERR_05003";
-	public static final String ERR_05004 = "ERR_05004";
-	public static final String ERR_05005 = "ERR_05005";
-	public static final String ERR_05006 = "ERR_05006";
-	public static final String ERR_05007 = "ERR_05007";
-	public static final String ERR_05008 = "ERR_05008";
-	public static final String ERR_05009 = "ERR_05009";
-	public static final String ERR_05010 = "ERR_05010";
-	public static final String ERR_05011 = "ERR_05011";
-	public static final String ERR_05012 = "ERR_05012";
-	public static final String ERR_05013 = "ERR_05013";
-	public static final String ERR_05014 = "ERR_05014";
-	public static final String ERR_05015 = "ERR_05015";
-	public static final String ERR_05016 = "ERR_05016";
-	public static final String ERR_05017 = "ERR_05017";
-	public static final String ERR_05018 = "ERR_05018";
-	public static final String ERR_05019 = "ERR_05019";
-	public static final String ERR_05020 = "ERR_05020";
-	public static final String ERR_05021 = "ERR_05021";
-	public static final String ERR_05022 = "ERR_05022";
-	public static final String ERR_05023 = "ERR_05023";
-	public static final String ERR_05024 = "ERR_05024";
-	public static final String ERR_05025 = "ERR_00025";
-	public static final String ERR_05026 = "ERR_05026";
-	public static final String ERR_05027 = "ERR_05027";
-	public static final String ERR_05028 = "ERR_05028";
-	public static final String ERR_05029 = "ERR_05029";
-	public static final String ERR_05030 = "ERR_05030";
-	public static final String ERR_05031 = "ERR_05031";
-	public static final String ERR_05032 = "ERR_05032";
-	public static final String ERR_05033 = "ERR_05033";
-	public static final String ERR_05034 = "ERR_05034";
-	public static final String ERR_05035 = "ERR_05035";
-	public static final String ERR_05036 = "ERR_05036";
-	public static final String ERR_05037 = "ERR_05037";
-	public static final String ERR_05038 = "ERR_05038";
-	public static final String ERR_05039 = "ERR_05039";
-	public static final String ERR_05040 = "ERR_05040";
 
+	// ldap-converter
+	public static final String ERR_06001 = "ERR_06001";
+	public static final String ERR_06002 = "ERR_06002";
+	public static final String ERR_06003 = "ERR_06003";
+	public static final String ERR_06004 = "ERR_06004";
+	public static final String ERR_06005 = "ERR_06005";
+	public static final String ERR_06006 = "ERR_06006";
+
+	// ldap-jndi
+	// no exceptions to translate
+	
+	// ldap-schema
+	public static final String ERR_08001 = "ERR_08001";
+	public static final String ERR_08002 = "ERR_08002";
+	public static final String ERR_08003 = "ERR_08003";
+	public static final String ERR_08004 = "ERR_08004";
+	public static final String ERR_08005 = "ERR_08005";
+	public static final String ERR_08006 = "ERR_08006";
+	
+	// ldap-schema-dao
+	// no exceptions to translate
+	
+	// ldap-schema-loader
+	public static final String ERR_10001 = "ERR_10001";
+	public static final String ERR_10002 = "ERR_10002";
+	public static final String ERR_10003 = "ERR_10003";
+	public static final String ERR_10004 = "ERR_10004";
+	public static final String ERR_10005 = "ERR_10005";
+	public static final String ERR_10006 = "ERR_10006";
+	public static final String ERR_10007 = "ERR_10007";
+	public static final String ERR_10008 = "ERR_10008";
+	public static final String ERR_10009 = "ERR_10009";
+	public static final String ERR_10010 = "ERR_10010";
+	public static final String ERR_10011 = "ERR_10011";
+	public static final String ERR_10012 = "ERR_10012";
+	public static final String ERR_10013 = "ERR_10013";
+	public static final String ERR_10014 = "ERR_10014";
+	public static final String ERR_10015 = "ERR_10015";
+	public static final String ERR_10016 = "ERR_10016";
+	public static final String ERR_10017 = "ERR_10017";
+	public static final String ERR_10018 = "ERR_10018";
+	public static final String ERR_10019 = "ERR_10019";
+	public static final String ERR_10020 = "ERR_10020";
+	public static final String ERR_10021 = "ERR_10021";
+	public static final String ERR_10022 = "ERR_10022";
+	public static final String ERR_10023 = "ERR_10023";
+	public static final String ERR_10024 = "ERR_10024";
+	public static final String ERR_10025 = "ERR_00025";
+	public static final String ERR_10026 = "ERR_10026";
+	public static final String ERR_10027 = "ERR_10027";
+	public static final String ERR_10028 = "ERR_10028";
+	
+	
 	
     /**
      * 

Modified: directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
(original)
+++ directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
Sat Mar  6 16:05:57 2010
@@ -542,3 +542,56 @@
 ERR_04438=The style must not be null
 ERR_04439=Usage - java org.mortbay.util.UnixCrypt <key> <salt>
 ERR_04440=Crypt={0}
+
+# ldap-constants
+ERR_05001=Unknown AuthenticationLevel {0}
+
+# ldap-converter
+ERR_06001=The schemaObject is either null or is empty!
+ERR_06002=Parser failure on:\n\t{0}\nAntlr exception trace:\n{1}
+ERR_06003={0} the schema configuration element must specify a name.
+ERR_06004=Failed while generating sources for {0}
+ERR_06005=Can't generate a ldif for a null schema
+ERR_06006=the schema property must be set
+
+# ldap-jndi
+# no exception to translate
+ERR_08001=Cannot overwrite yet schema output directory already exists: {0}
+ERR_08002=Cannot copy non-existant source file {0}
+ERR_08003=Cannot have more than one entry in a schema ldif file : {0}
+ERR_08004=Exception occurred while parsing the ldif file {0} : {1}
+ERR_08005=Should not be hitting root without schema/schema pattern.
+ERR_08006=parent cannot be null
+
+# ldap-schema-dao
+# no exceptions to translate
+
+# ldap-schema-loader
+ERR_10001=The attribute must be binary
+ERR_10002=Failed to access attribute bytes.
+ERR_10003=Failed to load schema LDIF file {0}
+ERR_10004=Expecting to find a schema.ldif file in provided baseDirectory path '{0}' but no
such file found.
+ERR_10005={0} entry must have a valid {1} attribute, it's null
+ERR_10006=Comparator OID {0} is not a valid OID 
+ERR_10007={0} entry cannot be null
+ERR_10008={0} Schema description cannot be null
+ERR_10009=The schema {0} does not exists or is not loaded
+ERR_10010=entry cannot be null
+ERR_10011=entry must have a valid cn attribute
+ERR_10012=entry must have a valid {0} attribute
+ERR_10013=Cannot add the SyntaxChecker {0}, as the associated schema ({1}) is not loaded
+ERR_10014=Cannot add the SyntaxChecker {0} into the registries, as the associated schema
({1}) is disabled
+ERR_10015=The Comparator's OID ({0}) is different from the loaded class' OID ({1})
+ERR_10016=Cannot add the Comparator {0}, as the associated schema ({1}) is not loaded
+ERR_10017=Cannot add the Comparator {0} into the registries, as the associated schema ({1})
is disabled
+ERR_10018=Cannot add the Normalizer {0}, as the associated schema ({1}) is not loaded
+ERR_10019=Cannot add the Normalizer {0} into the registries, as the associated schema ({1})
is disabled
+ERR_10020=Cannot add the Syntax {0}, as the associated schema ({1}) is not loaded
+ERR_10021=Cannot add the SyntaxChecker {0} into the registries, as the associated schema
({1}) is disabled
+ERR_10022=Cannot add the MatchingRule {0}, as the associated schema ({1}) is not loaded
+ERR_10023=Cannot add the MatchingRule {0} into the registries, as the associated schema ({1})
is disabled
+ERR_10024=Cannot add the ObjectClass {0}, as the associated schema ({1}) is not loaded
+ERR_10025=Cannot add the ObjectClass {0} into the registries, as the associated schema ({1})
is disabled
+ERR_10026=Cannot add the AttributeType {0}, as the associated schema ({1}) is not loaded
+ERR_10027=Cannot add the AttributeType {0} into the registries, as the associated schema
({1}) is disabled
+ERR_10028={0} entry must have a valid {1} attribute

Modified: directory/shared/trunk/ldap-constants/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-constants/pom.xml?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-constants/pom.xml (original)
+++ directory/shared/trunk/ldap-constants/pom.xml Sat Mar  6 16:05:57 2010
@@ -39,5 +39,13 @@
   <description>
     Common LDAP constants used by clients and servers.
   </description>
+  
+  <dependencies>
+    <dependency>
+      <artifactId>shared-i18n</artifactId>
+      <groupId>${groupId}</groupId>
+      <version>${version}</version>
+    </dependency>  
+  </dependencies>
 </project>
 

Modified: directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/AuthenticationLevel.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/AuthenticationLevel.java?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/AuthenticationLevel.java
(original)
+++ directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/AuthenticationLevel.java
Sat Mar  6 16:05:57 2010
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.shared.ldap.constants;
 
+import org.apache.directory.shared.i18n.I18n;
+
 
 /**
  * An enumeration that represents the level of authentication.
@@ -100,7 +102,7 @@
             case 3: return UNAUTHENT;
             
             default:
-                throw new IllegalArgumentException( "Unknown AuthenticationLevel " + val
);
+                throw new IllegalArgumentException( I18n.err(I18n.ERR_05001, val ) );
         }
     }
 }

Modified: directory/shared/trunk/ldap-convert/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-convert/pom.xml?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-convert/pom.xml (original)
+++ directory/shared/trunk/ldap-convert/pom.xml Sat Mar  6 16:05:57 2010
@@ -42,6 +42,12 @@
 
   <dependencies>
     <dependency>
+      <artifactId>shared-i18n</artifactId>
+      <groupId>${groupId}</groupId>
+      <version>${version}</version>
+    </dependency>  
+
+    <dependency>
       <artifactId>shared-ldif</artifactId>
       <groupId>${groupId}</groupId>
       <version>${version}</version>

Modified: directory/shared/trunk/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java
(original)
+++ directory/shared/trunk/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java
Sat Mar  6 16:05:57 2010
@@ -30,6 +30,7 @@
 import java.text.ParseException;
 import java.util.List;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
 
 import antlr.RecognitionException;
@@ -118,7 +119,7 @@
     {
         if ( ( schemaObject == null ) || ( schemaObject.trim().equals( "" ) ) )
         {
-            throw new ParseException( "The schemaObject is either null or is empty!", 0 );
+            throw new ParseException( I18n.err( I18n.ERR_06001 ), 0 );
         }
 
         schemaIn = new ByteArrayInputStream( schemaObject.getBytes() );
@@ -150,15 +151,13 @@
         }
         catch ( RecognitionException re )
         {
-            String msg = "Parser failure on:\n\t" + schemaName;
-            msg += "\nAntlr exception trace:\n" + ExceptionUtils.getFullStackTrace( re );
+            String msg = I18n.err( I18n.ERR_06002, schemaName, ExceptionUtils.getFullStackTrace(
re ) );
             init();
             throw new ParseException( msg, re.getColumn() );
         }
         catch ( TokenStreamException tse )
         {
-            String msg = "Parser failure on:\n\t" + schemaName;
-            msg += "\nAntlr exception trace:\n" + ExceptionUtils.getFullStackTrace( tse );
+            String msg = I18n.err( I18n.ERR_06002, schemaName, ExceptionUtils.getFullStackTrace(
tse ) );
             init();
             throw new ParseException( msg, 0 );
         }

Modified: directory/shared/trunk/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java
(original)
+++ directory/shared/trunk/ldap-convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java
Sat Mar  6 16:05:57 2010
@@ -23,6 +23,7 @@
 import java.io.Writer;
 import java.util.List;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -83,7 +84,7 @@
         {
             if ( schema.getName() == null )
             {
-                String msg = i + "the schema configuration element must specify a name.";
+                String msg = I18n.err( I18n.ERR_06003, i );
                 log.error( msg );
                 throw new ParserException( msg );
             }
@@ -100,7 +101,7 @@
             }
             catch ( Exception e )
             {
-                throw new ParserException( "Failed while generating sources for " + schema.getName()
);
+                throw new ParserException( I18n.err( I18n.ERR_06004, schema.getName() ) );
             }
         }
     }
@@ -116,8 +117,8 @@
     {
         if ( schema == null )
         {
-            log.error( "Can't generate a ldif for a null schema" );
-            throw new NullPointerException( "the schema property must be set" );
+            log.error( I18n.err( I18n.ERR_06005 ) );
+            throw new NullPointerException( I18n.err( I18n.ERR_06006 ) );
         }
 
         InputStream in = schema.getInput();

Modified: directory/shared/trunk/ldap-schema-loader/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-loader/pom.xml?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-loader/pom.xml (original)
+++ directory/shared/trunk/ldap-schema-loader/pom.xml Sat Mar  6 16:05:57 2010
@@ -38,6 +38,12 @@
   
   <dependencies>
     <dependency>
+      <artifactId>shared-i18n</artifactId>
+      <groupId>${groupId}</groupId>
+      <version>${version}</version>
+    </dependency>  
+
+    <dependency>
       <artifactId>shared-ldap</artifactId>
       <groupId>${groupId}</groupId>
       <version>${version}</version>

Modified: directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java
(original)
+++ directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/AttributeClassLoader.java
Sat Mar  6 16:05:57 2010
@@ -23,6 +23,7 @@
 import javax.naming.NamingException;
 import javax.naming.directory.InvalidAttributeValueException;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
 
@@ -48,7 +49,7 @@
     {
         if ( attribute.isHR() )
         {
-            throw new InvalidAttributeValueException( "The attribute must be binary" );
+            throw new InvalidAttributeValueException( I18n.err( I18n.ERR_10001 ) );
         }
         
         this.attribute = attribute;
@@ -69,7 +70,7 @@
         }
         else
         {
-            throw new ClassNotFoundException( "Failed to access attribute bytes." );
+            throw new ClassNotFoundException( I18n.err( I18n.ERR_10002 ) );
         }
     }
 }

Modified: directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
(original)
+++ directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/JarLdifSchemaLoader.java
Sat Mar  6 16:05:57 2010
@@ -28,6 +28,7 @@
 import java.util.Map;
 import java.util.regex.Pattern;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
@@ -128,7 +129,7 @@
                 }
                 catch ( Exception e )
                 {
-                    LOG.error( "Failed to load schema LDIF file " + file, e );
+                    LOG.error( I18n.err( I18n.ERR_10003, file ), e );
                     throw e;
                 }
                 finally

Modified: directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java
(original)
+++ directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/LdifSchemaLoader.java
Sat Mar  6 16:05:57 2010
@@ -27,6 +27,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Entry;
@@ -107,8 +108,7 @@
 
         if ( !schemaLdif.exists() )
         {
-            String msg = "Expecting to find a schema.ldif file in provided baseDirectory
path '"
-                + schemaLdif.getAbsolutePath() + "' but no such file found.";
+            String msg = I18n.err( I18n.ERR_10004, schemaLdif.getAbsolutePath() );
             LOG.error( msg );
             throw new FileNotFoundException( msg );
         }
@@ -164,7 +164,7 @@
             }
             catch ( Exception e )
             {
-                LOG.error( "Failed to load schema LDIF file " + ldifFile, e );
+                LOG.error( I18n.err( I18n.ERR_10003, ldifFile ), e );
                 throw e;
             }
         }

Modified: directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java
(original)
+++ directory/shared/trunk/ldap-schema-loader/src/main/java/org/apache/directory/shared/ldap/schema/loader/ldif/SchemaEntityFactory.java
Sat Mar  6 16:05:57 2010
@@ -30,6 +30,7 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.asn1.primitives.OID;
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.Entry;
@@ -107,8 +108,7 @@
 
         if ( mOid == null )
         {
-            String msg = objectType + " entry must have a valid " + MetaSchemaConstants.M_OID_AT
-                + " attribute, it's null";
+            String msg = I18n.err( I18n.ERR_10005, objectType, MetaSchemaConstants.M_OID_AT
);
             LOG.warn( msg );
             throw new NullPointerException( msg );
         }
@@ -117,7 +117,7 @@
 
         if ( !OID.isOID( oid ) )
         {
-            String msg = "Comparator OID " + oid + " is not a valid OID ";
+            String msg = I18n.err( I18n.ERR_10006, oid );
             LOG.warn( msg );
             throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX
);
         }
@@ -137,15 +137,14 @@
 
         if ( oid == null )
         {
-            String msg = objectType + " entry must have a valid " + MetaSchemaConstants.M_OID_AT
-                + " attribute, it's null";
+            String msg = I18n.err( I18n.ERR_10005, objectType, MetaSchemaConstants.M_OID_AT
);
             LOG.warn( msg );
             throw new NullPointerException( msg );
         }
 
         if ( !OID.isOID( oid ) )
         {
-            String msg = "Comparator OID " + oid + " is not a valid OID ";
+            String msg = I18n.err( I18n.ERR_10006, oid );
             LOG.warn( msg );
             throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX
);
         }
@@ -161,7 +160,7 @@
     {
         if ( entry == null )
         {
-            String msg = schemaEntity + " entry cannot be null";
+            String msg = I18n.err( I18n.ERR_10007, schemaEntity );
             LOG.warn( msg );
             throw new NullPointerException( msg );
         }
@@ -175,7 +174,7 @@
     {
         if ( description == null )
         {
-            String msg = schemaEntity + " Schema description cannot be null";
+            String msg = I18n.err( I18n.ERR_10008, schemaEntity );
             LOG.warn( msg );
             throw new NullPointerException( msg );
         }
@@ -197,7 +196,7 @@
 
         if ( schema == null )
         {
-            String msg = "The schema " + schemaName + " does not exists or is not loaded";
+            String msg = I18n.err( I18n.ERR_10009, schemaName );
             LOG.error( msg );
         }
 
@@ -217,20 +216,19 @@
 
         if ( entry == null )
         {
-            throw new NullPointerException( "entry cannot be null" );
+            throw new NullPointerException( I18n.err( I18n.ERR_10010 ) );
         }
 
         if ( entry.get( SchemaConstants.CN_AT ) == null )
         {
-            throw new NullPointerException( "entry must have a valid cn attribute" );
+            throw new NullPointerException( I18n.err( I18n.ERR_10011 ) );
         }
 
         name = entry.get( SchemaConstants.CN_AT ).getString();
 
         if ( entry.get( SchemaConstants.CREATORS_NAME_AT ) == null )
         {
-            throw new NullPointerException( "entry must have a valid " + SchemaConstants.CREATORS_NAME_AT
-                + " attribute" );
+            throw new NullPointerException( I18n.err( I18n.ERR_10012, SchemaConstants.CREATORS_NAME_AT
) );
         }
 
         owner = entry.get( SchemaConstants.CREATORS_NAME_AT ).getString();
@@ -310,8 +308,7 @@
         if ( !schemaManager.isSchemaLoaded( schemaName ) )
         {
             // The schema is not loaded. We can't create the requested Normalizer
-            String msg = "Cannot add the SyntaxChecker " + entry.getDn().getName() + ", as
the associated schema ("
-                + schemaName + " is not loaded";
+            String msg = I18n.err( I18n.ERR_10013, entry.getDn().getName(), schemaName );
             LOG.warn( msg );
             throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
         }
@@ -321,8 +318,7 @@
         if ( schema == null )
         {
             // The schema is disabled. We still have to update the backend
-            String msg = "Cannot add the SyntaxChecker " + entry.getDn().getName() + " into
the registries, "
-                + "as the associated schema (" + schemaName + ") is disabled";
+            String msg = I18n.err( I18n.ERR_10014, entry.getDn().getName(), schemaName );
             LOG.info( msg );
             schema = schemaManager.getLoadedSchema( schemaName );
         }
@@ -362,8 +358,7 @@
         if ( schema == null )
         {
             // The schema is not loaded. We can't create the requested SyntaxChecker
-            String msg = "Cannot add the SyntaxChecker " + syntaxCheckerDescription.getName()
-                + ", as the associated schema (" + schemaName + " is not loaded";
+            String msg = I18n.err( I18n.ERR_10013, syntaxCheckerDescription.getName(), schemaName
);
             LOG.warn( msg );
             throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
         }
@@ -425,7 +420,7 @@
             
             if ( !comparator.getOid().equals( oid ) )
             {
-                String msg = "The Comparator's OID (" + oid + ") is different from the loaded
class' OID (" + comparator.getOid();
+                String msg = I18n.err( I18n.ERR_10015, oid, comparator.getOid() );
                 throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
             }
         }
@@ -459,8 +454,7 @@
         if ( schema == null )
         {
             // The schema is not loaded. We can't create the requested Comparator
-            String msg = "Cannot add the Comparator " + comparatorDescription.getName()
-                + ", as the associated schema (" + schemaName + " is not loaded";
+            String msg = I18n.err( I18n.ERR_10016, comparatorDescription.getName(), schemaName
);
             LOG.warn( msg );
             throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
         }
@@ -496,8 +490,7 @@
         if ( !schemaManager.isSchemaLoaded( schemaName ) )
         {
             // The schema is not loaded. We can't create the requested Comparator
-            String msg = "Cannot add the Comparator " + entry.getDn().getName() + ", as the
associated schema ("
-                + schemaName + " is not loaded";
+            String msg = I18n.err( I18n.ERR_10016, entry.getDn().getName(), schemaName );
             LOG.warn( msg );
             throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
         }
@@ -507,8 +500,7 @@
         if ( schema == null )
         {
             // The schema is disabled. We still have to update the backend
-            String msg = "Cannot add the Comparator " + entry.getDn().getName() + " into
the registries, "
-                + "as the associated schema (" + schemaName + ") is disabled";
+            String msg = I18n.err( I18n.ERR_10017, entry.getDn().getName(), schemaName );
             LOG.info( msg );
             schema = schemaManager.getLoadedSchema( schemaName );
         }
@@ -586,8 +578,7 @@
         if ( schema == null )
         {
             // The schema is not loaded. We can't create the requested Normalizer
-            String msg = "Cannot add the Normalizer " + normalizerDescription.getName()
-                + ", as the associated schema (" + schemaName + " is not loaded";
+            String msg = I18n.err( I18n.ERR_10018, normalizerDescription.getName(), schemaName
);
             LOG.warn( msg );
             throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
         }
@@ -623,8 +614,7 @@
         if ( !schemaManager.isSchemaLoaded( schemaName ) )
         {
             // The schema is not loaded. We can't create the requested Normalizer
-            String msg = "Cannot add the Normalizer " + entry.getDn().getName() + ", as the
associated schema ("
-                + schemaName + " is not loaded";
+            String msg = I18n.err( I18n.ERR_10018, entry.getDn().getName(), schemaName );
             LOG.warn( msg );
             throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
         }
@@ -634,8 +624,7 @@
         if ( schema == null )
         {
             // The schema is disabled. We still have to update the backend
-            String msg = "Cannot add the Normalizer " + entry.getDn().getName() + " into
the registries, "
-                + "as the associated schema (" + schemaName + ") is disabled";
+            String msg = I18n.err( I18n.ERR_10019, entry.getDn().getName(), schemaName );
             LOG.info( msg );
             schema = schemaManager.getLoadedSchema( schemaName );
         }
@@ -708,8 +697,7 @@
         if ( !schemaManager.isSchemaLoaded( schemaName ) )
         {
             // The schema is not loaded. We can't create the requested Syntax
-            String msg = "Cannot add the Syntax " + entry.getDn().getName() + ", as the associated
schema ("
-                + schemaName + " is not loaded";
+            String msg = I18n.err( I18n.ERR_10020, entry.getDn().getName(), schemaName );
             LOG.warn( msg );
             throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
         }
@@ -719,8 +707,7 @@
         if ( schema == null )
         {
             // The schema is disabled. We still have to update the backend
-            String msg = "Cannot add the SyntaxChecker " + entry.getDn().getName() + " into
the registries, "
-                + "as the associated schema (" + schemaName + ") is disabled";
+            String msg = I18n.err( I18n.ERR_10021, entry.getDn().getName(), schemaName );
             LOG.info( msg );
             schema = schemaManager.getLoadedSchema( schemaName );
         }
@@ -759,8 +746,7 @@
         if ( !schemaManager.isSchemaLoaded( schemaName ) )
         {
             // The schema is not loaded. We can't create the requested MatchingRule
-            String msg = "Cannot add the MatchingRule " + entry.getDn().getName() + ", as
the associated schema ("
-                + schemaName + " is not loaded";
+            String msg = I18n.err( I18n.ERR_10022, entry.getDn().getName(), schemaName );
             LOG.warn( msg );
             throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
         }
@@ -770,8 +756,7 @@
         if ( schema == null )
         {
             // The schema is disabled. We still have to update the backend
-            String msg = "Cannot add the MatchingRule " + entry.getDn().getName() + " into
the registries, "
-                + "as the associated schema (" + schemaName + ") is disabled";
+            String msg = I18n.err( I18n.ERR_10023, entry.getDn().getName(), schemaName );
             LOG.info( msg );
             schema = schemaManager.getLoadedSchema( schemaName );
         }
@@ -832,8 +817,7 @@
         if ( !schemaManager.isSchemaLoaded( schemaName ) )
         {
             // The schema is not loaded. We can't create the requested ObjectClass
-            String msg = "Cannot add the ObjectClass " + entry.getDn().getName() + ", as
the associated schema ("
-                + schemaName + " is not loaded";
+            String msg = I18n.err( I18n.ERR_10024, entry.getDn().getName(), schemaName );
             LOG.warn( msg );
             throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
         }
@@ -843,8 +827,7 @@
         if ( schema == null )
         {
             // The schema is disabled. We still have to update the backend
-            String msg = "Cannot add the ObjectClass " + entry.getDn().getName() + " into
the registries, "
-                + "as the associated schema (" + schemaName + ") is disabled";
+            String msg = I18n.err( I18n.ERR_10025, entry.getDn().getName(), schemaName );
             LOG.info( msg );
             schema = schemaManager.getLoadedSchema( schemaName );
         }
@@ -907,8 +890,7 @@
         if ( !schemaManager.isSchemaLoaded( schemaName ) )
         {
             // The schema is not loaded, this is an error
-            String msg = "Cannot add the AttributeType " + entry.getDn().getName() + ", as
the associated schema ("
-                + schemaName + " is not loaded";
+            String msg = I18n.err( I18n.ERR_10026, entry.getDn().getName(),  schemaName );
             LOG.warn( msg );
             throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM
);
         }
@@ -918,8 +900,7 @@
         if ( schema == null )
         {
             // The schema is disabled. We still have to update the backend
-            String msg = "Cannot add the AttributeType " + entry.getDn().getName() + " into
the registries, "
-                + "as the associated schema (" + schemaName + ") is disabled";
+            String msg = I18n.err( I18n.ERR_10027, entry.getDn().getName(), schemaName );
             LOG.info( msg );
             schema = schemaManager.getLoadedSchema( schemaName );
         }
@@ -1027,7 +1008,7 @@
 
         if ( mFqcn == null )
         {
-            String msg = objectType + " entry must have a valid " + MetaSchemaConstants.M_FQCN_AT
+ " attribute";
+            String msg = I18n.err( I18n.ERR_10028, objectType, MetaSchemaConstants.M_FQCN_AT
);
             LOG.warn( msg );
             throw new NullPointerException( msg );
         }
@@ -1046,7 +1027,7 @@
 
         if ( mFqcn == null )
         {
-            String msg = objectType + " entry must have a valid " + MetaSchemaConstants.M_FQCN_AT
+ " attribute";
+            String msg = I18n.err( I18n.ERR_10028, objectType, MetaSchemaConstants.M_FQCN_AT
);
             LOG.warn( msg );
             throw new NullPointerException( msg );
         }
@@ -1064,7 +1045,7 @@
 
         if ( byteCode == null )
         {
-            String msg = objectType + " entry must have a valid " + MetaSchemaConstants.M_BYTECODE_AT
+ " attribute";
+            String msg = I18n.err( I18n.ERR_10028, objectType, MetaSchemaConstants.M_BYTECODE_AT
);
             LOG.warn( msg );
             throw new NullPointerException( msg );
         }
@@ -1082,7 +1063,7 @@
 
         if ( byteCodeString == null )
         {
-            String msg = objectType + " entry must have a valid " + MetaSchemaConstants.M_BYTECODE_AT
+ " attribute";
+            String msg = I18n.err( I18n.ERR_10028, objectType, MetaSchemaConstants.M_BYTECODE_AT
);
             LOG.warn( msg );
             throw new NullPointerException( msg );
         }

Modified: directory/shared/trunk/ldap-schema/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/pom.xml?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/pom.xml (original)
+++ directory/shared/trunk/ldap-schema/pom.xml Sat Mar  6 16:05:57 2010
@@ -46,6 +46,12 @@
     </dependency>
     
     <dependency>
+      <artifactId>shared-i18n</artifactId>
+      <groupId>${groupId}</groupId>
+      <version>${version}</version>
+    </dependency>  
+
+    <dependency>
       <artifactId>shared-ldap</artifactId>
       <groupId>${groupId}</groupId>
       <version>${version}</version>

Modified: directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java?rev=919794&r1=919793&r2=919794&view=diff
==============================================================================
--- directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
(original)
+++ directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/ldif/extractor/impl/DefaultSchemaLdifExtractor.java
Sat Mar  6 16:05:57 2010
@@ -37,6 +37,7 @@
 
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.ldif.LdifReader;
@@ -137,8 +138,7 @@
         }
         else if ( ! overwrite )
         {
-            throw new IOException( "Cannot overwrite yet schema output directory already
exists: "
-                    + schemaDirectory.getAbsolutePath() );
+            throw new IOException( I18n.err( I18n.ERR_08001, schemaDirectory.getAbsolutePath()
) );
         }
 
         Pattern pattern = Pattern.compile( ".*schema/ou=schema.*\\.ldif" );
@@ -191,8 +191,7 @@
         
         if ( ! source.getParentFile().exists() )
         {
-            throw new FileNotFoundException( "Cannot copy non-existant " +
-                "source file " + source.getAbsolutePath() );
+            throw new FileNotFoundException( I18n.err( I18n.ERR_08002, source.getAbsolutePath()
) );
         }
         
         FileWriter out = new FileWriter( destination );
@@ -221,7 +220,7 @@
                 else
                 {
                     // throw an exception : we should not have more than one entry per schema
ldif file
-                    String msg = "Cannot have more than one entry in a schema ldif file :
" + source;
+                    String msg = I18n.err( I18n.ERR_08003, source );
                     LOG.error( msg );
                     throw new InvalidObjectException( msg );
                 }
@@ -238,7 +237,7 @@
         catch ( NamingException ne )
         {
             // throw an exception : we should not have more than one entry per schema ldif
file
-            String msg = "Excepion occured while parsing the ldif file " + source + " : "
+ ne.getMessage();
+            String msg = I18n.err( I18n.ERR_08004, source, ne.getLocalizedMessage() );
             LOG.error( msg );
             throw new InvalidObjectException( msg );
         }
@@ -298,8 +297,7 @@
             if ( parent.equals( parent.getParentFile() )
                     || parent.getParentFile() == null )
             {
-                throw new IllegalStateException( 
-                    "Should not be hitting root without schema/schema pattern." );
+                throw new IllegalStateException( I18n.err( I18n.ERR_08005 ) );
             }
             
             parent = parent.getParentFile();
@@ -322,7 +320,7 @@
         
         */
 
-        throw new IllegalStateException( "parent cannot be null" );
+        throw new IllegalStateException( I18n.err( I18n.ERR_08006 ) );
     }
     
     



Mime
View raw message