directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r732170 - in /directory/apacheds/trunk: core-constants/src/main/java/org/apache/directory/server/constants/ mitosis/src/main/java/org/apache/directory/mitosis/common/ mitosis/src/main/java/org/apache/directory/mitosis/operation/ mitosis/src...
Date Tue, 06 Jan 2009 23:28:46 GMT
Author: elecharny
Date: Tue Jan  6 15:28:44 2009
New Revision: 732170

URL: http://svn.apache.org/viewvc?rev=732170&view=rev
Log:
o Added new constants to ApacheSchemaConstants (entryUUID, entryCSN, entryDeleted)
o Used them all over the code in place of the static strings
o Removed the Constants.[entryUUID, EntryCSN, entry_DELETED] declarations
o Simplified the search filter for replciation

Modified:
    directory/apacheds/trunk/core-constants/src/main/java/org/apache/directory/server/constants/ApacheSchemaConstants.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java

Modified: directory/apacheds/trunk/core-constants/src/main/java/org/apache/directory/server/constants/ApacheSchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-constants/src/main/java/org/apache/directory/server/constants/ApacheSchemaConstants.java?rev=732170&r1=732169&r2=732170&view=diff
==============================================================================
--- directory/apacheds/trunk/core-constants/src/main/java/org/apache/directory/server/constants/ApacheSchemaConstants.java
(original)
+++ directory/apacheds/trunk/core-constants/src/main/java/org/apache/directory/server/constants/ApacheSchemaConstants.java
Tue Jan  6 15:28:44 2009
@@ -112,21 +112,9 @@
     String APACHE_ALIAS_AT                          = "apacheAlias";
     String APACHE_ALIAS_OID                         = "1.3.6.1.4.1.18060.0.4.1.2.7";
 
-    // entryDeleted
-    String ENTRY_DELETED_AT                         = "entryDeleted";
-    String ENTRY_DELETED_OID                        = "1.3.6.1.4.1.18060.0.4.1.2.31";
-
-    // SchemaModifiersName
-    String SCHEMA_MODIFIERS_NAME_AT                 = "schemaModifiersName";
-    String SCHEMA_MODIFIERS_NAME_AT_OID             = "";
-    
-    // SchemaModifyTimestamp
-    String SCHEMA_MODIFY_TIMESTAMP_AT               = "schemaModifyTimestamp";
-    String SCHEMA_MODIFY_TIMESTAMP_AT_OID           = "";
-    
-    // SubschemaSubentryName
-    String SUBSCHEMA_SUBENTRY_NAME_AT               = "subschemaSubentryName";
-    String SUBSCHEMA_SUBENTRY_NAME_AT_OID           = "";
+    // PrefNodeName
+    String PREF_NODE_NAME_AT                        = "prefNodeName";
+    String PREF_NODE_NAME_AT_OID                    = "1.3.6.1.4.1.18060.0.4.1.2.8";
     
     // CatalogEntryName
     String APACHE_CATALOGUE_ENTRY_NAME_AT           = "apacheCatalogEntryName";
@@ -143,6 +131,27 @@
     String UNIX_FILE_AT                             = "unixFilePath";
     String UNIX_FILE_AT_OID                         = "1.3.6.1.4.1.18060.0.4.1.2.20";
 
-    String PREF_NODE_NAME_AT                        = "prefNodeName";
-    String PREF_NODE_NAME_AT_OID                    = "1.3.6.1.4.1.18060.0.4.1.2.8";
+    // entryUUID
+    String ENTRY_UUID_AT                            = "entryUUID";
+    String ENTRY_UUID_OID                           = "1.3.6.1.4.1.18060.0.4.1.2.29";
+    
+    // entryCSN
+    String ENTRY_CSN_AT                             = "entryCSN";
+    String ENTRY_CSN_OID                            = "1.3.6.1.4.1.18060.0.4.1.2.30";
+    
+    // entryDeleted
+    String ENTRY_DELETED_AT                         = "entryDeleted";
+    String ENTRY_DELETED_OID                        = "1.3.6.1.4.1.18060.0.4.1.2.31";
+    
+    // SchemaModifyTimestamp
+    String SCHEMA_MODIFY_TIMESTAMP_AT               = "schemaModifyTimestamp";
+    String SCHEMA_MODIFY_TIMESTAMP_AT_OID           = "1.3.6.1.4.1.18060.0.4.1.2.35";
+
+    // SchemaModifiersName
+    String SCHEMA_MODIFIERS_NAME_AT                 = "schemaModifiersName";
+    String SCHEMA_MODIFIERS_NAME_AT_OID             = "1.3.6.1.4.1.18060.0.4.1.2.36";
+    
+    // SubschemaSubentryName
+    String SUBSCHEMA_SUBENTRY_NAME_AT               = "subschemaSubentryName";
+    String SUBSCHEMA_SUBENTRY_NAME_AT_OID           = "1.3.6.1.4.1.18060.0.4.1.2.37";
 }

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java?rev=732170&r1=732169&r2=732170&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
Tue Jan  6 15:28:44 2009
@@ -22,10 +22,10 @@
 
 import javax.naming.NamingException;
 
