directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1407602 - in /directory: apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ shared/trunk/ldap/model/src/main/java/or...
Date Fri, 09 Nov 2012 19:51:00 GMT
Author: elecharny
Date: Fri Nov  9 19:50:59 2012
New Revision: 1407602

URL: http://svn.apache.org/viewvc?rev=1407602&view=rev
Log:
o Added the ads-replEnabled flag in the config 
o if the ads-replreqHandler is not set, use the default syncReplHandler class

Added:
    directory/shared/trunk/ldap/schema/data/src/main/resources/schema/ou=schema/cn=adsconfig/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.838.ldif
Modified:
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
    directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java

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=1407602&r1=1407601&r2=1407602&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
Fri Nov  9 19:50:59 2012
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.directory.server.config.ConfigurationElement;
+import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 
 
 /**
@@ -65,6 +66,10 @@ public class LdapServerBean extends DSBa
     @ConfigurationElement(attributeType = "ads-certificatePassword")
     private String certificatePassword;
 
+    /** A flag telling if the replication is enabled */
+    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_ENABLED )
+    private boolean replicationEnabled = false;
+    
     /** the replication request handler, server will be in replication provider/master mode
if a valid FQCN is given */
     @ConfigurationElement(attributeType = "ads-replReqHandler")
     private String replReqHandler;
@@ -418,7 +423,25 @@ public class LdapServerBean extends DSBa
 
         return sb.toString();
     }
+    
+    
+    /**
+     * @return True if the replication service should be enabled
+     */
+    public boolean isReplicationEnabled()
+    {
+        return replicationEnabled;
+    }
 
