directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1227716 - in /directory/apacheds/branches/apacheds-txns/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/direc...
Date Thu, 05 Jan 2012 17:33:51 GMT
Author: elecharny
Date: Thu Jan  5 17:33:51 2012
New Revision: 1227716

URL: http://svn.apache.org/viewvc?rev=1227716&view=rev
Log:
Formatted the code

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

Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1227716&r1=1227715&r2=1227716&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Thu Jan  5 17:33:51 2012
@@ -201,7 +201,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;
 
@@ -214,7 +213,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;
 
@@ -254,8 +252,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;
@@ -306,13 +304,12 @@ public class DefaultDirectoryService imp
 
     /** The Subtree evaluator instance */
     private SubtreeEvaluator evaluator;
-    
+
     /** Txn Manager Factory */
     TxnManagerFactory txnManagerFactory;
-    
+
     /** Operation Execution Manager Factory */
     OperationExecutionManagerFactory executionManagerFactory;
-    
 
     /**
      * The synchronizer thread. It flush data on disk periodically.
@@ -361,7 +358,6 @@ public class DefaultDirectoryService imp
     // Constructor
     // ------------------------------------------------------------------------
 
-
     /**
      * Creates a new instance of the directory service.
      */
@@ -379,7 +375,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;
@@ -547,7 +542,7 @@ public class DefaultDirectoryService imp
                 {
                     gatherInterceptors( interceptor, interceptor.getClass(), operation, operationList
);
                 }
-                
+
                 operationInterceptors.put( operation, operationList );
             }
         }
@@ -567,10 +562,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;
         }
@@ -583,7 +579,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;
             }
@@ -793,7 +789,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() ) );
             }
         }
 
@@ -801,15 +798,17 @@ 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() ) );
             }
         }
-        
+
         if ( !instanceLayout.getTxnLogDirectory().exists() )
         {
             if ( !instanceLayout.getTxnLogDirectory().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() ) );
             }
         }
 
@@ -817,7 +816,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() ) );
             }
         }
 
@@ -825,7 +825,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() ) );
             }
         }
 
@@ -833,7 +834,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() ) );
             }
         }
     }
@@ -1027,7 +1029,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." );
         }
@@ -1045,8 +1047,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." );
         }
@@ -1060,20 +1062,18 @@ 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 ) );
         }
 
         Tag latest = changeLog.getLatest();
 
-        
-        
         if ( null != latest )
         {
             if ( latest.getRevision() < changeLog.getCurrentRevision() )
@@ -1139,7 +1139,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 ) );
         }
@@ -1183,9 +1183,9 @@ public class DefaultDirectoryService imp
                 // THE followign revert was done in one txn. However, when then number
                 // of changes got close to 1000, it got really slow. For now doing this
                 // in small txns, but identify the cause of this perf problem.
-                
+
                 //txnManager.beginTransaction( false );
-                
+
                 boolean startedTxn = false;
                 List<ChangeLogEvent> events = new LinkedList();
 
@@ -1193,7 +1193,7 @@ public class DefaultDirectoryService imp
                 {
                     cursor = changeLog.getChangeLogStore().findAfter( revision );
                     cursor.afterLast();
-                    
+
                     while ( cursor.previous() )
                     {
                         events.add( cursor.get() );
@@ -1208,22 +1208,22 @@ public class DefaultDirectoryService imp
                             cursor.close();
                         }
                     }
-                    catch( Exception e )
+                    catch ( Exception e )
                     {
                         // ignore
                     }
                 }
-                
+
                 Iterator<ChangeLogEvent> it = events.iterator();
                 boolean inTxn = false;
-                 
+
                 try
                 {
                     while ( it.hasNext() ) // apply ldifs in reverse order
-                    {                       
+                    {
                         ChangeLogEvent event = it.next();
                         List<LdifEntry> reverses = event.getReverseLdifs();
-                        
+
                         for ( LdifEntry reverse : reverses )
                         {
                             switch ( reverse.getChangeType().getChangeType() )
@@ -1270,7 +1270,7 @@ public class DefaultDirectoryService imp
                 done = true;
             }
             while ( !done );
-                    
+
         }
         catch ( IOException e )
         {
@@ -1292,9 +1292,9 @@ public class DefaultDirectoryService imp
                 {
                     cursor.close();
                 }
-                catch( Exception e )
+                catch ( Exception e )
                 {
-                    
+
                 }
             }
         }
@@ -1346,13 +1346,14 @@ public class DefaultDirectoryService imp
             LOG.warn( "ApacheDS shutdown hook has NOT been registered with the runtime."
                 + "  This default setting for standalone operation has been overriden." );
         }
-        
+
         // Initialize the txn subsystem and the operation execution manager if not initialized
aleady 
         if ( txnManagerFactory == null )
         {
-            txnManagerFactory = new TxnManagerFactory( getInstanceLayout().getTxnLogDirectory().getPath(),
TXN_LOG_BUFFER_SIZE, TXN_LOG_FILE_SIZE );
+            txnManagerFactory = new TxnManagerFactory( getInstanceLayout().getTxnLogDirectory().getPath(),
+                TXN_LOG_BUFFER_SIZE, TXN_LOG_FILE_SIZE );
         }
-        
+
         if ( executionManagerFactory == null )
         {
             executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory
);
@@ -1362,11 +1363,11 @@ public class DefaultDirectoryService imp
         showSecurityWarnings();
 
         // Start the sync thread if required
