directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1475698 - in /directory/apacheds/trunk: protocol-ldap/src/main/java/org/apache/directory/server/ldap/ protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ server-config/src/main/java/org/apache/directory/serve...
Date Thu, 25 Apr 2013 10:36:24 GMT
Author: kayyagari
Date: Thu Apr 25 10:36:23 2013
New Revision: 1475698

URL: http://svn.apache.org/r1475698
Log:
o make replication pinger thread's sleep time to be configurable (DIRSERVER-1831)
o allow cipher suites to be configurable (DIRSERVER-1584)

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/PingerThread.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
    directory/apacheds/trunk/server-config/src/main/resources/config.ldif
    directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1475698&r1=1475697&r2=1475698&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
Thu Apr 25 10:36:23 2013
@@ -256,7 +256,13 @@ public class LdapServer extends Director
 
     private KeyManagerFactory keyManagerFactory;
 
+    /** the time interval between subsequent pings to each replication provider */    
+    private int pingerSleepTime;
 
+    /** the list of cipher suites to be used in LDAPS and StartTLS */
+    private List<String> enabledCipherSuites = new ArrayList<String>();
+    
+    
     /**
      * Creates an LDAP protocol provider.
      */
@@ -436,7 +442,7 @@ public class LdapServer extends Director
             if ( dfcb.contains( sslFilterName ) )
             {
                 DefaultIoFilterChainBuilder newChain = ( DefaultIoFilterChainBuilder ) LdapsInitializer
-                    .init( keyManagerFactory );
+                    .init( this );
                 dfcb.replace( sslFilterName, newChain.get( sslFilterName ) );
                 newChain = null;
             }