+import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.filtering.EntryFilter;
 import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
-import org.apache.directory.shared.ldap.entry.EntryAttribute;
 
 
 /**
@@ -36,24 +36,6 @@
 public class Constants
 {
     /**
-     * The name of the attribute that represents the {@link UUID} of an
-     * LDAP entry.
-     */
-    public static final String ENTRY_UUID = "entryUUID";
-    
-    /**
-     * The name of the attribute that represents the {@link CSN} of an LDAP
-     * entry.
-     */
-    public static final String ENTRY_CSN = "entryCSN";
-    
-    /**
-     * The name of the attribute that determines if an entry is actually
-     * deleted or not (even if it exists in a DIT.)
-     */
-    public static final String ENTRY_DELETED = "entryDeleted";
-    
-    /**
      * A {@link SearchResultFilter} that filters out the entries whose
      * {@link #ENTRY_DELETED} attribute is <tt>TRUE</tt>.
      */
@@ -62,9 +44,7 @@
         public boolean accept( SearchingOperationContext operation, ClonedServerEntry entry
)
             throws NamingException
         {
-            EntryAttribute deleted = entry.get( ENTRY_DELETED );
-            Object value = deleted == null ? null : deleted.get();
-            return ( value == null || !"TRUE".equalsIgnoreCase( value.toString() ) );
+            return !entry.contains( ApacheSchemaConstants.ENTRY_DELETED_AT, "TRUE" );
         }
     };
 

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=732170&r1=732169&r2=732170&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
Tue Jan  6 15:28:44 2009
@@ -24,6 +24,7 @@
 import org.apache.directory.mitosis.common.CSNFactory;
 import org.apache.directory.mitosis.common.Constants;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DefaultCoreSession;
@@ -133,15 +134,15 @@
 
         // Insert 'entryUUID' and 'entryDeleted'.
         ServerEntry cloneEntry = ( ServerEntry ) entry.clone();
-        cloneEntry.removeAttributes( Constants.ENTRY_UUID );
-        cloneEntry.removeAttributes( Constants.ENTRY_DELETED );
-        cloneEntry.put( Constants.ENTRY_UUID, UUID.randomUUID().toString() );
-        cloneEntry.put( Constants.ENTRY_DELETED, "FALSE" );
+        cloneEntry.removeAttributes( ApacheSchemaConstants.ENTRY_UUID_AT );
+        cloneEntry.removeAttributes( ApacheSchemaConstants.ENTRY_DELETED_AT );
+        cloneEntry.put( ApacheSchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString()
);
+        cloneEntry.put( ApacheSchemaConstants.ENTRY_DELETED_AT, "FALSE" );
 
         // NOTE: We inlined addDefaultOperations() because ApacheDS currently
         // creates an index entry only for ADD operation (and not for
         // MODIFY operation)
-        cloneEntry.put( Constants.ENTRY_CSN, csn.toOctetString() );
+        cloneEntry.put( ApacheSchemaConstants.ENTRY_CSN_AT, csn.toOctetString() );
 
         return new AddEntryOperation( registries, csn, cloneEntry );
     }
@@ -150,7 +151,7 @@
     /**
      * Creates a new {@link Operation} that performs "delete" operation.
      * The created {@link Operation} doesn't actually delete the entry.
-     * Instead, it sets {@link Constants#ENTRY_DELETED} to "TRUE". 
+     * Instead, it sets {@link ApacheSchemaConstants.ENTRY_DELETED_AT} to "TRUE". 
      */
     public Operation newDelete( LdapDN normalizedName ) throws NamingException
     {
@@ -160,8 +161,8 @@
         // Transform into replace operation.
         result.add( new ReplaceAttributeOperation( registries, csn, normalizedName, 
             new DefaultServerAttribute( 
-                Constants.ENTRY_DELETED, 
-                attributeRegistry.lookup( Constants.ENTRY_DELETED ),
+                ApacheSchemaConstants.ENTRY_DELETED_AT, 
+                attributeRegistry.lookup( ApacheSchemaConstants.ENTRY_DELETED_AT ),
                 "TRUE" ) ) );
 
         return addDefaultOperations( result, csn, normalizedName );
@@ -202,8 +203,8 @@
                 csn, 
                 normalizedName, 
                 new DefaultServerAttribute( 
-                    Constants.ENTRY_DELETED,
-                    attributeRegistry.lookup( Constants.ENTRY_DELETED ),
+                    ApacheSchemaConstants.ENTRY_DELETED_AT,
+                    attributeRegistry.lookup( ApacheSchemaConstants.ENTRY_DELETED_AT ),
                     "FALSE" ) ) );
 
         return addDefaultOperations( result, csn, normalizedName );
