Package org.apache.directory.server.core.api

Examples of org.apache.directory.server.core.api.ReferralManager


        // Normalize the modifyContext Dn
        Dn dn = modifyContext.getDn();
        dn.apply( directoryService.getSchemaManager() );

        ReferralManager referralManager = directoryService.getReferralManager();

        // We have to deal with the referral first
        referralManager.lockRead();

        // Check if we have an ancestor for this Dn
        Entry parentEntry = referralManager.getParentReferral( dn );

        if ( parentEntry != null )
        {
            if ( referralManager.isReferral( dn ) )
            {
                // This is a referral. We can delete it if the ManageDsaIt flag is true
                // Otherwise, we just throw a LdapReferralException
                if ( !modifyContext.isReferralIgnored() )
                {
                    // Throw a Referral Exception
                    // Unlock the referral manager
                    referralManager.unlock();

                    // We have found a parent referral for the current Dn
                    Dn childDn = dn.getDescendantOf( parentEntry.getDn() );

                    LdapReferralException exception = buildReferralException( parentEntry, childDn );
                    throw exception;
                }
            }
            else if ( referralManager.hasParentReferral( dn ) )
            {
                // We can't delete an entry which has an ancestor referral

                // Depending on the Context.REFERRAL property value, we will throw
                // a different exception.
                if ( modifyContext.isReferralIgnored() )
                {
                    referralManager.unlock();

                    // We have found a parent referral for the current Dn
                    Dn childDn = dn.getDescendantOf( parentEntry.getDn() );

                    LdapPartialResultException exception = buildLdapPartialResultException( childDn );
                    throw exception;
                }
                else
                {
                    // Unlock the referral manager
                    referralManager.unlock();

                    // We have found a parent referral for the current Dn
                    Dn childDn = dn.getDescendantOf( parentEntry.getDn() );

                    LdapReferralException exception = buildReferralException( parentEntry, childDn );
                    throw exception;
                }
            }
        }

        // Unlock the ReferralManager
        referralManager.unlock();

        // populate the context with the old entry
        eagerlyPopulateFields( modifyContext );

        // Call the Modify method
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.api.ReferralManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.