+    
+    /**
+     * Enable or disable the replication
+     * @param replicationEnabled The new value
+     */
+    public void setReplicationEnabled( boolean replicationEnabled )
+    {
+        this.replicationEnabled = replicationEnabled;
+    }
 
     /**
      * {@inheritDoc}

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=1407602&r1=1407601&r2=1407602&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
Fri Nov  9 19:50:59 2012
@@ -90,6 +90,7 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.server.ldap.replication.consumer.ReplicationConsumer;
 import org.apache.directory.server.ldap.replication.consumer.ReplicationConsumerImpl;
 import org.apache.directory.server.ldap.replication.provider.ReplicationRequestHandler;
+import org.apache.directory.server.ldap.replication.provider.SyncReplRequestHandler;
 import org.apache.directory.server.ntp.NtpServer;
 import org.apache.directory.server.protocol.shared.transport.TcpTransport;
 import org.apache.directory.server.protocol.shared.transport.Transport;
@@ -970,25 +971,35 @@ public class ServiceBuilder
         }
 
         // ReplReqHandler
-        String fqcn = ldapServerBean.getReplReqHandler();
-
-        if ( fqcn != null )
+        boolean replicationEnabled = ldapServerBean.isReplicationEnabled();
+        
+        if ( replicationEnabled )
         {
-            try
+            String fqcn = ldapServerBean.getReplReqHandler();
+    
+            if ( fqcn != null )
             {
-                Class<?> replProvImplClz = Class.forName( fqcn );
-                ReplicationRequestHandler rp = ( ReplicationRequestHandler ) replProvImplClz.newInstance();
-                ldapServer.setReplicationReqHandler( rp );
+                try
+                {
+                    Class<?> replProvImplClz = Class.forName( fqcn );
+                    ReplicationRequestHandler rp = ( ReplicationRequestHandler ) replProvImplClz.newInstance();
+                    ldapServer.setReplicationReqHandler( rp );
+                }
+                catch ( Exception e )
+                {
+                    String message = "Failed to load and instantiate ReplicationRequestHandler
implementation : " + fqcn;
+                    LOG.error( message );
+                    throw new ConfigurationException( message );
+                }
             }
-            catch ( Exception e )
+            else if ( true )
             {
-                String message = "Failed to load and instantiate ReplicationRequestHandler
implementation : " + fqcn;
-                LOG.error( message );
-                throw new ConfigurationException( message );
+                // Try with the default handler
+                ReplicationRequestHandler rp = new SyncReplRequestHandler();
+                ldapServer.setReplicationReqHandler( rp );
             }
-
         }
-
+        
         ldapServer.setReplConsumers( createReplConsumers( ldapServerBean.getReplConsumers()
) );
 
         return ldapServer;

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java?rev=1407602&r1=1407601&r2=1407602&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java
Fri Nov  9 19:50:59 2012
@@ -518,9 +518,14 @@ public final class SchemaConstants
     //-------------------------------------------------------------------------
     // ObjectClasses
     //-------------------------------------------------------------------------
-    // ads-replReqHandler AT
-    public final static String ADS_REPL_REQ_HANDLER = "ads-replReqHandler";
-    public final static String ADS_REPL_REQ_HANDLER_OID = "1.3.6.1.4.1.18060.0.4.1.2.832";
+    
+    
+    //=========================================================================
+    // DirectoryService AT and OC
+    //-------------------------------------------------------------------------
+    // ads-directoryServiceId AT
+    public final static String ADS_DIRECTORY_SERVICE_ID = "ads-directoryServiceId";
+    public final static String ADS_DIRECTORY_SERVICE_ID_OID = "1.3.6.1.4.1.18060.0.4.1.2.100";
 
     //=========================================================================
     // Replication AT and OC
@@ -606,6 +611,10 @@ public final class SchemaConstants
     public final static String ADS_REPL_COOKIE = "ads-replCookie";
     public final static String ADS_REPL_COOKIE_OID = "1.3.6.1.4.1.18060.0.4.1.2.831";
 
+    // ads-replReqHandler AT
+    public final static String ADS_REPL_REQ_HANDLER = "ads-replReqHandler";
+    public final static String ADS_REPL_REQ_HANDLER_OID = "1.3.6.1.4.1.18060.0.4.1.2.832";
+
     // ads-replUseTls AT
     public final static String ADS_REPL_USE_TLS = "ads-replUseTls";
     public final static String ADS_REPL_USE_TLS_OID = "1.3.6.1.4.1.18060.0.4.1.2.833";
@@ -626,6 +635,10 @@ public final class SchemaConstants
     public final static String ADS_REPL_CONSUMER_ID = "ads-replConsumerId";
     public final static String ADS_REPL_CONSUMER_ID_OID = "1.3.6.1.4.1.18060.0.4.1.2.837";
 
+    // ads-replEnabled AT
+    public final static String ADS_REPL_ENABLED = "ads-replEnabled";
+    public final static String ADS_REPL_ENABLED_OID = "1.3.6.1.4.1.18060.0.4.1.2.838";
+
     //-------------------------------------------------------------------------
     // ---- Syntaxes ----------------------------------------------------------
     //-------------------------------------------------------------------------

Added: directory/shared/trunk/ldap/schema/data/src/main/resources/schema/ou=schema/cn=adsconfig/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.838.ldif
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/resources/schema/ou%3Dschema/cn%3Dadsconfig/ou%3Dattributetypes/m-oid%3D1.3.6.1.4.1.18060.0.4.1.2.838.ldif?rev=1407602&view=auto
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/resources/schema/ou=schema/cn=adsconfig/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.838.ldif
(added)
+++ directory/shared/trunk/ldap/schema/data/src/main/resources/schema/ou=schema/cn=adsconfig/ou=attributetypes/m-oid=1.3.6.1.4.1.18060.0.4.1.2.838.ldif
Fri Nov  9 19:50:59 2012
@@ -0,0 +1,13 @@
+version: 1
+dn: m-oid=1.3.6.1.4.1.18060.0.4.1.2.838,ou=attributeTypes,cn=adsconfig,ou=schema
+m-singlevalue: TRUE
+m-oid: 1.3.6.1.4.1.18060.0.4.1.2.838
+m-description: A flag set when the replication is enabled
+objectclass: top
+objectclass: metaTop
+objectclass: metaAttributeType
+m-syntax: 1.3.6.1.4.1.1466.115.121.1.7
+m-name: ads-replEnabled
+creatorsname: uid=admin,ou=system
+m-equality: booleanMatch
+m-length: 0



Mime
View raw message