push( opContext );
try
{
// Normalize the opContext DN
DN dn = opContext.getDn();
dn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
// We have to deal with the referral first
directoryService.getReferralManager().lockRead();
// Check if we have an ancestor for this DN
ServerEntry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
if ( parentEntry != null )
{
// We have found a parent referral for the current DN
DN childDn = (DN)dn.getSuffix( parentEntry.getDn().size() );
if ( directoryService.getReferralManager().isReferral( dn ) )
{
// This is a referral. We can delete it if the ManageDsaIt flag is true
// Otherwise, we just throw a LdapReferralException
if ( !opContext.isReferralIgnored() )
{
// Throw a Referral Exception
// Unlock the referral manager
directoryService.getReferralManager().unlock();
ReferralException exception = buildReferralException( parentEntry, childDn );
throw exception;
}
}
else if ( directoryService.getReferralManager().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 ( opContext.isReferralIgnored() )
{
directoryService.getReferralManager().unlock();
PartialResultException exception = buildPartialResultException( childDn );
throw exception;
}
else
{
// Unlock the referral manager
directoryService.getReferralManager().unlock();
ReferralException exception = buildReferralException( parentEntry, childDn );
throw exception;
}
}
}
// Now, check the destination
// Normalize the opContext DN
DN parentDn = opContext.getParent();
parentDn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
// If he parent DN is a referral, or has a referral ancestor, we have to issue a AffectMultipleDsas result
// as stated by RFC 3296 Section 5.6.2
if ( directoryService.getReferralManager().isReferral( parentDn ) ||
directoryService.getReferralManager().hasParentReferral( parentDn ) )