directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1151533 - in /directory: apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ shared/trunk/ldap/model/src/main/java/org/...
Date Wed, 27 Jul 2011 16:58:45 GMT
Author: elecharny
Date: Wed Jul 27 16:58:44 2011
New Revision: 1151533

URL: http://svn.apache.org/viewvc?rev=1151533&view=rev
Log:
o Declared the replication constants in SchemaConstants
o Used them in the code

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java?rev=1151533&r1=1151532&r2=1151533&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaDitStoreUtil.java
Wed Jul 27 16:58:44 2011
@@ -111,16 +111,16 @@ public class ReplicaDitStoreUtil
             return;
         }
 
-        Dn replicaDn = new Dn( schemaManager, "ads-dsReplicaId=" + replica.getId() + ","
+ REPL_CONSUMER_DN );
+        Dn replicaDn = new Dn( schemaManager, SchemaConstants.ADS_DS_REPLICA_ID + "=" + replica.getId()
+ "," + REPL_CONSUMER_DN );
         Entry entry = new DefaultEntry( schemaManager, replicaDn,
-            SchemaConstants.OBJECT_CLASS_AT, "ads-replEventLog",
-            "ads-dsReplicaId", String.valueOf( replica.getId() ),
-            "ads-replAliasDerefMode", replica.getSearchCriteria().getAliasDerefMode().getJndiValue(),
-            "ads-searchBaseDN", replica.getSearchCriteria().getBase().getName(),
-            "ads-replLastSentCsn", replica.getLastSentCsn(),
-            "ads-replSearchScope", replica.getSearchCriteria().getScope().getLdapUrlValue(),
-            "ads-replRefreshNPersist", String.valueOf( replica.isRefreshNPersist() ),
-            "ads-replSearchFilter", replica.getSearchFilter() );
+            SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.ADS_REPL_EVENT_LOG,
+            SchemaConstants.ADS_DS_REPLICA_ID, String.valueOf( replica.getId() ),
+            SchemaConstants.ADS_REPL_ALIAS_DEREF_MODE, replica.getSearchCriteria().getAliasDerefMode().getJndiValue(),
+            SchemaConstants.ADS_SEARCH_BASE_DN, replica.getSearchCriteria().getBase().getName(),
+            SchemaConstants.ADS_REPL_LAST_SENT_CSN, replica.getLastSentCsn(),
+            SchemaConstants.ADS_REPL_SEARCH_SCOPE, replica.getSearchCriteria().getScope().getLdapUrlValue(),
+            SchemaConstants.ADS_REPL_REFRESH_N_PERSIST, String.valueOf( replica.isRefreshNPersist()
),
+            SchemaConstants.ADS_REPL_SEARCH_FILTER, replica.getSearchFilter() );
 
         adminSession.add( entry );
         LOG.debug( "stored replication consumer entry {}", entry.getDn() );
@@ -135,7 +135,7 @@ public class ReplicaDitStoreUtil
         if ( mods == null )
         {
             lastSentCsnAt = new DefaultAttribute( schemaManager
-                .lookupAttributeTypeRegistry( "ads-replLastSentCsn" ) );
+                .lookupAttributeTypeRegistry( SchemaConstants.ADS_REPL_LAST_SENT_CSN ) );
             lastSentCsnAt.add( replica.getLastSentCsn() );
 
             Modification mod = new DefaultModification();
@@ -152,7 +152,7 @@ public class ReplicaDitStoreUtil
             lastSentCsnAt.add( replica.getLastSentCsn() );
         }
 
-        Dn dn = new Dn( schemaManager, "ads-dsReplicaId=" + replica.getId() + "," + REPL_CONSUMER_DN
);
+        Dn dn = new Dn( schemaManager, SchemaConstants.ADS_DS_REPLICA_ID + "=" + replica.getId()
+ "," + REPL_CONSUMER_DN );
         adminSession.modify( dn, mods );
         LOG.debug( "updated last sent CSN of consumer entry {}", dn );
     }
