directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1235253 - in /directory/apacheds/trunk/core/src: main/java/org/apache/directory/server/core/ main/java/org/apache/directory/server/core/prefs/ main/java/org/apache/directory/server/core/security/ test/java/org/apache/directory/server/core/...
Date Tue, 24 Jan 2012 13:53:07 GMT
Author: elecharny
Date: Tue Jan 24 13:53:06 2012
New Revision: 1235253

URL: http://svn.apache.org/viewvc?rev=1235253&view=rev
Log:
Formatted the code using Directory formatter

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1235253&r1=1235252&r2=1235253&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Tue Jan 24 13:53:06 2012
@@ -194,7 +194,6 @@ public class DefaultDirectoryService imp
             "changes are made by the admin user.\n Furthermore the used controls are not at " +
             "all taken into account";
 
-
     /** The delay to wait between each sync on disk */
     private long syncPeriodMillis;
 
@@ -207,7 +206,6 @@ public class DefaultDirectoryService imp
     /** The sync worker thread */
     private SynchWorker worker = new SynchWorker();
 
-
     /** The default timeLimit : 100 entries */
     public static final int MAX_SIZE_LIMIT_DEFAULT = 100;
 
@@ -247,8 +245,8 @@ public class DefaultDirectoryService imp
     private ReadWriteLock interceptorsLock = new ReentrantReadWriteLock();
 
     /** The read and write locks */
-    private Lock readLock  = interceptorsLock.readLock();
-    private Lock writeLock  = interceptorsLock.writeLock();
+    private Lock readLock = interceptorsLock.readLock();
+    private Lock writeLock = interceptorsLock.writeLock();
 
     /** A map associating a list of interceptor to each operation */
     private Map<OperationEnum, List<String>> operationInterceptors;
@@ -347,7 +345,6 @@ public class DefaultDirectoryService imp
     // Constructor
     // ------------------------------------------------------------------------
 
-
     /**
      * Creates a new instance of the directory service.
      */
@@ -365,7 +362,6 @@ public class DefaultDirectoryService imp
     // C O N F I G U R A T I O N   M E T H O D S
     // ------------------------------------------------------------------------
 
-
     public void setInstanceId( String instanceId )
     {
         this.instanceId = instanceId;
@@ -533,7 +529,7 @@ public class DefaultDirectoryService imp
                 {
                     gatherInterceptors( interceptor, interceptor.getClass(), operation, operationList );
                 }
-                
+
                 operationInterceptors.put( operation, operationList );
             }
         }
@@ -553,10 +549,11 @@ public class DefaultDirectoryService imp
      * @param operation type of operation
      * @param selectedInterceptorList the list of selected interceptors
      */
-    private void gatherInterceptors( Interceptor interceptor, Class<?> interceptorClz, OperationEnum operation, List<String> selectedInterceptorList )
+    private void gatherInterceptors( Interceptor interceptor, Class<?> interceptorClz, OperationEnum operation,
+        List<String> selectedInterceptorList )
     {
         // We stop recursing when we reach the Base class
-        if( ( interceptorClz == null ) || ( interceptorClz == BaseInterceptor.class ) )
+        if ( ( interceptorClz == null ) || ( interceptorClz == BaseInterceptor.class ) )
         {
             return;
         }
@@ -569,7 +566,7 @@ public class DefaultDirectoryService imp
             boolean hasCorrestSig = false;
 
             // check for the correct signature
-            if( ( param == null ) || ( param.length > 1 ) || ( param.length == 0 ))
+            if ( ( param == null ) || ( param.length > 1 ) || ( param.length == 0 ) )
             {
                 continue;
             }
@@ -779,7 +776,8 @@ public class DefaultDirectoryService imp
         {
             if ( !instanceLayout.getInstanceDirectory().mkdirs() )
             {
-                throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getInstanceDirectory() ) );
+                throw new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
+                    instanceLayout.getInstanceDirectory() ) );
             }
         }
 
@@ -787,7 +785,8 @@ public class DefaultDirectoryService imp
         {
             if ( !instanceLayout.getLogDirectory().mkdirs() )
             {
-                throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getLogDirectory() ) );
+                throw new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
+                    instanceLayout.getLogDirectory() ) );
             }
         }
 
@@ -795,7 +794,8 @@ public class DefaultDirectoryService imp
         {
             if ( !instanceLayout.getRunDirectory().mkdirs() )
             {
-                throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getRunDirectory() ) );
+                throw new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
+                    instanceLayout.getRunDirectory() ) );
             }
         }
 
@@ -803,7 +803,8 @@ public class DefaultDirectoryService imp
         {
             if ( !instanceLayout.getPartitionsDirectory().mkdirs() )
             {
-                throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getPartitionsDirectory() ) );
+                throw new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
+                    instanceLayout.getPartitionsDirectory() ) );
             }
         }
 
@@ -811,7 +812,8 @@ public class DefaultDirectoryService imp
         {
             if ( !instanceLayout.getConfDirectory().mkdirs() )
             {
-                throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, instanceLayout.getConfDirectory() ) );
+                throw new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
+                    instanceLayout.getConfDirectory() ) );
             }
         }
     }