@@ -477,7 +483,7 @@ public class LdapServer extends Director
 
             if ( transport.isSSLEnabled() )
             {
-                chain = LdapsInitializer.init( keyManagerFactory );
+                chain = LdapsInitializer.init( this );
             }
             else
             {
@@ -696,7 +702,7 @@ public class LdapServer extends Director
     {
         if ( ( replConsumers != null ) && ( replConsumers.size() > 0 ) )
         {
-            final PingerThread pingerThread = new PingerThread();
+            final PingerThread pingerThread = new PingerThread( pingerSleepTime );
             pingerThread.start();
 
             for ( final ReplicationConsumer consumer : replConsumers )
@@ -938,7 +944,7 @@ public class LdapServer extends Director
      */
     public void setMaxTimeLimit( int maxTimeLimit )
     {
-        this.maxTimeLimit = maxTimeLimit;
+        this.maxTimeLimit = maxTimeLimit; //TODO review the time parameters used all over
the server and convert to seconds 
     }
 
 
@@ -1697,6 +1703,48 @@ public class LdapServer extends Director
 
 
     /**
+     * @return the number of seconds pinger thread sleeps between subsequent pings
+     */
+    public int getReplPingerSleepTime()
+    {
+        return pingerSleepTime;
+    }
+
+
+    /**
+     * The number of seconds pinger thread should sleep before pinging the providers
+     *  
+     * @param pingerSleepTime
+     */
+    public void setReplPingerSleepTime( int pingerSleepTime )
+    {
+        this.pingerSleepTime = pingerSleepTime;
+    }
+
+
+    /**
+     * Gives the list of enabled cipher suites
+     * 
+     * @return
+     */
+    public List<String> getEnabledCipherSuites()
+    {
+        return enabledCipherSuites;
+    }
+
+
+    /**
+     * Sets the list of cipher suites to be used in LDAPS and StartTLS
+     * 
+     * @param enabledCipherSuites if null the default cipher suites will be used
+     */
+    public void setEnabledCipherSuites( List<String> enabledCipherSuites )
+    {
+        this.enabledCipherSuites = enabledCipherSuites;
+    }
+
+
+    /**
      * @see Object#toString()
      */
     public String toString()

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/PingerThread.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/PingerThread.java?rev=1475698&r1=1475697&r2=1475698&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/PingerThread.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/PingerThread.java
Thu Apr 25 10:36:23 2013
@@ -45,12 +45,23 @@ public class PingerThread extends Thread
     /** A flag to stop the pinger */
     private boolean stop = false;
 
+    /** the time interval before this thread pings each replication provider. Default value
is 5 seconds */
+    private long sleepTime = 5000;
 
     /**
      * Create a new instance of this thread.
+     * 
+     * @param sleepSec the number of seconds pinger thread should sleep before pinging the
providers
      */
-    public PingerThread()
+    public PingerThread( int sleepSec )
     {
+        if( sleepSec > 0 )
+        {
+            sleepTime = sleepSec * 1000;
+        }
+        
+        CONSUMER_LOG.info( "Configured pinger thread to sleep for {} seconds", ( sleepTime
/ 1000 ) );
+        
         setDaemon( true );
     }
 
@@ -76,7 +87,7 @@ public class PingerThread extends Thread
                     consumer.ping();
                 }
 
-                Thread.sleep( 5000 );
+                Thread.sleep( sleepTime );
             }
         }
         catch ( InterruptedException ie )

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java?rev=1475698&r1=1475697&r2=1475698&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
(original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
Thu Apr 25 10:36:23 2013
@@ -90,6 +90,13 @@ public class LdapServerBean extends DSBa
     @ConfigurationElement(objectClass = "ads-extendedOpHandler", container = "extendedOpHandlers",
isOptional = true)
     private List<ExtendedOpHandlerBean> extendedOpHandlers = new ArrayList<ExtendedOpHandlerBean>();
 
+    /** the time interval between subsequent pings to each replication provider */
+    @ConfigurationElement(attributeType = "ads-replPingerSleep")
+    private int replPingerSleep;
+
+    /** the list of cipher suites to be used in LDAPS and StartTLS */
+    @ConfigurationElement(attributeType = "ads-enabledCipherSuites", isOptional = true)
+    private List<String> enabledCipherSuites = new ArrayList<String>();
 
     /**
      * Create a new LdapServerBean instance
@@ -403,7 +410,13 @@ public class LdapServerBean extends DSBa
         sb.append( tabs ).append( "  sasl host : " ).append( saslHost ).append( '\n' );
         sb.append( toString( tabs, "  confidentiality required", confidentialityRequired
) );
         sb.append( toString( tabs, "  enable replication provider", replReqHandler ) );
-
+        sb.append( toString( tabs, "  Pinger thread sleep time(in sec.)", replPingerSleep
) );
+        
+        if( ( enabledCipherSuites != null ) && !enabledCipherSuites.isEmpty() )
+        {
+            sb.append( toString( tabs, "  enabled cipher suites", enabledCipherSuites.toString()
) );
+        }
+        
         if ( ( extendedOpHandlers != null ) && ( extendedOpHandlers.size() > 0
) )
         {
             sb.append( tabs ).append( "  extended operation handlers :\n" );
@@ -467,6 +480,42 @@ public class LdapServerBean extends DSBa
     }
 
 
+    public int getReplPingerSleep()
+    {
+        return replPingerSleep;
+    }
+
+
+    public void setReplPingerSleep( int replPingerSleep )
+    {
+        this.replPingerSleep = replPingerSleep;
+    }
+
+
+    public List<String> getEnabledCipherSuites()
+    {
+        return enabledCipherSuites;
+    }
+
+
+    public void setEnabledCipherSuites( List<String> enabledCipherSuites )
+    {
+        this.enabledCipherSuites = enabledCipherSuites;
+    }
+
+    
+    /**
+     * @param enabledCipherSuites the cipher suites to add
+     */
+    public void addEnabledCipherSuites( String... enabledCipherSuites )
+    {
+        for ( String cs : enabledCipherSuites )
+        {
+            this.enabledCipherSuites.add( cs );
+        }
+    }
+
+    
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/trunk/server-config/src/main/resources/config.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/resources/config.ldif?rev=1475698&r1=1475697&r2=1475698&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/resources/config.ldif (original)
+++ directory/apacheds/trunk/server-config/src/main/resources/config.ldif Thu Apr 25 10:36:23
2013
@@ -661,8 +661,9 @@ ads-saslPrincipal: ldap/ldap.example.com
 ads-saslRealms: example.com
 ads-saslRealms: apache.org
 ads-searchBaseDN: ou=users,ou=system
-ads-enabled: TRUE
 ads-replEnabled: true
+ads-replPingerSleep: 5
+ads-enabled: TRUE
 
 dn: ou=replConsumers,ads-serverId=ldapServer,ou=servers,ads-directoryServiceId=default,ou=config
 objectClass: organizationalUnit

Modified: directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java?rev=1475698&r1=1475697&r2=1475698&view=diff
==============================================================================
--- directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
(original)
+++ directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
Thu Apr 25 10:36:23 2013
@@ -970,6 +970,15 @@ public class ServiceBuilder
         // Sasl realm
         ldapServer.setSaslRealms( ldapServerBean.getLdapServerSaslRealms() );
 
+        // Relplication pinger thread sleep time
+        ldapServer.setReplPingerSleepTime( ldapServerBean.getReplPingerSleep() );
+        
+        // Enabled cipher suites
+        if( ldapServerBean.getEnabledCipherSuites() != null )
+        {
+            ldapServer.setEnabledCipherSuites( ldapServerBean.getEnabledCipherSuites() );
+        }
+        
         // The transports
         Transport[] transports = createTransports( ldapServerBean.getTransports() );
         ldapServer.setTransports( transports );



Mime
View raw message