-//        if ( syncPeriodMillis > 0 )
-//        {
-//            //workerThread = new Thread( worker, "SynchWorkerThread" );
-//            //workerThread.start();
-//        }
+        //        if ( syncPeriodMillis > 0 )
+        //        {
+        //            //workerThread = new Thread( worker, "SynchWorkerThread" );
+        //            //workerThread.start();
+        //        }
 
         // load the last stored valid CSN value
         LookupOperationContext loc = new LookupOperationContext( getAdminSession() );
@@ -1411,7 +1412,7 @@ public class DefaultDirectoryService imp
         {
             return;
         }
-        
+
         // --------------------------------------------------------------------
         // Shutdown the txnManager
         //
@@ -1458,7 +1459,6 @@ public class DefaultDirectoryService imp
             }
         }
 
-
         // --------------------------------------------------------------------
         // And shutdown the server
         // --------------------------------------------------------------------
@@ -1471,7 +1471,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 );
             }
@@ -1490,6 +1490,7 @@ public class DefaultDirectoryService imp
         return referralManager;
     }
 
+
     /**
      * Set the referralManager
      * @param referralManager The initialized referralManager
@@ -1701,7 +1702,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
);
@@ -1723,7 +1725,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()
);
@@ -1744,7 +1747,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
);
@@ -1766,7 +1770,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
);
@@ -1904,7 +1909,7 @@ public class DefaultDirectoryService imp
         {
             LOG.debug( "---> Initializing the DefaultDirectoryService " );
         }
-        
+
         // If no interceptor list is defined, setup a default list
         if ( interceptors == null )
         {
@@ -1928,12 +1933,14 @@ 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
), executionManagerFactory );
+        partitionNexus = new DefaultPartitionNexus( new DefaultEntry( schemaManager, Dn.ROOT_DSE
),
+            executionManagerFactory );
         partitionNexus.setDirectoryService( this );
-        partitionNexus.initialize( );
+        partitionNexus.initialize();
 
         initializeSystemPartition();
 
@@ -1954,9 +1961,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 );
             }
         }
@@ -2003,7 +2011,7 @@ public class DefaultDirectoryService imp
 
                 String addedLine = line.trim();
 
-                if ( Strings.isEmpty(addedLine) )
+                if ( Strings.isEmpty( addedLine ) )
                 {
                     continue;
                 }
@@ -2036,7 +2044,7 @@ public class DefaultDirectoryService imp
                 }
             }
         }
-        catch (IOException ioe)
+        catch ( IOException ioe )
         {
             // Do nothing : we can't reach this point !
         }
@@ -2137,7 +2145,7 @@ public class DefaultDirectoryService imp
         {
             readLock.lock();
 
-            for ( Interceptor interceptor:interceptors )
+            for ( Interceptor interceptor : interceptors )
             {
                 if ( interceptor.getName().equalsIgnoreCase( interceptorName ) )
                 {
@@ -2191,10 +2199,10 @@ public class DefaultDirectoryService imp
                 {
                     break;
                 }
-                
+
                 position++;
             }
-            
+
             if ( position == interceptors.size() )
             {
                 interceptors.add( interceptor );
@@ -2325,13 +2333,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}
      */
@@ -2382,7 +2392,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 )
         {
@@ -2392,8 +2403,8 @@ public class DefaultDirectoryService imp
         PpolicyConfigContainer pwdPolicyContainer = authenticationInterceptor.getPwdPolicyContainer();
 
         return ( ( pwdPolicyContainer != null )
-            && ( ( pwdPolicyContainer.getDefaultPolicy() != null )
-                || ( pwdPolicyContainer.hasCustomConfigs() ) ) );
+        && ( ( pwdPolicyContainer.getDefaultPolicy() != null )
+        || ( pwdPolicyContainer.hasCustomConfigs() ) ) );
     }
 
 
@@ -2422,8 +2433,8 @@ public class DefaultDirectoryService imp
     {
         return evaluator;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -2431,8 +2442,8 @@ public class DefaultDirectoryService imp
     {
         this.txnManagerFactory = txnManagerFactory;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -2440,8 +2451,8 @@ public class DefaultDirectoryService imp
     {
         this.executionManagerFactory = executionManagerFactory;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -2449,8 +2460,8 @@ public class DefaultDirectoryService imp
     {
         return txnManagerFactory;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -2458,8 +2469,8 @@ public class DefaultDirectoryService imp
     {
         return executionManagerFactory;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -2467,8 +2478,8 @@ public class DefaultDirectoryService imp
     {
         return txnManagerFactory.txnManagerInstance();
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -2476,8 +2487,8 @@ public class DefaultDirectoryService imp
     {
         return txnManagerFactory.txnLogManagerInstance();
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -2485,5 +2496,5 @@ public class DefaultDirectoryService imp
     {
         return executionManagerFactory.instance();
     }
-    
+
 }
\ No newline at end of file

Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java?rev=1227716&r1=1227715&r2=1227716&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java
Thu Jan  5 17:33:51 2012
@@ -19,8 +19,6 @@
  */
 package org.apache.directory.server.core.prefs;
 
- 
-
 
 /**
  * Document this class.

Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java?rev=1227716&r1=1227715&r2=1227716&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java
Thu Jan  5 17:33:51 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/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java?rev=1227716&r1=1227715&r2=1227716&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
Thu Jan  5 17:33:51 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/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java?rev=1227716&r1=1227715&r2=1227716&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java
Thu Jan  5 17:33:51 2012
@@ -36,3 +36,5 @@
  */
 
 package org.apache.directory.server.core.prefs;
+
+

Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java?rev=1227716&r1=1227715&r2=1227716&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java
Thu Jan  5 17:33:51 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/branches/apacheds-txns/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java?rev=1227716&r1=1227715&r2=1227716&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java
Thu Jan  5 17:33:51 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