@@ -1005,7 +1007,7 @@ public class DefaultDirectoryService imp
 
     public CoreSession getSession( Dn principalDn, byte[] credentials ) throws LdapException
     {
-        if ( ! started )
+        if ( !started )
         {
             throw new IllegalStateException( "Service has not started." );
         }
@@ -1023,8 +1025,8 @@ public class DefaultDirectoryService imp
 
     public CoreSession getSession( Dn principalDn, byte[] credentials, String saslMechanism, String saslAuthId )
         throws Exception
-        {
-        if ( ! started )
+    {
+        if ( !started )
         {
             throw new IllegalStateException( "Service has not started." );
         }
@@ -1038,12 +1040,12 @@ public class DefaultDirectoryService imp
         operationManager.bind( bindContext );
 
         return bindContext.getSession();
-        }
+    }
 
 
     public long revert() throws LdapException
     {
-        if ( changeLog == null || ! changeLog.isEnabled() )
+        if ( changeLog == null || !changeLog.isEnabled() )
         {
             throw new IllegalStateException( I18n.err( I18n.ERR_310 ) );
         }
@@ -1115,7 +1117,7 @@ public class DefaultDirectoryService imp
 
     public long revert( long revision ) throws LdapException
     {
-        if ( changeLog == null || ! changeLog.isEnabled() )
+        if ( changeLog == null || !changeLog.isEnabled() )
         {
             throw new IllegalStateException( I18n.err( I18n.ERR_310 ) );
         }
@@ -1157,29 +1159,29 @@ public class DefaultDirectoryService imp
                 ChangeLogEvent event = cursor.get();
                 List<LdifEntry> reverses = event.getReverseLdifs();
 
-                for ( LdifEntry reverse:reverses )
+                for ( LdifEntry reverse : reverses )
                 {
-                    switch( reverse.getChangeType().getChangeType() )
+                    switch ( reverse.getChangeType().getChangeType() )
                     {
-                        case ChangeType.ADD_ORDINAL :
+                        case ChangeType.ADD_ORDINAL:
                             adminSession.add(
                                 new DefaultEntry( schemaManager, reverse.getEntry() ), true );
                             break;
 
-                        case ChangeType.DELETE_ORDINAL :
+                        case ChangeType.DELETE_ORDINAL:
                             adminSession.delete( reverse.getDn(), true );
                             break;
 
-                        case ChangeType.MODIFY_ORDINAL :
+                        case ChangeType.MODIFY_ORDINAL:
                             List<Modification> mods = reverse.getModifications();
 
                             adminSession.modify( reverse.getDn(), mods, true );
                             break;
 
-                        case ChangeType.MODDN_ORDINAL :
+                        case ChangeType.MODDN_ORDINAL:
                             // NO BREAK - both ModDN and ModRDN handling is the same
 
-                        case ChangeType.MODRDN_ORDINAL :
+                        case ChangeType.MODRDN_ORDINAL:
                             Dn forwardDn = event.getForwardLdif().getDn();
                             Dn reverseDn = reverse.getDn();
 
@@ -1347,7 +1349,6 @@ public class DefaultDirectoryService imp
             }
         }
 
-
         // --------------------------------------------------------------------
         // And shutdown the server
         // --------------------------------------------------------------------
@@ -1360,7 +1361,7 @@ public class DefaultDirectoryService imp
                 lockFile.close();
                 // no need to delete the lock file
             }
-            catch( IOException e )
+            catch ( IOException e )
             {
                 LOG.warn( "couldn't delete the lock file {}", LOCK_FILE_NAME );
             }
@@ -1379,6 +1380,7 @@ public class DefaultDirectoryService imp
         return referralManager;
     }
 
+
     /**
      * Set the referralManager
      * @param referralManager The initialized referralManager
@@ -1590,7 +1592,8 @@ public class DefaultDirectoryService imp
             firstStart = true;
 
             Entry serverEntry = new DefaultEntry( schemaManager, configurationDn );
-            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
+                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
 
             serverEntry.put( SchemaConstants.OU_AT, "configuration" );
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
@@ -1612,7 +1615,8 @@ public class DefaultDirectoryService imp
             firstStart = true;
 
             Entry serverEntry = new DefaultEntry( schemaManager, partitionsDn );
-            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
+                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
             serverEntry.put( SchemaConstants.OU_AT, "partitions" );
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
             serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
@@ -1633,7 +1637,8 @@ public class DefaultDirectoryService imp
             firstStart = true;
 
             Entry serverEntry = new DefaultEntry( schemaManager, servicesDn );
-            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
+                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
 
             serverEntry.put( SchemaConstants.OU_AT, "services" );
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
@@ -1655,7 +1660,8 @@ public class DefaultDirectoryService imp
             firstStart = true;
 
             Entry serverEntry = new DefaultEntry( schemaManager, interceptorsDn );
-            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
+                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
 
             serverEntry.put( SchemaConstants.OU_AT, "interceptors" );
             serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
@@ -1793,7 +1799,7 @@ public class DefaultDirectoryService imp
         {
             LOG.debug( "---> Initializing the DefaultDirectoryService " );
         }
-        
+
         // If no interceptor list is defined, setup a default list
         if ( interceptors == null )
         {
@@ -1817,12 +1823,13 @@ public class DefaultDirectoryService imp
         systemPartition.getSuffixDn().apply( schemaManager );
 
         adminDn = getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN );
-        adminSession = new DefaultCoreSession( new LdapPrincipal( schemaManager, adminDn, AuthenticationLevel.STRONG ), this );
+        adminSession = new DefaultCoreSession( new LdapPrincipal( schemaManager, adminDn, AuthenticationLevel.STRONG ),
+            this );
 
         // @TODO - NOTE: Need to find a way to instantiate without dependency on DPN
         partitionNexus = new DefaultPartitionNexus( new DefaultEntry( schemaManager, Dn.ROOT_DSE ) );
         partitionNexus.setDirectoryService( this );
-        partitionNexus.initialize( );
+        partitionNexus.initialize();
 
         initializeSystemPartition();
 
@@ -1843,9 +1850,10 @@ public class DefaultDirectoryService imp
         {
             changeLog.init( this );
 
-            if( changeLog.isExposed() && changeLog.isTagSearchSupported() )
+            if ( changeLog.isExposed() && changeLog.isTagSearchSupported() )
             {
-                String clSuffix = ( ( TaggableSearchableChangeLogStore ) changeLog.getChangeLogStore() ).getPartition().getSuffixDn().getName();
+                String clSuffix = ( ( TaggableSearchableChangeLogStore ) changeLog.getChangeLogStore() ).getPartition()
+                    .getSuffixDn().getName();
                 partitionNexus.getRootDse( null ).add( SchemaConstants.CHANGELOG_CONTEXT_AT, clSuffix );
             }
         }
@@ -1892,7 +1900,7 @@ public class DefaultDirectoryService imp
 
                 String addedLine = line.trim();
 
-                if ( Strings.isEmpty(addedLine) )
+                if ( Strings.isEmpty( addedLine ) )
                 {
                     continue;
                 }
@@ -1925,7 +1933,7 @@ public class DefaultDirectoryService imp
                 }
             }
         }
-        catch (IOException ioe)
+        catch ( IOException ioe )
         {
             // Do nothing : we can't reach this point !
         }
@@ -2026,7 +2034,7 @@ public class DefaultDirectoryService imp
         {
             readLock.lock();
 
-            for ( Interceptor interceptor:interceptors )
+            for ( Interceptor interceptor : interceptors )
             {
                 if ( interceptor.getName().equalsIgnoreCase( interceptorName ) )
                 {
@@ -2080,10 +2088,10 @@ public class DefaultDirectoryService imp
                 {
                     break;
                 }
-                
+
                 position++;
             }
-            
+
             if ( position == interceptors.size() )
             {
                 interceptors.add( interceptor );
@@ -2214,13 +2222,15 @@ public class DefaultDirectoryService imp
 
         if ( ( fileLock == null ) || ( !fileLock.isValid() ) )
         {
-            String message = "the working directory " + instanceLayout.getRunDirectory() + " has been locked by another directory service.";
+            String message = "the working directory " + instanceLayout.getRunDirectory()
+                + " has been locked by another directory service.";
             LOG.error( message );
             throw new RuntimeException( message );
         }
 
     }
 
+
     /**
      * {@inheritDoc}
      */
@@ -2271,7 +2281,8 @@ public class DefaultDirectoryService imp
      */
     public boolean isPwdPolicyEnabled()
     {
-        AuthenticationInterceptor authenticationInterceptor = (AuthenticationInterceptor)getInterceptor( InterceptorEnum.AUTHENTICATION_INTERCEPTOR.getName() );
+        AuthenticationInterceptor authenticationInterceptor = ( AuthenticationInterceptor ) getInterceptor( InterceptorEnum.AUTHENTICATION_INTERCEPTOR
+            .getName() );
 
         if ( authenticationInterceptor == null )
         {
@@ -2281,8 +2292,8 @@ public class DefaultDirectoryService imp
         PpolicyConfigContainer pwdPolicyContainer = authenticationInterceptor.getPwdPolicyContainer();
 
         return ( ( pwdPolicyContainer != null )
-            && ( ( pwdPolicyContainer.getDefaultPolicy() != null )
-                || ( pwdPolicyContainer.hasCustomConfigs() ) ) );
+        && ( ( pwdPolicyContainer.getDefaultPolicy() != null )
+        || ( pwdPolicyContainer.hasCustomConfigs() ) ) );
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1235253&r1=1235252&r2=1235253&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java Tue Jan 24 13:53:06 2012
@@ -107,7 +107,8 @@ public class DefaultOperationManager imp
             // trouble reading the entry due to insufficient access rights
             CoreSession adminSession = opContext.getSession().getDirectoryService().getAdminSession();
 
-            LookupOperationContext lookupContext = new LookupOperationContext( adminSession, opContext.getDn(), SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+            LookupOperationContext lookupContext = new LookupOperationContext( adminSession, opContext.getDn(),
+                SchemaConstants.ALL_ATTRIBUTES_ARRAY );
             Entry foundEntry = opContext.getSession().getDirectoryService().getPartitionNexus().lookup( lookupContext );
 
             if ( foundEntry != null )
@@ -132,7 +133,8 @@ public class DefaultOperationManager imp
         // trouble reading the entry due to insufficient access rights
         CoreSession adminSession = opContext.getSession().getDirectoryService().getAdminSession();
 
-        Entry foundEntry = adminSession.lookup( opContext.getDn(), SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES );
+        Entry foundEntry = adminSession.lookup( opContext.getDn(), SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES,
+            SchemaConstants.ALL_USER_ATTRIBUTES );
 
         if ( foundEntry != null )
         {
@@ -190,7 +192,8 @@ public class DefaultOperationManager imp
     }
 
 
-    private LdapReferralException buildReferralExceptionForSearch( Entry parentEntry, Dn childDn, SearchScope scope ) throws LdapException
+    private LdapReferralException buildReferralExceptionForSearch( Entry parentEntry, Dn childDn, SearchScope scope )
+        throws LdapException
     {
         // Get the Ref attributeType
         Attribute refs = parentEntry.get( SchemaConstants.REF_AT );
@@ -283,21 +286,21 @@ public class DefaultOperationManager imp
         // Normalize the addContext Dn
         Dn dn = addContext.getDn();
         dn.apply( directoryService.getSchemaManager() );
-        
+
         // We have to deal with the referral first
         directoryService.getReferralManager().lockRead();
-        
+
         if ( directoryService.getReferralManager().hasParentReferral( dn ) )
         {
             Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
             Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-            
+
             // Depending on the Context.REFERRAL property value, we will throw
             // a different exception.
             if ( addContext.isReferralIgnored() )
             {
                 directoryService.getReferralManager().unlock();
-                
+
                 LdapPartialResultException exception = buildLdapPartialResultException( childDn );
                 throw exception;
             }
@@ -305,7 +308,7 @@ public class DefaultOperationManager imp
             {
                 // Unlock the referral manager
                 directoryService.getReferralManager().unlock();
-                
+
                 LdapReferralException exception = buildReferralException( parentEntry, childDn );
                 throw exception;
             }
@@ -314,10 +317,10 @@ public class DefaultOperationManager imp
         {
             // Unlock the ReferralManager
             directoryService.getReferralManager().unlock();
-            
+
             // Call the Add method
             Interceptor head = directoryService.getInterceptor( addContext.getNextInterceptor() );
-            
+
             head.add( addContext );
         }
 
@@ -337,7 +340,7 @@ public class DefaultOperationManager imp
 
         // Call the Delete method
         Interceptor head = directoryService.getInterceptor( bindContext.getNextInterceptor() );
-        
+
         head.bind( bindContext );
 
         LOG.debug( "<< BindOperation successful" );
@@ -355,18 +358,18 @@ public class DefaultOperationManager imp
         // Normalize the compareContext Dn
         Dn dn = compareContext.getDn();
         dn.apply( directoryService.getSchemaManager() );
-        
+
         // We have to deal with the referral first
         directoryService.getReferralManager().lockRead();
-        
+
         // Check if we have an ancestor for this Dn
         Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-        
+
         if ( parentEntry != null )
         {
             // We have found a parent referral for the current Dn
             Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-            
+
             if ( directoryService.getReferralManager().isReferral( dn ) )
             {
                 // This is a referral. We can delete it if the ManageDsaIt flag is true
@@ -376,7 +379,7 @@ public class DefaultOperationManager imp
                     // Throw a Referral Exception
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
@@ -388,7 +391,7 @@ public class DefaultOperationManager imp
                 if ( compareContext.isReferralIgnored() )
                 {
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapPartialResultException exception = buildLdapPartialResultException( childDn );
                     throw exception;
                 }
@@ -396,26 +399,26 @@ public class DefaultOperationManager imp
                 {
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
             }
         }
-        
+
         // Unlock the ReferralManager
         directoryService.getReferralManager().unlock();
-        
+
         // populate the context with the old entry
         compareContext.setOriginalEntry( getOriginalEntry( compareContext ) );
-        
+
         // Call the Compare method
         Interceptor head = directoryService.getInterceptor( compareContext.getNextInterceptor() );
-        
+
         boolean result = head.compare( compareContext );
 
         LOG.debug( "<< CompareOperation successful" );
-        
+
         return result;
     }
 
@@ -433,17 +436,17 @@ public class DefaultOperationManager imp
         // Normalize the deleteContext Dn
         Dn dn = deleteContext.getDn();
         dn.apply( directoryService.getSchemaManager() );
-        
+
         // We have to deal with the referral first
         directoryService.getReferralManager().lockRead();
-        
+
         Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-        
+
         if ( parentEntry != null )
         {
             // We have found a parent referral for the current Dn
             Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-            
+
             if ( directoryService.getReferralManager().isReferral( dn ) )
             {
                 // This is a referral. We can delete it if the ManageDsaIt flag is true
@@ -453,7 +456,7 @@ public class DefaultOperationManager imp
                     // Throw a Referral Exception
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
@@ -461,13 +464,13 @@ public class DefaultOperationManager imp
             else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
             {
                 // We can't delete an entry which has an ancestor referral
-                
+
                 // Depending on the Context.REFERRAL property value, we will throw
                 // a different exception.
                 if ( deleteContext.isReferralIgnored() )
                 {
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapPartialResultException exception = buildLdapPartialResultException( childDn );
                     throw exception;
                 }
@@ -475,22 +478,22 @@ public class DefaultOperationManager imp
                 {
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
             }
         }
-        
+
         // Unlock the ReferralManager
         directoryService.getReferralManager().unlock();
-        
+
         // populate the context with the old entry
         eagerlyPopulateFields( deleteContext );
-        
+
         // Call the Delete method
         Interceptor head = directoryService.getInterceptor( deleteContext.getNextInterceptor() );
-        
+
         head.delete( deleteContext );
 
         LOG.debug( "<< DeleteOperation successful" );
@@ -508,11 +511,11 @@ public class DefaultOperationManager imp
         ensureStarted();
 
         Interceptor head = directoryService.getInterceptor( getRootDseContext.getNextInterceptor() );
-        
+
         Entry root = head.getRootDse( getRootDseContext );
-        
+
         LOG.debug( "<< getRootDseOperation successful" );
-        
+
         return root;
     }
 
@@ -527,11 +530,11 @@ public class DefaultOperationManager imp
         ensureStarted();
 
         Interceptor head = directoryService.getInterceptor( hasEntryContext.getNextInterceptor() );
-        
+
         boolean result = head.hasEntry( hasEntryContext );
-        
+
         LOG.debug( "<< HasEntryOperation successful" );
-        
+
         return result;
     }
 
@@ -546,11 +549,11 @@ public class DefaultOperationManager imp
         ensureStarted();
 
         Interceptor head = directoryService.getInterceptor( listContext.getNextInterceptor() );
-        
+
         EntryFilteringCursor cursor = head.list( listContext );
-        
+
         LOG.debug( "<< ListOperation successful" );
-        
+
         return cursor;
     }
 
@@ -565,11 +568,11 @@ public class DefaultOperationManager imp
         ensureStarted();
 
         Interceptor head = directoryService.getInterceptor( lookupContext.getNextInterceptor() );
-        
+
         Entry entry = head.lookup( lookupContext );
-        
+
         LOG.debug( "<< LookupOperation successful" );
-        
+
         return entry;
     }
 
@@ -587,15 +590,15 @@ public class DefaultOperationManager imp
         // Normalize the modifyContext Dn
         Dn dn = modifyContext.getDn();
         dn.apply( directoryService.getSchemaManager() );
-        
+
         ReferralManager referralManager = directoryService.getReferralManager();
-        
+
         // We have to deal with the referral first
         referralManager.lockRead();
-        
+
         // Check if we have an ancestor for this Dn
         Entry parentEntry = referralManager.getParentReferral( dn );
-        
+
         if ( parentEntry != null )
         {
             if ( referralManager.isReferral( dn ) )
@@ -607,10 +610,10 @@ public class DefaultOperationManager imp
                     // Throw a Referral Exception
                     // Unlock the referral manager
                     referralManager.unlock();
-                    
+
                     // We have found a parent referral for the current Dn
                     Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
@@ -618,16 +621,16 @@ public class DefaultOperationManager imp
             else if ( referralManager.hasParentReferral( dn ) )
             {
                 // We can't delete an entry which has an ancestor referral
-                
+
                 // Depending on the Context.REFERRAL property value, we will throw
                 // a different exception.
                 if ( modifyContext.isReferralIgnored() )
                 {
                     referralManager.unlock();
-                    
+
                     // We have found a parent referral for the current Dn
                     Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-                    
+
                     LdapPartialResultException exception = buildLdapPartialResultException( childDn );
                     throw exception;
                 }
@@ -635,25 +638,25 @@ public class DefaultOperationManager imp
                 {
                     // Unlock the referral manager
                     referralManager.unlock();
-                    
+
                     // We have found a parent referral for the current Dn
                     Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
             }
         }
-        
+
         // Unlock the ReferralManager
         referralManager.unlock();
-        
+
         // populate the context with the old entry
         eagerlyPopulateFields( modifyContext );
-        
+
         // Call the Modify method
         Interceptor head = directoryService.getInterceptor( modifyContext.getNextInterceptor() );
-        
+
         head.modify( modifyContext );
 
         LOG.debug( "<< ModifyOperation successful" );
@@ -674,22 +677,22 @@ public class DefaultOperationManager imp
         // Normalize the moveContext Dn
         Dn dn = moveContext.getDn();
         dn.apply( directoryService.getSchemaManager() );
-        
+
         // Normalize the moveContext superior Dn
         Dn newSuperiorDn = moveContext.getNewSuperior();
         newSuperiorDn.apply( directoryService.getSchemaManager() );
-        
+
         // We have to deal with the referral first
         directoryService.getReferralManager().lockRead();
-        
+
         // Check if we have an ancestor for this Dn
         Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-        
+
         if ( parentEntry != null )
         {
             // We have found a parent referral for the current Dn
             Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-            
+
             if ( directoryService.getReferralManager().isReferral( dn ) )
             {
                 // This is a referral. We can delete it if the ManageDsaIt flag is true
@@ -699,7 +702,7 @@ public class DefaultOperationManager imp
                     // Throw a Referral Exception
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
@@ -707,13 +710,13 @@ public class DefaultOperationManager imp
             else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
             {
                 // We can't delete an entry which has an ancestor referral
-                
+
                 // Depending on the Context.REFERRAL property value, we will throw
                 // a different exception.
                 if ( moveContext.isReferralIgnored() )
                 {
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapPartialResultException exception = buildLdapPartialResultException( childDn );
                     throw exception;
                 }
@@ -721,13 +724,13 @@ public class DefaultOperationManager imp
                 {
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
             }
         }
-        
+
         // Now, check the destination
         // If he parent Dn is a referral, or has a referral ancestor, we have to issue a AffectMultipleDsas result
         // as stated by RFC 3296 Section 5.6.2
@@ -736,25 +739,25 @@ public class DefaultOperationManager imp
         {
             // Unlock the referral manager
             directoryService.getReferralManager().unlock();
-            
+
             LdapAffectMultipleDsaException exception = new LdapAffectMultipleDsaException();
             //exception.setRemainingName( dn );
-            
+
             throw exception;
         }
-        
+
         // Unlock the ReferralManager
         directoryService.getReferralManager().unlock();
-        
+
         Entry originalEntry = getOriginalEntry( moveContext );
-        
+
         moveContext.setOriginalEntry( originalEntry );
-        
+
         // Call the Move method
         Interceptor head = directoryService.getInterceptor( moveContext.getNextInterceptor() );
-        
+
         head.move( moveContext );
-        
+
         LOG.debug( "<< MoveOperation successful" );
         LOG_CHANGES.debug( "<< MoveOperation successful" );
     }
@@ -773,18 +776,18 @@ public class DefaultOperationManager imp
         // Normalize the moveAndRenameContext Dn
         Dn dn = moveAndRenameContext.getDn();
         dn.apply( directoryService.getSchemaManager() );
-        
+
         // We have to deal with the referral first
         directoryService.getReferralManager().lockRead();
-        
+
         // Check if we have an ancestor for this Dn
         Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-        
+
         if ( parentEntry != null )
         {
             // We have found a parent referral for the current Dn
             Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-            
+
             if ( directoryService.getReferralManager().isReferral( dn ) )
             {
                 // This is a referral. We can delete it if the ManageDsaIt flag is true
@@ -794,7 +797,7 @@ public class DefaultOperationManager imp
                     // Throw a Referral Exception
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
@@ -802,13 +805,13 @@ public class DefaultOperationManager imp
             else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
             {
                 // We can't delete an entry which has an ancestor referral
-                
+
                 // Depending on the Context.REFERRAL property value, we will throw
                 // a different exception.
                 if ( moveAndRenameContext.isReferralIgnored() )
                 {
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapPartialResultException exception = buildLdapPartialResultException( childDn );
                     throw exception;
                 }
@@ -816,18 +819,18 @@ public class DefaultOperationManager imp
                 {
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
             }
         }
-        
+
         // Now, check the destination
         // Normalize the moveAndRenameContext Dn
         Dn newSuperiorDn = moveAndRenameContext.getNewSuperiorDn();
         newSuperiorDn.apply( directoryService.getSchemaManager() );
-        
+
         // If he parent Dn is a referral, or has a referral ancestor, we have to issue a AffectMultipleDsas result
         // as stated by RFC 3296 Section 5.6.2
         if ( directoryService.getReferralManager().isReferral( newSuperiorDn )
@@ -835,26 +838,26 @@ public class DefaultOperationManager imp
         {
             // Unlock the referral manager
             directoryService.getReferralManager().unlock();
-            
+
             // The parent Dn is a referral, we have to issue a AffectMultipleDsas result
             // as stated by RFC 3296 Section 5.6.2
             LdapAffectMultipleDsaException exception = new LdapAffectMultipleDsaException();
             //exception.setRemainingName( dn );
-            
+
             throw exception;
         }
-        
+
         // Unlock the ReferralManager
         directoryService.getReferralManager().unlock();
-        
+
         moveAndRenameContext.setOriginalEntry( getOriginalEntry( moveAndRenameContext ) );
         moveAndRenameContext.setModifiedEntry( moveAndRenameContext.getOriginalEntry().clone() );
-        
+
         // Call the MoveAndRename method
         Interceptor head = directoryService.getInterceptor( moveAndRenameContext.getNextInterceptor() );
-        
+
         head.moveAndRename( moveAndRenameContext );
-        
+
         LOG.debug( "<< MoveAndRenameOperation successful" );
         LOG_CHANGES.debug( "<< MoveAndRenameOperation successful" );
     }
@@ -873,7 +876,7 @@ public class DefaultOperationManager imp
         // Normalize the renameContext Dn
         Dn dn = renameContext.getDn();
         dn.apply( directoryService.getSchemaManager() );
-        
+
         // Inject the newDn into the operation context
         // Inject the new Dn into the context
         if ( !dn.isEmpty() )
@@ -882,18 +885,18 @@ public class DefaultOperationManager imp
             newDn = newDn.add( renameContext.getNewRdn() );
             renameContext.setNewDn( newDn );
         }
-        
+
         // We have to deal with the referral first
         directoryService.getReferralManager().lockRead();
-        
+
         // Check if we have an ancestor for this Dn
         Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-        
+
         if ( parentEntry != null )
         {
             // We have found a parent referral for the current Dn
             Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-            
+
             if ( directoryService.getReferralManager().isReferral( dn ) )
             {
                 // This is a referral. We can delete it if the ManageDsaIt flag is true
@@ -903,7 +906,7 @@ public class DefaultOperationManager imp
                     // Throw a Referral Exception
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
@@ -911,13 +914,13 @@ public class DefaultOperationManager imp
             else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
             {
                 // We can't delete an entry which has an ancestor referral
-                
+
                 // Depending on the Context.REFERRAL property value, we will throw
                 // a different exception.
                 if ( renameContext.isReferralIgnored() )
                 {
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapPartialResultException exception = buildLdapPartialResultException( childDn );
                     throw exception;
                 }
@@ -925,28 +928,28 @@ public class DefaultOperationManager imp
                 {
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralException( parentEntry, childDn );
                     throw exception;
                 }
             }
         }
-        
+
         // Unlock the ReferralManager
         directoryService.getReferralManager().unlock();
-        
+
         // Call the rename method
         // populate the context with the old entry
         eagerlyPopulateFields( renameContext );
         Entry originalEntry = getOriginalEntry( renameContext );
         renameContext.setOriginalEntry( originalEntry );
         renameContext.setModifiedEntry( originalEntry.clone() );
-        
+
         // Call the Rename method
         Interceptor head = directoryService.getInterceptor( renameContext.getNextInterceptor() );
-        
+
         head.rename( renameContext );
-        
+
         LOG.debug( "<< RenameOperation successful" );
         LOG_CHANGES.debug( "<< RenameOperation successful" );
     }
@@ -964,18 +967,18 @@ public class DefaultOperationManager imp
         // Normalize the searchContext Dn
         Dn dn = searchContext.getDn();
         dn.apply( directoryService.getSchemaManager() );
-        
+
         // We have to deal with the referral first
         directoryService.getReferralManager().lockRead();
-        
+
         // Check if we have an ancestor for this Dn
         Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-        
+
         if ( parentEntry != null )
         {
             // We have found a parent referral for the current Dn
             Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-            
+
             if ( directoryService.getReferralManager().isReferral( dn ) )
             {
                 // This is a referral. We can return it if the ManageDsaIt flag is true
@@ -985,7 +988,7 @@ public class DefaultOperationManager imp
                     // Throw a Referral Exception
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralExceptionForSearch( parentEntry, childDn,
                         searchContext.getScope() );
                     throw exception;
@@ -994,13 +997,13 @@ public class DefaultOperationManager imp
             else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
             {
                 // We can't search an entry which has an ancestor referral
-                
+
                 // Depending on the Context.REFERRAL property value, we will throw
                 // a different exception.
                 if ( searchContext.isReferralIgnored() )
                 {
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapPartialResultException exception = buildLdapPartialResultException( childDn );
                     throw exception;
                 }
@@ -1008,24 +1011,24 @@ public class DefaultOperationManager imp
                 {
                     // Unlock the referral manager
                     directoryService.getReferralManager().unlock();
-                    
+
                     LdapReferralException exception = buildReferralExceptionForSearch( parentEntry, childDn,
                         searchContext.getScope() );
                     throw exception;
                 }
             }
         }
-        
+
         // Unlock the ReferralManager
         directoryService.getReferralManager().unlock();
-        
+
         // Call the Search method
         Interceptor head = directoryService.getInterceptor( searchContext.getNextInterceptor() );
-        
+
         EntryFilteringCursor cursor = head.search( searchContext );
-        
+
         LOG.debug( "<< SearchOperation successful" );
-        
+
         return cursor;
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java?rev=1235253&r1=1235252&r2=1235253&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java Tue Jan 24 13:53:06 2012
@@ -19,8 +19,6 @@
  */
 package org.apache.directory.server.core.prefs;
 
- 
-
 
 /**
  * Document this class.

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java?rev=1235253&r1=1235252&r2=1235253&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java Tue Jan 24 13:53:06 2012
@@ -37,19 +37,19 @@ public class ServerSystemPreferenceExcep
     }
 
 
-    public ServerSystemPreferenceException(String message)
+    public ServerSystemPreferenceException( String message )
     {
         super( message );
     }
 
 
-    public ServerSystemPreferenceException(String message, Throwable cause)
+    public ServerSystemPreferenceException( String message, Throwable cause )
     {
         super( message, cause );
     }
 
 
-    public ServerSystemPreferenceException(Throwable cause)
+    public ServerSystemPreferenceException( Throwable cause )
     {
         super( cause );
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java?rev=1235253&r1=1235252&r2=1235253&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java Tue Jan 24 13:53:06 2012
@@ -64,11 +64,10 @@ public class ServerSystemPreferences ext
 
     /** maps changes based on key: key->list of mods (on same key) */
     private HashMap<String, List<Modification>> keyToChange = new HashMap<String, List<Modification>>( 3 );
-    
+
     private Dn dn;
-    
+
     private DirectoryService directoryService;
-    
 
 
     /**
@@ -81,7 +80,7 @@ public class ServerSystemPreferences ext
     {
         super( null, "" );
         super.newNode = false;
-        
+
         try
         {
             dn = directoryService.getDnFactory().create( "prefNodeName=sysPrefRoot,ou=system" );
@@ -90,11 +89,11 @@ public class ServerSystemPreferences ext
         {
             // never happens
         }
-        
+
         this.directoryService = directoryService;
     }
 
-    
+
     public void close() throws LdapException
     {
     }
@@ -115,16 +114,16 @@ public class ServerSystemPreferences ext
         try
         {
             dn = directoryService.getDnFactory().create( "prefNodeName=" + name + "," + parentDn.getName() );
-            
-            if ( ! directoryService.getAdminSession().exists( dn ) )
+
+            if ( !directoryService.getAdminSession().exists( dn ) )
             {
                 Entry entry = directoryService.newEntry( dn );
                 entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
                     ApacheSchemaConstants.PREF_NODE_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC );
                 entry.add( "prefNodeName", name );
-    
+
                 directoryService.getAdminSession().add( entry );
-                
+
                 super.newNode = false;
             }
         }
@@ -247,12 +246,12 @@ public class ServerSystemPreferences ext
             for ( Attribute attr : entry )
             {
                 String oid = attr.getAttributeType().getOid();
-                
+
                 if ( oid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
                 {
                     continue;
                 }
-                
+
                 keys.add( attr.getUpId() );
             }
         }
@@ -265,7 +264,7 @@ public class ServerSystemPreferences ext
     }
 
 
-    protected void removeSpi( String key ) 
+    protected void removeSpi( String key )
     {
         AttributeType at;
         try
@@ -287,7 +286,7 @@ public class ServerSystemPreferences ext
         String key = mi.getAttribute().getUpId();
         List<Modification> deltas;
         changes.add( mi );
-        
+
         if ( keyToChange.containsKey( key ) )
         {
             deltas = keyToChange.get( key );
@@ -307,7 +306,7 @@ public class ServerSystemPreferences ext
         try
         {
             Attribute attr = directoryService.getAdminSession().lookup( dn ).get( key );
-            
+
             if ( keyToChange.containsKey( key ) )
             {
                 for ( Modification mod : keyToChange.get( key ) )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java?rev=1235253&r1=1235252&r2=1235253&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java Tue Jan 24 13:53:06 2012
@@ -36,3 +36,5 @@
  */
 
 package org.apache.directory.server.core.prefs;
+
+

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java?rev=1235253&r1=1235252&r2=1235253&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java Tue Jan 24 13:53:06 2012
@@ -62,9 +62,9 @@ public class CoreKeyStoreSpi extends Key
     private static final String APACHEDS_ALIAS = "apacheds";
 
     private static final Logger LOG = LoggerFactory.getLogger( CoreKeyStoreSpi.class );
-    
+
     private DirectoryService directoryService;
-    
+
 
     /**
      * Creates a new instance of LocalKeyStore.
@@ -79,12 +79,13 @@ public class CoreKeyStoreSpi extends Key
     private Entry getTlsEntry() throws Exception
     {
         Dn adminDn = directoryService.getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN );
-        LdapPrincipal principal = new LdapPrincipal( directoryService.getSchemaManager(), adminDn, AuthenticationLevel.SIMPLE );
+        LdapPrincipal principal = new LdapPrincipal( directoryService.getSchemaManager(), adminDn,
+            AuthenticationLevel.SIMPLE );
         CoreSession session = directoryService.getSession( principal );
         return session.lookup( adminDn );
     }
-    
-    
+
+
     /* (non-Javadoc)
      * @see java.security.KeyStoreSpi#engineAliases()
      */
@@ -103,12 +104,12 @@ public class CoreKeyStoreSpi extends Key
     public boolean engineContainsAlias( String alias )
     {
         LOG.debug( "engineContainsAlias({}) called.", alias );
-        
+
         if ( alias.equalsIgnoreCase( APACHEDS_ALIAS ) )
         {
             return true;
         }
-        
+
         return false;
     }
 
@@ -143,7 +144,7 @@ public class CoreKeyStoreSpi extends Key
                 LOG.error( I18n.err( I18n.ERR_65 ), e );
             }
         }
-        
+
         return null;
     }
 
@@ -155,7 +156,7 @@ public class CoreKeyStoreSpi extends Key
     public String engineGetCertificateAlias( Certificate cert )
     {
         LOG.debug( "engineGetCertificateAlias({}) called.", cert );
-        
+
         if ( cert instanceof X509Certificate )
         {
             LOG.debug( "Certificate in alias request is X.509 based." );
@@ -165,7 +166,7 @@ public class CoreKeyStoreSpi extends Key
                 return APACHEDS_ALIAS;
             }
         }
-        
+
         try
         {
             Entry entry = getTlsEntry();
@@ -178,7 +179,7 @@ public class CoreKeyStoreSpi extends Key
         {
             LOG.error( I18n.err( I18n.ERR_66 ), e );
         }
-        
+
         return null;
     }
 
@@ -194,13 +195,14 @@ public class CoreKeyStoreSpi extends Key
         {
             Entry entry = getTlsEntry();
             LOG.debug( "Entry:\n{}", entry );
-            return new Certificate[] { TlsKeyGenerator.getCertificate( entry ) };
+            return new Certificate[]
+                { TlsKeyGenerator.getCertificate( entry ) };
         }
         catch ( Exception e )
         {
             LOG.error( I18n.err( I18n.ERR_66 ), e );
         }
-        
+
         return new Certificate[0];
     }
 
@@ -223,7 +225,7 @@ public class CoreKeyStoreSpi extends Key
     public Key engineGetKey( String alias, char[] password ) throws NoSuchAlgorithmException, UnrecoverableKeyException
     {
         LOG.debug( "engineGetKey({}, {}) called.", alias, password );
-        
+
         try
         {
             Entry entry = getTlsEntry();
@@ -234,7 +236,7 @@ public class CoreKeyStoreSpi extends Key
         {
             LOG.error( I18n.err( I18n.ERR_68 ), e );
         }
-        
+
         return null;
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java?rev=1235253&r1=1235252&r2=1235253&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java Tue Jan 24 13:53:06 2012
@@ -61,7 +61,7 @@ import org.slf4j.LoggerFactory;
 public class TlsKeyGenerator
 {
     private static final Logger LOG = LoggerFactory.getLogger( TlsKeyGenerator.class );
-    
+
     public static final String TLS_KEY_INFO_OC = "tlsKeyInfo";
     public static final String PRIVATE_KEY_AT = "privateKey";
     public static final String PUBLIC_KEY_AT = "publicKey";
@@ -71,11 +71,11 @@ public class TlsKeyGenerator
     public static final String USER_CERTIFICATE_AT = "userCertificate";
 
     private static final String BASE_DN = "OU=Directory, O=ASF, C=US";
-    
+
     public static final String CERTIFICATE_PRINCIPAL_DN = "CN=ApacheDS," + BASE_DN;
-    
+
     private static final String ALGORITHM = "RSA";
-    
+
     /* 
      * Eventually we have to make several of these parameters configurable,
      * however note to pass export restrictions we must use a key size of
@@ -89,17 +89,16 @@ public class TlsKeyGenerator
      * Also ApacheDS must be classified on the following page:
      * 
      *    http://www.apache.org/licenses/exports
-     */ 
+     */
     private static final int KEY_SIZE = 512;
     private static final long YEAR_MILLIS = 365L * 24L * 3600L * 1000L;
-    
 
     static
     {
         Security.addProvider( new BouncyCastleProvider() );
     }
 
-    
+
     /**
      * Gets the certificate associated with the self signed TLS private/public 
      * key pair.
@@ -112,7 +111,7 @@ public class TlsKeyGenerator
     {
         X509Certificate cert = null;
         CertificateFactory certFactory = null;
-        
+
         try
         {
             certFactory = CertificateFactory.getInstance( "X.509", "BC" );
@@ -137,11 +136,11 @@ public class TlsKeyGenerator
             ne.initCause( e );
             throw ne;
         }
-        
+
         return cert;
     }
-    
-    
+
+
     /**
      * Extracts the public private key pair from the tlsKeyInfo entry.
      *
@@ -153,7 +152,7 @@ public class TlsKeyGenerator
     {
         PublicKey publicKey = null;
         PrivateKey privateKey = null;
-        
+
         KeyFactory keyFactory = null;
         try
         {
@@ -165,7 +164,7 @@ public class TlsKeyGenerator
             ne.initCause( e );
             throw ne;
         }
-        
+
         EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec( entry.get( PRIVATE_KEY_AT ).getBytes() );
         try
         {
@@ -177,7 +176,7 @@ public class TlsKeyGenerator
             ne.initCause( e );
             throw ne;
         }
-    
+
         EncodedKeySpec publicKeySpec = new X509EncodedKeySpec( entry.get( PUBLIC_KEY_AT ).getBytes() );
         try
         {
@@ -189,10 +188,10 @@ public class TlsKeyGenerator
             ne.initCause( e );
             throw ne;
         }
-        
+
         return new KeyPair( publicKey, privateKey );
     }
-    
+
 
     /**
      * Adds a private key pair along with a self signed certificate to an 
@@ -211,7 +210,7 @@ public class TlsKeyGenerator
     public static void addKeyPair( Entry entry ) throws LdapException
     {
         Attribute objectClass = entry.get( SchemaConstants.OBJECT_CLASS_AT );
-        
+
         if ( objectClass == null )
         {
             entry.put( SchemaConstants.OBJECT_CLASS_AT, TLS_KEY_INFO_OC, SchemaConstants.INET_ORG_PERSON_OC );
@@ -224,7 +223,7 @@ public class TlsKeyGenerator
         {
             objectClass.add( TLS_KEY_INFO_OC );
         }
-        
+
         KeyPairGenerator generator = null;
         try
         {
@@ -240,40 +239,39 @@ public class TlsKeyGenerator
         generator.initialize( KEY_SIZE );
         KeyPair keypair = generator.genKeyPair();
         entry.put( KEY_ALGORITHM_AT, ALGORITHM );
-        
+
         // Generate the private key attributes 
         PrivateKey privateKey = keypair.getPrivate();
         entry.put( PRIVATE_KEY_AT, privateKey.getEncoded() );
         entry.put( PRIVATE_KEY_FORMAT_AT, privateKey.getFormat() );
         LOG.debug( "PrivateKey: {}", privateKey );
-        
+
         PublicKey publicKey = keypair.getPublic();
         entry.put( PUBLIC_KEY_AT, publicKey.getEncoded() );
         entry.put( PUBLIC_KEY_FORMAT_AT, publicKey.getFormat() );
         LOG.debug( "PublicKey: {}", publicKey );
-        
+
         // Generate the self-signed certificate
-        Date startDate = new Date(); 
-        Date expiryDate = new Date( System.currentTimeMillis() + YEAR_MILLIS ); 
+        Date startDate = new Date();
+        Date expiryDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
         BigInteger serialNumber = BigInteger.valueOf( System.currentTimeMillis() );
 
         X509V1CertificateGenerator certGen = new X509V1CertificateGenerator();
         X500Principal issuerDn = new X500Principal( CERTIFICATE_PRINCIPAL_DN );
-        
+
         X500Principal subjectDn = null;
-        
+
         try
         {
             String hostName = InetAddress.getLocalHost().getHostName();
             subjectDn = new X500Principal( "CN=" + hostName + "," + BASE_DN );
         }
-        catch( Exception e )
+        catch ( Exception e )
         {
             LOG.warn( "failed to create certificate subject name from host name", e );
             subjectDn = issuerDn;
         }
-       
-        
+
         certGen.setSerialNumber( serialNumber );
         certGen.setIssuerDN( issuerDn );
         certGen.setNotBefore( startDate );
@@ -294,10 +292,10 @@ public class TlsKeyGenerator
             ne.initCause( e );
             throw ne;
         }
-        
+
         LOG.info( "Keys and self signed certificate successfully generated." );
     }
-    
+
 
     /**
      * @see #addKeyPair(org.apache.directory.shared.ldap.model.entry.Entry)
@@ -305,10 +303,11 @@ public class TlsKeyGenerator
      * TODO the code is duplicate atm, will eliminate this redundancy after finding
      * a better thought (an instant one is to call this method from the aboveaddKeyPair(entry) and remove the impl there)
      */
-    public static void addKeyPair( Entry entry, String issuerDN, String subjectDN, String keyAlgo ) throws LdapException
+    public static void addKeyPair( Entry entry, String issuerDN, String subjectDN, String keyAlgo )
+        throws LdapException
     {
         Attribute objectClass = entry.get( SchemaConstants.OBJECT_CLASS_AT );
-        
+
         if ( objectClass == null )
         {
             entry.put( SchemaConstants.OBJECT_CLASS_AT, TLS_KEY_INFO_OC, SchemaConstants.INET_ORG_PERSON_OC );
@@ -317,7 +316,7 @@ public class TlsKeyGenerator
         {
             objectClass.add( TLS_KEY_INFO_OC, SchemaConstants.INET_ORG_PERSON_OC );
         }
-        
+
         KeyPairGenerator generator = null;
         try
         {
@@ -333,27 +332,27 @@ public class TlsKeyGenerator
         generator.initialize( KEY_SIZE );
         KeyPair keypair = generator.genKeyPair();
         entry.put( KEY_ALGORITHM_AT, keyAlgo );
-        
+
         // Generate the private key attributes 
         PrivateKey privateKey = keypair.getPrivate();
         entry.put( PRIVATE_KEY_AT, privateKey.getEncoded() );
         entry.put( PRIVATE_KEY_FORMAT_AT, privateKey.getFormat() );
         LOG.debug( "PrivateKey: {}", privateKey );
-        
+
         PublicKey publicKey = keypair.getPublic();
         entry.put( PUBLIC_KEY_AT, publicKey.getEncoded() );
         entry.put( PUBLIC_KEY_FORMAT_AT, publicKey.getFormat() );
         LOG.debug( "PublicKey: {}", publicKey );
-        
+
         // Generate the self-signed certificate
-        Date startDate = new Date(); 
-        Date expiryDate = new Date( System.currentTimeMillis() + YEAR_MILLIS ); 
+        Date startDate = new Date();
+        Date expiryDate = new Date( System.currentTimeMillis() + YEAR_MILLIS );
         BigInteger serialNumber = BigInteger.valueOf( System.currentTimeMillis() );
 
         X509V1CertificateGenerator certGen = new X509V1CertificateGenerator();
         X500Principal issuerName = new X500Principal( issuerDN );
         X500Principal subjectName = new X500Principal( subjectDN );
-        
+
         certGen.setSerialNumber( serialNumber );
         certGen.setIssuerDN( issuerName );
         certGen.setNotBefore( startDate );
@@ -374,8 +373,8 @@ public class TlsKeyGenerator
             ne.initCause( e );
             throw ne;
         }
-        
+
         LOG.info( "Keys and self signed certificate successfully generated." );
     }
-    
+
 }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java?rev=1235253&r1=1235252&r2=1235253&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java Tue Jan 24 13:53:06 2012
@@ -77,7 +77,7 @@ public class TlsKeyGeneratorTest
         SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
         extractor.extractOrCopy( true );
         */
-        
+
         schemaManager = new DefaultSchemaManager();
     }
 



Mime
View raw message