directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r411687 [2/2] - in /directory/branches/apacheds/optimization: core/src/main/java/org/apache/directory/server/core/ core/src/main/java/org/apache/directory/server/core/authn/ core/src/main/java/org/apache/directory/server/core/authz/ core/sr...
Date Mon, 05 Jun 2006 06:03:55 GMT
Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/DirectoryPartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/DirectoryPartitionNexusProxy.java?rev=411687&r1=411686&r2=411687&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/DirectoryPartitionNexusProxy.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/DirectoryPartitionNexusProxy.java
Sun Jun  4 23:03:54 2006
@@ -45,6 +45,7 @@
 import org.apache.directory.shared.ldap.exception.LdapSizeLimitExceededException;
 import org.apache.directory.shared.ldap.exception.LdapTimeLimitExceededException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -147,9 +148,9 @@
     }
 
 
-    public Name getSuffix( boolean normalized ) throws NamingException
+    public LdapDN getSuffix() throws NamingException
     {
-        return this.configuration.getPartitionNexus().getSuffix( normalized );
+        return this.configuration.getPartitionNexus().getSuffix();
     }
 
 
@@ -266,13 +267,13 @@
     }
 
 
-    public void delete( Name name ) throws NamingException
+    public void delete( LdapDN name ) throws NamingException
     {
         delete( name, null );
     }
 
 
-    public void delete( Name name, Collection bypass ) throws NamingException
+    public void delete( LdapDN name, Collection bypass ) throws NamingException
     {
         ensureStarted();
         InvocationStack stack = InvocationStack.getInstance();
@@ -289,21 +290,21 @@
     }
 
 
-    public void add( String upName, Name normName, Attributes entry ) throws NamingException
+    public void add( LdapDN normName, Attributes entry ) throws NamingException
     {
-        add( upName, normName, entry, null );
+        add( normName, entry, null );
     }
 
 
-    public void add( String upName, Name normName, Attributes entry, Collection bypass )
throws NamingException
+    public void add( LdapDN normName, Attributes entry, Collection bypass ) throws NamingException
     {
         ensureStarted();
         InvocationStack stack = InvocationStack.getInstance();
         stack.push( new Invocation( this, caller, "add", new Object[]
-            { upName, normName, entry }, bypass ) );
+            { normName, entry }, bypass ) );
         try
         {
-            this.configuration.getInterceptorChain().add( upName, normName, entry );
+            this.configuration.getInterceptorChain().add( normName, entry );
         }
         finally
         {
@@ -312,13 +313,13 @@
     }
 
 
-    public void modify( Name name, int modOp, Attributes mods ) throws NamingException
+    public void modify( LdapDN name, int modOp, Attributes mods ) throws NamingException
     {
         modify( name, modOp, mods, null );
     }
 
 
-    public void modify( Name name, int modOp, Attributes mods, Collection bypass ) throws
NamingException
+    public void modify( LdapDN name, int modOp, Attributes mods, Collection bypass ) throws
NamingException
     {
         ensureStarted();
         InvocationStack stack = InvocationStack.getInstance();
@@ -352,13 +353,13 @@
     }
 
 
-    public void modify( Name name, ModificationItem[] mods ) throws NamingException
+    public void modify( LdapDN name, ModificationItem[] mods ) throws NamingException
     {
         modify( name, mods, null );
     }
 
 
-    public void modify( Name name, ModificationItem[] mods, Collection bypass ) throws NamingException
+    public void modify( LdapDN name, ModificationItem[] mods, Collection bypass ) throws
NamingException
     {
         ensureStarted();
         InvocationStack stack = InvocationStack.getInstance();
@@ -557,13 +558,13 @@
     }
 
 
