directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r291570 - /directory/standalone/trunk/osgi/loader/src/main/java/org/apache/ldap/server/loader/LdifFileLoader.java
Date Mon, 26 Sep 2005 06:41:22 GMT
Author: erodriguez
Date: Sun Sep 25 23:41:19 2005
New Revision: 291570

URL: http://svn.apache.org/viewcvs?rev=291570&view=rev
Log:
Updated Loader console command to use SLF4J.

Modified:
    directory/standalone/trunk/osgi/loader/src/main/java/org/apache/ldap/server/loader/LdifFileLoader.java

Modified: directory/standalone/trunk/osgi/loader/src/main/java/org/apache/ldap/server/loader/LdifFileLoader.java
URL: http://svn.apache.org/viewcvs/directory/standalone/trunk/osgi/loader/src/main/java/org/apache/ldap/server/loader/LdifFileLoader.java?rev=291570&r1=291569&r2=291570&view=diff
==============================================================================
--- directory/standalone/trunk/osgi/loader/src/main/java/org/apache/ldap/server/loader/LdifFileLoader.java
(original)
+++ directory/standalone/trunk/osgi/loader/src/main/java/org/apache/ldap/server/loader/LdifFileLoader.java
Sun Sep 25 23:41:19 2005
@@ -37,6 +37,8 @@
 import org.apache.ldap.common.message.LockableAttributesImpl;
 import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.util.NestableRuntimeException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Command class for loading an LDIF file into an LdapContext.
@@ -46,6 +48,9 @@
  */
 public class LdifFileLoader
 {
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( LdifFileLoader.class );
+
     /** a handle on the top initial context: get new context from this */
     protected LdapContext ctx;
 
@@ -101,9 +106,7 @@
                     byte[] encodedKey = key.getEncoded();
 
                     attributes.put( KerberosAttribute.KEY, encodedKey );
-
                     attributes.put( KerberosAttribute.VERSION, Integer.toString( key.getVersionNumber()
) );
-
                     attributes.put( KerberosAttribute.TYPE, Integer.toString( key.getKeyType()
) );
                 }
 
@@ -111,26 +114,24 @@
 
                 try
                 {
-                    System.err.println( "attempting look up before creation of " + rdn );
+                    log.error( "attempting look up before creation of " + rdn );
                     ctx.lookup( rdn );
 
-                    System.err.println( "succeeded on looked up of " + rdn + " will not create"
);
+                    log.error( "succeeded on looked up of " + rdn + " will not create" );
                 }
                 catch ( Exception e )
                 {
-                    System.err.println( "creating " + rdn );
+                    log.error( "creating " + rdn );
 
                     ctx.createSubcontext( rdn, attributes );
 
-                    System.err.println( "successfully created " + rdn );
+                    log.error( "successfully created " + rdn );
                 }
             }
         }
         catch ( Exception e )
         {
-            String msg = "Failed to import LDIF into backing store.";
-
-            throw new NestableRuntimeException( msg, e );
+            throw new NestableRuntimeException( "Failed to import LDIF into backing store.",
e );
         }
 
         try
@@ -153,15 +154,15 @@
 
                 rdn = getRelativeName( ctx, dn );
 
-                System.err.println( "looking up " + rdn );
+                log.error( "looking up " + rdn );
 
                 Object stored = ctx.lookup( rdn );
 
-                System.err.println( "looked up " + rdn + " and found " + stored );
+                log.error( "looked up " + rdn + " and found " + stored );
 
                 if ( stored == null )
                 {
-                    System.err.println( rdn + " was null" );
+                    log.error( rdn + " was null" );
 
                     throw new IllegalStateException( "LDIF entries not being pushed to disk."
);
                 }
@@ -169,13 +170,9 @@
         }
         catch ( Exception e )
         {
-            e.printStackTrace();
-
-            System.err.println( "failed to find " + rdn );
-
-            String msg = "Failed to import LDIF into backing store.";
+            log.error( "Failed to find " + rdn, e );
 
-            throw new NestableRuntimeException( msg, e );
+            throw new NestableRuntimeException( "Failed to import LDIF into backing store.",
e );
         }
     }
 
@@ -223,7 +220,7 @@
 
             if ( in == null )
             {
-                System.err.println( "LDIF file does not exist!" );
+                log.error( "LDIF file does not exist!" );
             }
         }
 



Mime
View raw message