@@ -303,8 +304,8 @@
                     csn, 
                     oldEntryName, 
                     new DefaultServerAttribute( 
-                        Constants.ENTRY_DELETED,
-                        attributeRegistry.lookup( Constants.ENTRY_DELETED ),
+                        ApacheSchemaConstants.ENTRY_DELETED_AT,
+                        attributeRegistry.lookup( ApacheSchemaConstants.ENTRY_DELETED_AT
),
                         "TRUE" ) ) );
 
             // Get the old entry attributes and replace RDN if required
@@ -384,7 +385,7 @@
         if ( nexus.hasEntry( new EntryOperationContext( adminSession, newEntryName ) ) )
         {
             ServerEntry entry = nexus.lookup( new LookupOperationContext( adminSession, newEntryName
) );
-            EntryAttribute deleted = entry.get( Constants.ENTRY_DELETED );
+            EntryAttribute deleted = entry.get( ApacheSchemaConstants.ENTRY_DELETED_AT );
             Object value = deleted == null ? null : deleted.get();
 
             /*
@@ -416,8 +417,8 @@
                 csn, 
                 normalizedName, 
                 new DefaultServerAttribute( 
-                    Constants.ENTRY_DELETED,
-                    attributeRegistry.lookup( Constants.ENTRY_CSN ),
+                    ApacheSchemaConstants.ENTRY_DELETED_AT,
+                    attributeRegistry.lookup( ApacheSchemaConstants.ENTRY_CSN_AT ),
                     csn.toOctetString() ) ) );
 
         return result;

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java?rev=732170&r1=732169&r2=732170&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
Tue Jan  6 15:28:44 2009
@@ -22,6 +22,7 @@
 
 import javax.naming.NameNotFoundException;
 
+import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.ServerEntry;
@@ -54,7 +55,7 @@
             return true;
         }
 
-        EntryAttribute entryCSNAttr = entry.get( Constants.ENTRY_CSN );
+        EntryAttribute entryCSNAttr = entry.get( ApacheSchemaConstants.ENTRY_CSN_AT );
 
         if ( entryCSNAttr == null )
         {

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java?rev=732170&r1=732169&r2=732170&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
Tue Jan  6 15:28:44 2009
@@ -31,6 +31,7 @@
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerContextHandler;
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerProtocolHandler;
 import org.apache.directory.mitosis.store.ReplicationStore;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DefaultCoreSession;
@@ -366,7 +367,7 @@
     {
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        ctrl.setReturningAttributes( new String[] { "entryCSN", "entryDeleted" } );
+        ctrl.setReturningAttributes( new String[] { "entryCSN", ApacheSchemaConstants.ENTRY_DELETED_AT
} );
 
         LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
         adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
@@ -498,7 +499,7 @@
             // Look for 'entryDeleted' attribute is in attrIds.
             for ( String attrId:attrIds )
             {
-                if ( Constants.ENTRY_DELETED.equals( attrId ) )
+                if ( ApacheSchemaConstants.ENTRY_DELETED_AT.equalsIgnoreCase( attrId ) )
                 {
                     found = true;
                     break;
@@ -510,7 +511,7 @@
             {
                 String[] newAttrIds = new String[attrIds.length + 1];
                 System.arraycopy( attrIds, 0, newAttrIds, 0, attrIds.length );
-                newAttrIds[attrIds.length] = Constants.ENTRY_DELETED;
+                newAttrIds[attrIds.length] = ApacheSchemaConstants.ENTRY_DELETED_AT;
                 lookupContext.setAttrsId( newAttrIds );
             }
         }
@@ -546,7 +547,7 @@
             String[] oldAttrIds = searchControls.getReturningAttributes();
             String[] newAttrIds = new String[oldAttrIds.length + 1];
             System.arraycopy( oldAttrIds, 0, newAttrIds, 0, oldAttrIds.length );
-            newAttrIds[oldAttrIds.length] = Constants.ENTRY_DELETED.toLowerCase();
+            newAttrIds[oldAttrIds.length] = ApacheSchemaConstants.ENTRY_DELETED_AT.toLowerCase();
             searchControls.setReturningAttributes( newAttrIds );
         }
 
@@ -577,7 +578,7 @@
             return true;
         }
 
-        return entry.contains( Constants.ENTRY_DELETED, "TRUE" );
+        return entry.contains( ApacheSchemaConstants.ENTRY_DELETED_AT, "TRUE" );
     }
 
 

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java?rev=732170&r1=732169&r2=732170&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
Tue Jan  6 15:28:44 2009
@@ -41,6 +41,7 @@
 import org.apache.directory.mitosis.service.protocol.message.LoginMessage;
 import org.apache.directory.mitosis.store.ReplicationLogIterator;
 import org.apache.directory.mitosis.store.ReplicationStore;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.DefaultCoreSession;
@@ -405,7 +406,7 @@
                 ServerEntry entry = cursor.get();
 
                 // Skip entries without entryCSN attribute.
-                EntryAttribute entryCSNAttr = entry.get( org.apache.directory.mitosis.common.Constants.ENTRY_CSN
);
+                EntryAttribute entryCSNAttr = entry.get( ApacheSchemaConstants.ENTRY_CSN_AT
);
 
                 if ( entryCSNAttr == null )
                 {



Mime
View raw message