-    public void modifyRn( Name name, String newRn, boolean deleteOldRn ) throws NamingException
+    public void modifyRn( LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException
     {
         modifyRn( name, newRn, deleteOldRn, null );
     }
 
 
-    public void modifyRn( Name name, String newRn, boolean deleteOldRn, Collection bypass
) throws NamingException
+    public void modifyRn( LdapDN name, String newRn, boolean deleteOldRn, Collection bypass
) throws NamingException
     {
         ensureStarted();
         InvocationStack stack = InvocationStack.getInstance();
@@ -581,13 +582,13 @@
     }
 
 
-    public void move( Name oriChildName, Name newParentName ) throws NamingException
+    public void move( LdapDN oriChildName, LdapDN newParentName ) throws NamingException
     {
         move( oriChildName, newParentName, null );
     }
 
 
-    public void move( Name oriChildName, Name newParentName, Collection bypass ) throws NamingException
+    public void move( LdapDN oriChildName, LdapDN newParentName, Collection bypass ) throws
NamingException
     {
         ensureStarted();
         InvocationStack stack = InvocationStack.getInstance();
@@ -604,13 +605,13 @@
     }
 
 
-    public void move( Name oriChildName, Name newParentName, String newRn, boolean deleteOldRn
) throws NamingException
+    public void move( LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn
) throws NamingException
     {
         move( oriChildName, newParentName, newRn, deleteOldRn, null );
     }
 
 
-    public void move( Name oriChildName, Name newParentName, String newRn, boolean deleteOldRn,
Collection bypass )
+    public void move( LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn,
Collection bypass )
         throws NamingException
     {
         ensureStarted();
@@ -773,7 +774,7 @@
      */
 
     public void addNamingListener( EventContext ctx, Name name, ExprNode filter, SearchControls
searchControls,
-        NamingListener namingListener ) throws NamingException
+                                   NamingListener namingListener ) throws NamingException
     {
         InterceptorChain chain = this.configuration.getInterceptorChain();
         EventService interceptor = ( EventService ) chain.get( "eventService" );

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeDirectoryPartition.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeDirectoryPartition.java?rev=411687&r1=411686&r2=411687&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeDirectoryPartition.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreeDirectoryPartition.java
Sun Jun  4 23:03:54 2006
@@ -44,6 +44,7 @@
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.ArrayUtils;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 
 /**
@@ -181,9 +182,10 @@
         Attributes suffixOnDisk = getSuffixEntry();
         if ( suffixOnDisk == null )
         {
-            add( cfg.getSuffix(),
-                cfg.getNormalizedSuffix( factoryCfg.getGlobalRegistries().getMatchingRuleRegistry()
), cfg
-                    .getContextEntry() );
+            Map oids = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry().getNormalizerMapping();
+            LdapDN suffix = new LdapDN( cfg.getSuffix() );
+            LdapDN normalizedSuffix = LdapDN.normalize( suffix, oids );
+            add( normalizedSuffix, cfg.getContextEntry() );
         }
     }
 
@@ -208,7 +210,7 @@
     // ContextPartition Interface Method Implementations
     // ------------------------------------------------------------------------
 
-    public void delete( Name dn ) throws NamingException
+    public void delete( LdapDN dn ) throws NamingException
     {
         BigInteger id = getEntryId( dn.toString() );
 
@@ -230,13 +232,13 @@
     }
 
 
-    public abstract void add( String updn, Name dn, Attributes entry ) throws NamingException;
+    public abstract void add(LdapDN dn, Attributes entry) throws NamingException;
 
 
-    public abstract void modify( Name dn, int modOp, Attributes mods ) throws NamingException;
+    public abstract void modify( LdapDN dn, int modOp, Attributes mods ) throws NamingException;
 
 
-    public abstract void modify( Name dn, ModificationItem[] mods ) throws NamingException;
+    public abstract void modify( LdapDN dn, ModificationItem[] mods ) throws NamingException;
 
 
     public NamingEnumeration list( Name base ) throws NamingException
@@ -296,13 +298,13 @@
     }
 
 
-    public abstract void modifyRn( Name dn, String newRdn, boolean deleteOldRdn ) throws
NamingException;
+    public abstract void modifyRn( LdapDN dn, String newRdn, boolean deleteOldRdn ) throws
NamingException;
 
 
-    public abstract void move( Name oldChildDn, Name newParentDn ) throws NamingException;
+    public abstract void move( LdapDN oldChildDn, LdapDN newParentDn ) throws NamingException;
 
 
-    public abstract void move( Name oldChildDn, Name newParentDn, String newRdn, boolean
deleteOldRdn )
+    public abstract void move( LdapDN oldChildDn, LdapDN newParentDn, String newRdn, boolean
deleteOldRdn )
         throws NamingException;
 
 
@@ -317,7 +319,7 @@
 
     public boolean isSuffix( Name dn ) throws NamingException
     {
-        return getSuffix( true ).equals( dn );
+        return getSuffix().equals( dn );
     }
 
 

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java?rev=411687&r1=411686&r2=411687&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
Sun Jun  4 23:03:54 2006
@@ -158,7 +158,7 @@
         content.add( mainPnl, java.awt.BorderLayout.NORTH );
         getContentPane().add( content, BorderLayout.CENTER );
         // set title
-        setTitle( "Partition: " + this.partition.getSuffix( false ).toString() );
+        setTitle( "Partition: " + this.partition.getSuffix().toString() );
         // add status bar
         getContentPane().add( statusBar, BorderLayout.SOUTH );
         // add menu bar
@@ -353,7 +353,7 @@
         try
         {
             TreePath path = tree.getSelectionModel().getSelectionPath();
-            String parentDn = partition.getSuffix( false ).toString();
+            String parentDn = partition.getSuffix().toString();
 
             if ( null != path )
             {
@@ -397,7 +397,7 @@
 
         if ( null == path )
         {
-            return partition.getSuffix( false ).toString();
+            return partition.getSuffix().toString();
         }
 
         Object last = path.getLastPathComponent();
@@ -416,7 +416,7 @@
         }
         else
         {
-            base = partition.getSuffix( false ).toString();
+            base = partition.getSuffix().toString();
         }
 
         return base;
@@ -450,7 +450,7 @@
 
                 if ( null == partition.getEntryId( ndn.toString() ) )
                 {
-                    partition.add( updn, ndn, attrs );
+                    partition.add(ndn, attrs );
                     load();
                 }
             }
@@ -550,7 +550,7 @@
         }
         else
         {
-            dialog.setBase( partition.getSuffix( false ).toString() );
+            dialog.setBase( partition.getSuffix().toString() );
         }
 
         dialog.addActionListener( new ActionListener()
@@ -867,7 +867,7 @@
         nodes = new HashMap();
 
         Attributes suffix = partition.getSuffixEntry();
-        BigInteger id = partition.getEntryId( partition.getSuffix( false ).toString() );
+        BigInteger id = partition.getEntryId( partition.getSuffix().toString() );
         root = new EntryNode( id, null, partition, suffix, nodes );
 
         /*

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDirectoryPartition.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDirectoryPartition.java?rev=411687&r1=411686&r2=411687&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDirectoryPartition.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmDirectoryPartition.java
Sun Jun  4 23:03:54 2006
@@ -77,10 +77,10 @@
 
     /** the JDBM record manager used by this database */
     private RecordManager recMan;
-    /** the user provided suffix of this backend database */
-    private Name upSuffix;
-    /** the normalized suffix of this backend database */
-    private Name normSuffix;
+    /** the normalized suffix DN of this backend database */
+    private LdapDN normSuffix;
+    /** the user provided suffix DN of this backend database */
+    private LdapDN upSuffix;
     /** the working directory to use for files */
     private File workingDirectory;
     /** the master table storing entries by primary key */
@@ -125,7 +125,8 @@
         throws NamingException
     {
         this.upSuffix = new LdapDN( cfg.getSuffix() );
-        this.normSuffix = cfg.getNormalizedSuffix( factoryCfg.getGlobalRegistries().getMatchingRuleRegistry()
);
+        Map oids = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry().getNormalizerMapping();
+        this.normSuffix = LdapDN.normalize( upSuffix, oids );
 
         File workingDirectory = new File( factoryCfg.getStartupConfiguration().getWorkingDirectory().getPath()
             + File.separator + cfg.getName() );
@@ -648,7 +649,7 @@
         {
             // Complain specifically about aliases to outside naming contexts
             throw new NamingException( "[36] aliasDereferencingProblem -"
-                + " the alias points to an entry outside of the " + upSuffix
+                + " the alias points to an entry outside of the " + upSuffix.toUpName()
                 + " namingContext to an object whose existance cannot be" + " determined."
);
         }
 
@@ -727,7 +728,7 @@
     }
 
 
-    public void add( String updn, Name dn, Attributes entry ) throws NamingException
+    public void add( LdapDN normName, Attributes entry ) throws NamingException
     {
         BigInteger id;
         BigInteger parentId = null;
@@ -740,26 +741,26 @@
         // entry sequences start at 1.
         //
 
-        if ( dn.equals( normSuffix ) )
+        if ( normName.equals( normSuffix ) )
         {
             parentId = BigInteger.ZERO;
         }
         else
         {
-            parentId = getEntryId( dn.getPrefix( 1 ).toString() );
+            parentId = getEntryId( normName.getPrefix( 1 ).toString() );
         }
 
         // don't keep going if we cannot find the parent Id
         if ( parentId == null )
         {
-            throw new LdapNameNotFoundException( "Id for parent '" + dn.getPrefix( 1 ).toString()
+ "' not found!" );
+            throw new LdapNameNotFoundException( "Id for parent '" + normName.getPrefix(
1 ).toString() + "' not found!" );
         }
 
         Attribute objectClass = entry.get( "objectClass" );
 
         if ( objectClass == null )
         {
-            String msg = "Entry " + updn + " contains no objectClass attribute: " + entry;
+            String msg = "Entry " + normName.toUpName() + " contains no objectClass attribute:
" + entry;
 
             throw new LdapSchemaViolationException( msg, ResultCodeEnum.OBJECTCLASSVIOLATION
);
         }
@@ -769,11 +770,11 @@
 
         if ( entry.get( "objectClass" ).contains( DirectoryPartition.ALIAS_OBJECT ) )
         {
-            addAliasIndices( id, dn, ( String ) entry.get( DirectoryPartition.ALIAS_ATTRIBUTE
).get() );
+            addAliasIndices( id, normName, ( String ) entry.get( DirectoryPartition.ALIAS_ATTRIBUTE
).get() );
         }
 
-        ndnIdx.add( dn.toString(), id );
-        updnIdx.add( updn, id );
+        ndnIdx.add( normName.toNormName(), id );
+        updnIdx.add( normName.toUpName(), id );
         hierarchyIdx.add( parentId, id );
 
         // Now work on the user defined indices
@@ -862,20 +863,15 @@
     }
 
 
-    public Name getSuffix( boolean normalized )
+    public LdapDN getSuffix()
     {
-        if ( normalized )
-        {
-            return normSuffix;
-        }
-
-        return upSuffix;
+        return normSuffix;
     }
 
 
     public Attributes getSuffixEntry() throws NamingException
     {
-        BigInteger id = getEntryId( upSuffix.toString() );
+        BigInteger id = getEntryId( normSuffix.toNormName() );
 
         if ( null == id )
         {
@@ -1125,7 +1121,7 @@
     }
 
 
-    public void modify( Name dn, int modOp, Attributes mods ) throws NamingException
+    public void modify( LdapDN dn, int modOp, Attributes mods ) throws NamingException
     {
         NamingEnumeration attrs = null;
         BigInteger id = getEntryId( dn.toString() );
@@ -1174,7 +1170,7 @@
     }
 
 
-    public void modify( Name dn, ModificationItem[] mods ) throws NamingException
+    public void modify( LdapDN dn, ModificationItem[] mods ) throws NamingException
     {
         BigInteger id = getEntryId( dn.toString() );
         Attributes entry = master.get( id );
@@ -1217,10 +1213,10 @@
      * @param dn the normalized distinguished name of the entry to alter
      * @param newRdn the new Rdn to set
      * @param deleteOldRdn whether or not to remove the old Rdn attr/val
-     * @throws NamingException if there are any errors propagating the name 
+     * @throws NamingException if there are any errors propagating the name
      *        changes.
      */
-    public void modifyRn( Name dn, String newRdn, boolean deleteOldRdn ) throws NamingException
+    public void modifyRn( LdapDN dn, String newRdn, boolean deleteOldRdn ) throws NamingException
     {
         String newRdnAttr = NamespaceTools.getRdnAttribute( newRdn );
         String newRdnValue = NamespaceTools.getRdnValue( newRdn );
@@ -1389,7 +1385,7 @@
     }
 
 
-    public void move( Name oldChildDn, Name newParentDn, String newRdn, boolean deleteOldRdn
) throws NamingException
+    public void move( LdapDN oldChildDn, LdapDN newParentDn, String newRdn, boolean deleteOldRdn
) throws NamingException
     {
         BigInteger childId = getEntryId( oldChildDn.toString() );
         modifyRn( oldChildDn, newRdn, deleteOldRdn );
@@ -1397,7 +1393,7 @@
     }
 
 
-    public void move( Name oldChildDn, Name newParentDn ) throws NamingException
+    public void move( LdapDN oldChildDn, LdapDN newParentDn ) throws NamingException
     {
         BigInteger childId = getEntryId( oldChildDn.toString() );
         move( oldChildDn, childId, newParentDn );

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java?rev=411687&r1=411686&r2=411687&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
Sun Jun  4 23:03:54 2006
@@ -247,7 +247,7 @@
     }
 
 
-    public void add( NextInterceptor next, String upName, Name normName, Attributes entry
) throws NamingException
+    public void add(NextInterceptor next, LdapDN normName, Attributes entry) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -256,7 +256,7 @@
         // handle a normal add without following referrals
         if ( refval == null || refval.equals( IGNORE ) )
         {
-            next.add( upName, normName, entry );
+            next.add(normName, entry );
             if ( isReferral( entry ) )
             {
                 lut.referralAdded( normName );
@@ -269,7 +269,7 @@
             Name farthest = lut.getFarthestReferralAncestor( normName );
             if ( farthest == null )
             {
-                next.add( upName, normName, entry );
+                next.add(normName, entry );
                 if ( isReferral( entry ) )
                 {
                     lut.referralAdded( normName );
@@ -279,7 +279,7 @@
 
             Attributes referral = invocation.getProxy().lookup( farthest, DirectoryPartitionNexusProxy.LOOKUP_BYPASS
);
             Attribute refs = referral.get( REF_ATTR );
-            doReferralException( farthest, new LdapDN( upName ), refs );
+            doReferralException( farthest, new LdapDN( normName.toUpName() ), refs );
         }
         else if ( refval.equals( FOLLOW ) )
         {
@@ -332,7 +332,7 @@
     }
 
 
-    public void delete( NextInterceptor next, Name normName ) throws NamingException
+    public void delete( NextInterceptor next, LdapDN normName ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -393,7 +393,7 @@
      * -----------------------------------------------------------------------
      */
 
-    public void move( NextInterceptor next, Name oldName, Name newParent ) throws NamingException
+    public void move( NextInterceptor next, LdapDN oldName, LdapDN newParent ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -459,7 +459,7 @@
     }
 
 
-    public void move( NextInterceptor next, Name oldName, Name newParent, String newRdn,
boolean deleteOldRdn )
+    public void move( NextInterceptor next, LdapDN oldName, LdapDN newParent, String newRdn,
boolean deleteOldRdn )
         throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -526,7 +526,7 @@
     }
 
 
-    public void modifyRn( NextInterceptor next, Name oldName, String newRdn, boolean deleteOldRdn
)
+    public void modifyRn( NextInterceptor next, LdapDN oldName, String newRdn, boolean deleteOldRdn
)
         throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -652,7 +652,7 @@
     }
 
 
-    public void modify( NextInterceptor next, Name name, int modOp, Attributes mods ) throws
NamingException
+    public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws
NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -756,7 +756,7 @@
     }
 
 
-    public void modify( NextInterceptor next, Name name, ModificationItem[] mods ) throws
NamingException
+    public void modify( NextInterceptor next, LdapDN name, ModificationItem[] mods ) throws
NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
@@ -817,7 +817,7 @@
 
         // add referrals immediately after adding the new partition
         DirectoryPartition partition = cfg.getContextPartition();
-        Name suffix = partition.getSuffix( true );
+        Name suffix = partition.getSuffix();
         Invocation invocation = InvocationStack.getInstance().peek();
         NamingEnumeration list = invocation.getProxy().search( suffix, env, getReferralFilter(),
getControls(),
             SEARCH_BYPASS );

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=411687&r1=411686&r2=411687&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
Sun Jun  4 23:03:54 2006
@@ -50,6 +50,7 @@
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapName;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.DITContentRule;
 import org.apache.directory.shared.ldap.schema.DITStructureRule;
@@ -573,7 +574,7 @@
     }
 
 
-    public void modify( NextInterceptor next, Name name, int modOp, Attributes mods ) throws
NamingException
+    public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws
NamingException
     {
         Attributes entry = nexus.lookup( name );
         Attribute objectClass = getResultantObjectClasses( modOp, mods.get( "objectClass"
), entry.get( "objectClass" ) );
@@ -669,7 +670,7 @@
     }
 
 
-    public void modify( NextInterceptor next, Name name, ModificationItem[] mods ) throws
NamingException
+    public void modify( NextInterceptor next, LdapDN name, ModificationItem[] mods ) throws
NamingException
     {
         Attributes entry = nexus.lookup( name );
         Set modset = new HashSet();
@@ -907,7 +908,7 @@
     /**
      * Check that all the attributes exist in the schema for this entry.
      */
-    public void add( NextInterceptor next, String upName, Name normName, Attributes attrs
) throws NamingException
+    public void add(NextInterceptor next, LdapDN normName, Attributes attrs) throws NamingException
     {
         AttributeTypeRegistry atRegistry = this.globalRegistries.getAttributeTypeRegistry();
         NamingEnumeration attrEnum = attrs.getIDs();
@@ -921,6 +922,6 @@
         }
 
         alterObjectClasses( attrs.get( "objectClass" ), this.globalRegistries.getObjectClassRegistry()
);
-        next.add( upName, normName, attrs );
+        next.add(normName, attrs );
     }
 }

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?rev=411687&r1=411686&r2=411687&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
Sun Jun  4 23:03:54 2006
@@ -27,6 +27,7 @@
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
 import org.apache.directory.server.core.schema.ConcreteNameComponentNormalizer;
+import org.apache.directory.server.core.schema.AttributeTypeRegistry;
 
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
@@ -39,9 +40,6 @@
 import org.apache.directory.shared.ldap.message.LockableAttributesImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.SubentriesControl;
-
-// TODO remove DnParser and just use LdapDN instead
-import org.apache.directory.shared.ldap.name.DnParser;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationParser;
@@ -97,10 +95,10 @@
     /** the hash mapping the DN of a subentry to its SubtreeSpecification */
     private final Map subtrees = new HashMap();
     private DirectoryServiceConfiguration factoryCfg;
-    private DnParser dnParser;
     private SubtreeSpecificationParser ssParser;
     private SubtreeEvaluator evaluator;
     private DirectoryPartitionNexus nexus;
+    private AttributeTypeRegistry registry;
 
 
     public void init( DirectoryServiceConfiguration factoryCfg, InterceptorConfiguration
cfg ) throws NamingException
@@ -108,10 +106,9 @@
         super.init( factoryCfg, cfg );
         this.nexus = factoryCfg.getPartitionNexus();
         this.factoryCfg = factoryCfg;
-        ConcreteNameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( factoryCfg.getGlobalRegistries()
-            .getAttributeTypeRegistry() );
+        this.registry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
+        ConcreteNameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( registry
);
         ssParser = new SubtreeSpecificationParser( ncn );
-        dnParser = new DnParser( ncn );
         evaluator = new SubtreeEvaluator( factoryCfg.getGlobalRegistries().getOidRegistry()
);
 
         // prepare to find all subentries in all namingContexts
@@ -125,7 +122,8 @@
         // search each namingContext for subentries
         while ( suffixes.hasNext() )
         {
-            Name suffix = dnParser.parse( ( String ) suffixes.next() );
+            LdapDN suffix = new LdapDN( ( String ) suffixes.next() );
+            suffix = LdapDN.normalize( suffix, registry.getNormalizerMapping() );
             NamingEnumeration subentries = nexus.search( suffix, factoryCfg.getEnvironment(),
filter, controls );
             while ( subentries.hasMore() )
             {
@@ -145,7 +143,9 @@
                     continue;
                 }
 
-                subtrees.put( dnParser.parse( dn ).toString(), ss );
+                LdapDN dnName = new LdapDN( dn );
+                dnName = LdapDN.normalize( dnName, registry.getNormalizerMapping() );
+                subtrees.put( dnName.toString(), ss );
             }
         }
     }
@@ -317,14 +317,14 @@
     }
 
 