@@ -162,7 +162,7 @@ public class ReplicaDitStoreUtil
     {
         List<ReplicaEventLog> replicas = new ArrayList<ReplicaEventLog>();
 
-        EntryCursor cursor = coreConnection.search( REPL_CONSUMER_DN, "(objectClass=ads-replEventLog)",
+        EntryCursor cursor = coreConnection.search( REPL_CONSUMER_DN, "(" + SchemaConstants.OBJECT_CLASS
+ "=" + SchemaConstants.ADS_REPL_EVENT_LOG + ")",
             SearchScope.ONELEVEL, "+", "*" );
 
         while ( cursor.next() )
@@ -180,33 +180,33 @@ public class ReplicaDitStoreUtil
 
     private ReplicaEventLog convertEntryToReplica( Entry entry ) throws Exception
     {
-        String id = entry.get( "ads-dsReplicaId" ).getString();
+        String id = entry.get( SchemaConstants.ADS_DS_REPLICA_ID ).getString();
         ReplicaEventLog replica = new ReplicaEventLog( Integer.parseInt( id ) );
 
         NotificationCriteria searchCriteria = new NotificationCriteria();
 
-        String aliasMode = entry.get( "ads-replAliasDerefMode" ).getString();
+        String aliasMode = entry.get( SchemaConstants.ADS_REPL_ALIAS_DEREF_MODE ).getString();
         searchCriteria.setAliasDerefMode( AliasDerefMode.getDerefMode( aliasMode ) );
 
-        String baseDn = entry.get( "ads-searchBaseDN" ).getString();
+        String baseDn = entry.get( SchemaConstants.ADS_SEARCH_BASE_DN ).getString();
         searchCriteria.setBase( new Dn( schemaManager, baseDn ) );
 
-        Attribute lastSentCsnAt = entry.get( "ads-replLastSentCsn" );
+        Attribute lastSentCsnAt = entry.get( SchemaConstants.ADS_REPL_LAST_SENT_CSN );
         
         if ( lastSentCsnAt != null )
         {
             replica.setLastSentCsn( lastSentCsnAt.getString() );
         }
 
-        String scope = entry.get( "ads-replSearchScope" ).getString();
+        String scope = entry.get( SchemaConstants.ADS_REPL_SEARCH_SCOPE ).getString();
         int scopeIntVal = SearchScope.getSearchScope( scope );
         searchCriteria.setScope( SearchScope.getSearchScope( scopeIntVal ) );
 
-        String filter = entry.get( "ads-replSearchFilter" ).getString();
+        String filter = entry.get( SchemaConstants.ADS_REPL_SEARCH_FILTER ).getString();
         searchCriteria.setFilter( filter );
         replica.setSearchFilter( filter );
 
-        replica.setRefreshNPersist( Boolean.parseBoolean( entry.get( "ads-replRefreshNPersist"
).getString() ) );
+        replica.setRefreshNPersist( Boolean.parseBoolean( entry.get( SchemaConstants.ADS_REPL_REFRESH_N_PERSIST
).getString() ) );
         
         searchCriteria.setEventMask( EventType.ALL_EVENT_TYPES_MASK );
         replica.setSearchCriteria( searchCriteria );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java?rev=1151533&r1=1151532&r2=1151533&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
Wed Jul 27 16:58:44 2011
@@ -183,7 +183,7 @@ public class SyncReplConsumer implements
         schemaManager = directoryservice.getSchemaManager();
 
         ENTRY_UUID_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ENTRY_UUID_AT
);
-        COOKIE_AT_TYPE = schemaManager.lookupAttributeTypeRegistry( "ads-replCookie" );
+        COOKIE_AT_TYPE = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ADS_REPL_COOKIE
);
 
         ENTRY_UUID_ATOP_SET.add( new AttributeTypeOptions( ENTRY_UUID_AT ) );
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java?rev=1151533&r1=1151532&r2=1151533&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java
Wed Jul 27 16:58:44 2011
@@ -432,22 +432,24 @@ public class ClientServerReplicationIT
                     Dn configDn = new Dn( ds.getSchemaManager(), "ads-replConsumerId=localhost,ou=system"
);
                     config.setConfigEntryDn( configDn );
                     
-                    Entry provConfigEntry = new DefaultEntry( ds.getSchemaManager(), configDn
);
-                    provConfigEntry.add( "objectClass", "ads-replConsumer" );
-                    provConfigEntry.add( "ads-replConsumerId", "localhost" );
-                    provConfigEntry.add( "ads-searchBaseDN", config.getBaseDn() );
-                    provConfigEntry.add( "ads-replProvHostName", config.getRemoteHost() );
-                    provConfigEntry.add( "ads-replProvPort", String.valueOf( config.getRemotePort()
) );
-                    provConfigEntry.add( "ads-replAliasDerefMode", config.getAliasDerefMode().getJndiValue()
);
-                    provConfigEntry.add( "ads-replAttributes", config.getAttributes() );
-                    provConfigEntry.add( "ads-replRefreshInterval", String.valueOf( config.getRefreshInterval()
) );
-                    provConfigEntry.add( "ads-replRefreshNPersist", String.valueOf( config.isRefreshNPersist()
) );
-                    provConfigEntry.add( "ads-replSearchScope", config.getSearchScope().getLdapUrlValue()
);
-                    provConfigEntry.add( "ads-replSearchFilter", config.getFilter() );
-                    provConfigEntry.add( "ads-replSearchSizeLimit", String.valueOf( config.getSearchSizeLimit()
) );
-                    provConfigEntry.add( "ads-replSearchTimeOut", String.valueOf( config.getSearchTimeout()
) );
-                    provConfigEntry.add( "ads-replUserDn", config.getReplUserDn() );
-                    provConfigEntry.add( "ads-replUserPassword", config.getReplUserPassword()
);
+                    Entry provConfigEntry = new DefaultEntry( ds.getSchemaManager(), configDn,
+                        "objectClass: ads-replConsumer",
+                        "ads-replConsumerId: localhost",
+                        "ads-searchBaseDN", config.getBaseDn(),
+                        "ads-replProvHostName", config.getRemoteHost(),
+                        "ads-replProvPort", String.valueOf( config.getRemotePort() ),
+                        "ads-replRefreshInterval", String.valueOf( config.getRefreshInterval()
),
+                        "ads-replRefreshNPersist", String.valueOf( config.isRefreshNPersist()
),
+                        "ads-replSearchScope", config.getSearchScope().getLdapUrlValue(),
+                        "ads-replSearchFilter", config.getFilter(),
+                        "ads-replSearchSizeLimit", String.valueOf( config.getSearchSizeLimit()
),
+                        "ads-replSearchTimeOut", String.valueOf( config.getSearchTimeout()
),
+                        "ads-replUserDn", config.getReplUserDn(),
+                        "ads-replUserPassword", config.getReplUserPassword() );
+                    
+                    provConfigEntry.put( "ads-replAliasDerefMode", config.getAliasDerefMode().getJndiValue()
);
+                    provConfigEntry.put( "ads-replAttributes", config.getAttributes() );
+
                     
                     consumerSession = consumerServer.getDirectoryService().getAdminSession();
                     consumerSession.add( provConfigEntry );

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=1151533&r1=1151532&r2=1151533&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
Wed Jul 27 16:58:44 2011
@@ -263,7 +263,7 @@ public final class SchemaConstants
     public final static String ENTRY_UUID_AT                            = "entryUUID";
     public final static String ENTRY_UUID_AT_OID                        = "1.3.6.1.1.16.4";
 
-    //entryParentId
+    // entryParentId
     public final static String ENTRY_PARENT_ID_AT                       = "entryParentId";
     public final static String ENTRY_PARENT_ID_OID                      = "1.3.6.1.4.1.18060.0.4.1.2.51";
     
@@ -373,7 +373,6 @@ public final class SchemaConstants
     public final static String SEARCHGUIDE_AT                           = "searchguide";
     public final static String SEARCHGUIDE_AT_OID                       = "2.5.4.14";
 
-
     // PostalCode
     public final static String POSTALCODE_AT                            = "postalCode";
     public final static String POSTALCODE_AT_OID                        = "2.5.4.17";
@@ -385,6 +384,7 @@ public final class SchemaConstants
     // PostOfficeBox
     public final static String POSTOFFICEBOX_AT                         = "postOfficeBox";
     public final static String POSTOFFICEBOX_AT_OID                     = "2.5.4.18";
+    
     // Member
     public final static String MEMBER_AT                                = "member";
     public final static String MEMBER_AT_OID                            = "2.5.4.31";
@@ -405,7 +405,7 @@ public final class SchemaConstants
     public final static String EXCLUDE_ALL_COLLECTIVE_ATTRIBUTES_AT     = "excludeAllCollectiveAttributes";
     public final static String EXCLUDE_ALL_COLLECTIVE_ATTRIBUTES_AT_OID = "2.5.18.0";
 
-        // CreateTimestamp
+    // CreateTimestamp
     public final static String CREATE_TIMESTAMP_AT                      = "createTimestamp";
     public final static String CREATE_TIMESTAMP_AT_OID                  = "2.5.18.1";
 
@@ -512,7 +512,122 @@ public final class SchemaConstants
     // subordinateCount, by Novell
     public final static String SUBORDINATE_COUNT_AT                     = "subordinateCount";
     // no official OID in RFCs
+    
 
+    //=========================================================================
+    // LdapServer AT and OC
+    //-------------------------------------------------------------------------
+    // 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";
+
+    //=========================================================================
+    // Replication AT and OC
+    //-------------------------------------------------------------------------
+    // ObjectClasses
+    //-------------------------------------------------------------------------
+    // ads-replEventLog OC
+    public final static String ADS_REPL_EVENT_LOG                        = "ads-replEventLog";
+    public final static String ADS_REPL_EVENT_LOG_OID                    = "1.3.6.1.4.1.18060.0.4.1.3.805";
+    
+    // ads-replConsumer OC
+    public final static String ADS_REPL_CONSUMER                        = "ads-replConsumer";
+    public final static String ADS_REPL_CONSUMER_OID                    = "1.3.6.1.4.1.18060.0.4.1.3.806";
+    
+    //-------------------------------------------------------------------------
+    // AttributeTypes
+    //-------------------------------------------------------------------------
+    // ads-dsReplicaId AT
+    public final static String ADS_DS_REPLICA_ID                        = "ads-dsReplicaId";
+    public final static String ADS_DS_REPLICA_ID_OID                    = "1.3.6.1.4.1.18060.0.4.1.2.112";
+
+    // ads-replConsumerImpl AT
+    public final static String ADS_REPL_CONSUMER_IMPL                   = "ads-replConsumerImpl";
+    public final static String ADS_REPL_CONSUMER_IMPL_OID               = "1.3.6.1.4.1.18060.0.4.1.2.310";
+
+    // ads-replSearchFilter AT
+    public final static String ADS_REPL_SEARCH_FILTER                   = "ads-replSearchFilter";
+    public final static String ADS_REPL_SEARCH_FILTER_OID               = "1.3.6.1.4.1.18060.0.4.1.2.817";
+    
+    // ads-replLastSentCsn AT
+    public final static String ADS_REPL_LAST_SENT_CSN                   = "ads-replLastSentCsn";
+    public final static String ADS_REPL_LAST_SENT_CSN_OID               = "1.3.6.1.4.1.18060.0.4.1.2.818";
+    
+    // ads-replAliasDerefMode AT
+    public final static String ADS_REPL_ALIAS_DEREF_MODE                = "ads-replAliasDerefMode";
+    public final static String ADS_REPL_ALIAS_DEREF_MODE_…ID            = "1.3.6.1.4.1.18060.0.4.1.2.819";
+    
+    // ads-searchBaseDN AT
+    public final static String ADS_SEARCH_BASE_DN                       = "ads-searchBaseDN";
+    public final static String ADS_SEARCH_BASE_DN_OID                   = "1.3.6.1.4.1.18060.0.4.1.2.820";
+    
+    // ads-replSearchScope AT
+    public final static String ADS_REPL_SEARCH_SCOPE                    = "ads-replSearchScope";
+    public final static String ADS_REPL_SEARCH_SCOPE_OID                = "1.3.6.1.4.1.18060.0.4.1.2.821";
+    
+    // ads-replRefreshNPersist AT
+    public final static String ADS_REPL_REFRESH_N_PERSIST               = "ads-replRefreshNPersist";
+    public final static String ADS_REPL_REFRESH_N_PERSIST_POID          = "1.3.6.1.4.1.18060.0.4.1.2.822";
+    
+    // ads-replProvHostName AT
+    public final static String ADS_REPL_PROV_HOST_NAME                  = "ads-replProvHostName";
+    public final static String ADS_REPL_PROV_HOST_NAME_OID              = "1.3.6.1.4.1.18060.0.4.1.2.823";
+    
+    // ads-replProvPort AT
+    public final static String ADS_REPL_PROV_PORT                       = "ads-replProvPort";
+    public final static String ADS_REPL_PROV_PORT_OID                   = "1.3.6.1.4.1.18060.0.4.1.2.824";
+    
+    // ads-replUserDn AT
+    public final static String ADS_REPL_USER_DN                         = "ads-replUserDn";
+    public final static String ADS_REPL_USER_DN_OID                     = "1.3.6.1.4.1.18060.0.4.1.2.825";
+    
+    // ads-replUserPassword AT
+    public final static String ADS_REPL_USER_PASSWORD                   = "ads-replUserPassword";
+    public final static String ADS_REPL_USER_PASSWORD_OID               = "1.3.6.1.4.1.18060.0.4.1.2.826";
+    
+    // ads-replRefreshInterval AT
+    public final static String ADS_REPL_REFRESH_INTERVAL                = "ads-replRefreshInterval";
+    public final static String ADS_REPL_REFRESH_INTERVAL_OID            = "1.3.6.1.4.1.18060.0.4.1.2.827";
+    
+    // ads-replAttributes AT
+    public final static String ADS_REPL_ATTRIBUTES                      = "ads-replAttributes";
+    public final static String ADS_REPL_ATTRIBUTES_OID                  = "1.3.6.1.4.1.18060.0.4.1.2.828";
+    
+    // ads-replSearchSizeLimit AT
+    public final static String ADS_REPL_SEARCH_SIZE_LIMIT               = "ads-replSearchSizeLimit";
+    public final static String ADS_REPL_SEARCH_SIZE_LIMIT_OID           = "1.3.6.1.4.1.18060.0.4.1.2.829";
+    
+    // ads-replSearchTimeOut AT
+    public final static String ADS_REPL_SEARCH_TIMEOUT                  = "ads-replSearchTimeOut";
+    public final static String ADS_REPL_SEARCH_TIMEOUT_OID              = "1.3.6.1.4.1.18060.0.4.1.2.830";
+    
+    // ads-replCookie AT
+    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-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";
+    
+    // ads-replStrictCertValidation AT
+    public final static String ADS_REPL_STRICT_CERT_VALIDATION          = "ads-replStrictCertValidation";
+    public final static String ADS_REPL_STRICT_CERT_VALIDATION_OID      = "1.3.6.1.4.1.18060.0.4.1.2.834";
+    
+    // ads-replPeerCertificate AT
+    public final static String ADS_REPL_PEER_CERTIFICATE                = "ads-replPeerCertificate";
+    public final static String ADS_REPL_PEER_CERTIFICATE_OID            = "1.3.6.1.4.1.18060.0.4.1.2.835";
+    
+    // ads-replProviderId AT
+    public final static String ADS_REPL_PROVIDER_ID                     = "ads-replProviderId";
+    public final static String ADS_REPL_PROVIDER_ID_OID                 = "1.3.6.1.4.1.18060.0.4.1.2.836";
+
+    // ads-replConsumerId AT
+    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";
+
+    
     //-------------------------------------------------------------------------
     // ---- Syntaxes ----------------------------------------------------------
     //-------------------------------------------------------------------------



Mime
View raw message