-    public void add( NextInterceptor next, String upName, Name normName, Attributes entry
) throws NamingException
+    public void add( NextInterceptor next, LdapDN normName, Attributes entry ) throws NamingException
     {
         Attribute objectClasses = entry.get( "objectClass" );
 
         if ( objectClasses.contains( "subentry" ) )
         {
             // get the name of the administrative point and its administrativeRole attributes
-            Name apName = ( Name ) normName.clone();
+            LdapDN apName = ( LdapDN ) normName.clone();
             apName.remove( normName.size() - 1 );
             Attributes ap = nexus.lookup( apName );
             Attribute administrativeRole = ap.get( "administrativeRole" );
@@ -363,12 +363,12 @@
             }
             catch ( Exception e )
             {
-                String msg = "Failed while parsing subtreeSpecification for " + upName;
+                String msg = "Failed while parsing subtreeSpecification for " + normName.toUpName();
                 log.warn( msg );
                 throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALIDATTRIBUTESYNTAX
);
             }
             subtrees.put( normName.toString(), ss );
-            next.add( upName, normName, entry );
+            next.add(normName, entry );
 
             /* ----------------------------------------------------------------
              * Find the baseDn for the subentry and use that to search the tree
@@ -392,7 +392,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn = LdapDN.normalize( dn, registry.getNormalizerMapping() );
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate.get( "objectClass" ) )
)
                 {
@@ -475,7 +476,7 @@
                 }
             }
 
-            next.add( upName, normName, entry );
+            next.add(normName, entry );
         }
     }
 
@@ -484,7 +485,7 @@
     // Methods dealing subentry deletion
     // -----------------------------------------------------------------------
 
-    public void delete( NextInterceptor next, Name name ) throws NamingException
+    public void delete( NextInterceptor next, LdapDN name ) throws NamingException
     {
         Attributes entry = nexus.lookup( name );
         Attribute objectClasses = entry.get( "objectClass" );
@@ -519,7 +520,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn = LdapDN.normalize( dn, registry.getNormalizerMapping() );
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate.get( "objectClass" ) )
)
                 {
@@ -637,7 +639,7 @@
     }
 
 
-    public void modifyRn( NextInterceptor next, Name name, String newRn, boolean deleteOldRn
) throws NamingException
+    public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
) throws NamingException
     {
         Attributes entry = nexus.lookup( name );
         Attribute objectClasses = entry.get( "objectClass" );
@@ -651,7 +653,9 @@
             baseDn.addAll( ss.getBase() );
             Name newName = ( Name ) name.clone();
             newName.remove( newName.size() - 1 );
-            Name rdn = dnParser.parse( newRn );
+
+            LdapDN rdn = new LdapDN( newRn );
+            rdn = LdapDN.normalize( rdn, registry.getNormalizerMapping() );
             newName.addAll( rdn );
 
             subtrees.put( newName.toString(), ss );
@@ -669,7 +673,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn = LdapDN.normalize( dn, registry.getNormalizerMapping() );
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate.get( "objectClass" ) )
)
                 {
@@ -689,7 +694,7 @@
 
             // calculate the new DN now for use below to modify subentry operational
             // attributes contained within this regular entry with name changes
-            Name newName = ( Name ) name.clone();
+            LdapDN newName = ( LdapDN ) name.clone();
             newName.remove( newName.size() - 1 );
             newName.add( newRn );
             ModificationItem[] mods = getModsOnEntryRdnChange( name, newName, entry );
@@ -702,7 +707,7 @@
     }
 
 
-    public void move( NextInterceptor next, Name oriChildName, Name newParentName, String
newRn, boolean deleteOldRn )
+    public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName, String
newRn, boolean deleteOldRn )
         throws NamingException
     {
         Attributes entry = nexus.lookup( oriChildName );
@@ -717,7 +722,9 @@
             baseDn.addAll( ss.getBase() );
             Name newName = ( Name ) newParentName.clone();
             newName.remove( newName.size() - 1 );
-            Name rdn = dnParser.parse( newRn );
+
+            LdapDN rdn = new LdapDN( newRn );
+            rdn = LdapDN.normalize( rdn, registry.getNormalizerMapping() );
             newName.addAll( rdn );
 
             subtrees.put( newName.toString(), ss );
@@ -736,7 +743,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn = LdapDN.normalize( dn, registry.getNormalizerMapping() );
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate.get( "objectClass" ) )
)
                 {
@@ -757,7 +765,7 @@
 
             // calculate the new DN now for use below to modify subentry operational
             // attributes contained within this regular entry with name changes
-            Name newName = ( Name ) newParentName.clone();
+            LdapDN newName = ( LdapDN ) newParentName.clone();
             newName.add( newRn );
             ModificationItem[] mods = getModsOnEntryRdnChange( oriChildName, newName, entry
);
 
@@ -769,7 +777,7 @@
     }
 
 
-    public void move( NextInterceptor next, Name oriChildName, Name newParentName ) throws
NamingException
+    public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName ) throws
NamingException
     {
         Attributes entry = nexus.lookup( oriChildName );
         Attribute objectClasses = entry.get( "objectClass" );
@@ -801,7 +809,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn = LdapDN.normalize( dn, registry.getNormalizerMapping() );
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate.get( "objectClass" ) )
)
                 {
@@ -822,7 +831,7 @@
 
             // calculate the new DN now for use below to modify subentry operational
             // attributes contained within this regular entry with name changes
-            Name newName = ( Name ) newParentName.clone();
+            LdapDN newName = ( LdapDN ) newParentName.clone();
             newName.add( oriChildName.get( oriChildName.size() - 1 ) );
             ModificationItem[] mods = getModsOnEntryRdnChange( oriChildName, newName, entry
);
 
@@ -838,7 +847,7 @@
     // Methods dealing subentry modification
     // -----------------------------------------------------------------------
 
-    public void modify( NextInterceptor next, Name name, int modOp, Attributes mods ) throws
NamingException
+    public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws
NamingException
     {
         Attributes entry = nexus.lookup( name );
         Attribute objectClasses = entry.get( "objectClass" );
@@ -877,7 +886,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn = LdapDN.normalize( dn, registry.getNormalizerMapping() );
 
                 if ( evaluator.evaluate( ssOld, apName, dn, candidate.get( "objectClass"
) ) )
                 {
@@ -896,7 +906,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn = LdapDN.normalize( dn, registry.getNormalizerMapping() );
 
                 if ( evaluator.evaluate( ssNew, apName, dn, candidate.get( "objectClass"
) ) )
                 {
@@ -911,7 +922,7 @@
     }
 
 
-    public void modify( NextInterceptor next, Name name, ModificationItem[] mods ) throws
NamingException
+    public void modify( NextInterceptor next, LdapDN name, ModificationItem[] mods ) throws
NamingException
     {
         Attributes entry = nexus.lookup( name );
         Attribute objectClasses = entry.get( "objectClass" );
@@ -961,7 +972,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn = LdapDN.normalize( dn, registry.getNormalizerMapping() );
 
                 if ( evaluator.evaluate( ssOld, apName, dn, candidate.get( "objectClass"
) ) )
                 {
@@ -980,7 +992,8 @@
             {
                 SearchResult result = ( SearchResult ) subentries.next();
                 Attributes candidate = result.getAttributes();
-                Name dn = dnParser.parse( result.getName() );
+                LdapDN dn = new LdapDN( result.getName() );
+                dn = LdapDN.normalize( dn, registry.getNormalizerMapping() );
 
                 if ( evaluator.evaluate( ssNew, apName, dn, candidate.get( "objectClass"
) ) )
                 {
@@ -1291,12 +1304,18 @@
 
             if ( !result.isRelative() )
             {
-                String normalizedDn = dnParser.parse( dn ).toString();
+                LdapDN ndn = new LdapDN( dn );
+                ndn = LdapDN.normalize( ndn, registry.getNormalizerMapping() );
+                String normalizedDn = ndn.toString();
                 return !subtrees.containsKey( normalizedDn );
             }
 
-            Name name = dnParser.parse( invocation.getCaller().getNameInNamespace() );
-            name.addAll( dnParser.parse( result.getName() ) );
+            LdapDN name = new LdapDN( invocation.getCaller().getNameInNamespace() );
+            name = LdapDN.normalize( name, registry.getNormalizerMapping() );
+
+            LdapDN rest = new LdapDN( result.getName() );
+            rest = LdapDN.normalize( rest, registry.getNormalizerMapping() );
+            name.addAll( rest );
             return !subtrees.containsKey( name.toString() );
         }
     }
@@ -1346,13 +1365,18 @@
 
             if ( !result.isRelative() )
             {
-                String normalizedDn = dnParser.parse( dn ).toString();
-                return subtrees.containsKey( normalizedDn );
+                LdapDN ndn = new LdapDN( dn );
+                ndn = LdapDN.normalize( ndn, registry.getNormalizerMapping() );
+                return subtrees.containsKey( ndn.toNormName() );
             }
 
-            Name name = dnParser.parse( invocation.getCaller().getNameInNamespace() );
-            name.addAll( dnParser.parse( result.getName() ) );
-            return subtrees.containsKey( name.toString() );
+            LdapDN name = new LdapDN( invocation.getCaller().getNameInNamespace() );
+            name = LdapDN.normalize( name, registry.getNormalizerMapping() );
+
+            LdapDN rest = new LdapDN( result.getName() );
+            rest = LdapDN.normalize( rest, registry.getNormalizerMapping() );
+            name.addAll( rest );
+            return subtrees.containsKey( name.toNormName() );
         }
     }
 }

Modified: directory/branches/apacheds/optimization/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=411687&r1=411686&r2=411687&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
(original)
+++ directory/branches/apacheds/optimization/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
Sun Jun  4 23:03:54 2006
@@ -25,17 +25,13 @@
 import org.apache.directory.server.core.configuration.DirectoryPartitionConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
-import org.apache.directory.server.core.interceptor.Interceptor;
-import org.apache.directory.server.core.interceptor.InterceptorChain;
-import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.DeadContext;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.name.LdapName;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import javax.naming.NamingException;
 import javax.naming.Name;
@@ -58,7 +54,6 @@
     private final MockInterceptor[] interceptorArray =
         { new MockInterceptor( "0" ), new MockInterceptor( "1" ), new MockInterceptor( "2"
),
             new MockInterceptor( "3" ), new MockInterceptor( "4" ) };
-    //    private final static Logger log = LoggerFactory.getLogger( InterceptorChainTest.class
);
     private InterceptorChain chain;
     private List interceptors = new ArrayList( interceptorArray.length );
 
@@ -333,29 +328,29 @@
         }
 
 
-        public void delete( NextInterceptor next, Name name ) throws NamingException
+        public void delete( NextInterceptor next, LdapDN name ) throws NamingException
         {
             interceptors.add( this );
             next.delete( name );
         }
 
 
-        public void add( NextInterceptor next, String userProvidedName, Name normalizedName,
Attributes entry )
+        public void add(NextInterceptor next, LdapDN name, Attributes entry)
             throws NamingException
         {
             interceptors.add( this );
-            next.add( userProvidedName, normalizedName, entry );
+            next.add(name, entry );
         }
 
 
-        public void modify( NextInterceptor next, Name name, int modOp, Attributes attributes
) throws NamingException
+        public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes attributes
) throws NamingException
         {
             interceptors.add( this );
             next.modify( name, modOp, attributes );
         }
 
 
-        public void modify( NextInterceptor next, Name name, ModificationItem[] items ) throws
NamingException
+        public void modify( NextInterceptor next, LdapDN name, ModificationItem[] items )
throws NamingException
         {
             interceptors.add( this );
             next.modify( name, items );
@@ -405,7 +400,7 @@
         }
 
 
-        public void modifyRn( NextInterceptor next, Name name, String newRn, boolean deleteOldRn
)
+        public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn
)
             throws NamingException
         {
             interceptors.add( this );
@@ -413,14 +408,14 @@
         }
 
 
-        public void move( NextInterceptor next, Name oldName, Name newParentName ) throws
NamingException
+        public void move( NextInterceptor next, LdapDN oldName, LdapDN newParentName ) throws
NamingException
         {
             interceptors.add( this );
             next.move( oldName, newParentName );
         }
 
 
-        public void move( NextInterceptor next, Name oldName, Name newParentName, String
newRn, boolean deleteOldRn )
+        public void move( NextInterceptor next, LdapDN oldName, LdapDN newParentName, String
newRn, boolean deleteOldRn )
             throws NamingException
         {
             interceptors.add( this );

Propchange: directory/branches/apacheds/optimization/server-sar/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Jun  4 23:03:54 2006
@@ -1,4 +1,6 @@
 .classpath
+*.iml
+*.iws
 target
 .wtpmodules
 .settings



Mime
View raw message