You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2011/11/12 19:24:43 UTC
svn commit: r1201297 [4/9] - in /directory/apacheds/branches/apacheds-txns:
all/ apache-felix/ core-annotations/ core-api/
core-api/src/main/java/org/apache/directory/server/core/api/
core-api/src/main/java/org/apache/directory/server/core/api/intercep...
Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java Sat Nov 12 18:24:38 2011
@@ -29,13 +29,12 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.api.ReferralManager;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.InterceptorChain;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.GetRootDSEOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.GetRootDseOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.HasEntryOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -45,7 +44,6 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.api.interceptor.context.RenameOperationContext;
import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.api.interceptor.context.UnbindOperationContext;
-import org.apache.directory.server.core.api.invocation.InvocationStack;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.entry.Attribute;
@@ -281,53 +279,46 @@ public class DefaultOperationManager imp
LOG_CHANGES.debug( ">> AddOperation : {}", addContext );
ensureStarted();
- push( addContext );
- try
+ // Normalize the addContext Dn
+ Dn dn = addContext.getDn();
+ dn.apply( directoryService.getSchemaManager() );
+
+ // We have to deal with the referral first
+ directoryService.getReferralManager().lockRead();
+
+ if ( directoryService.getReferralManager().hasParentReferral( dn ) )
{
- // Normalize the addContext Dn
- Dn dn = addContext.getDn();
- dn.apply( directoryService.getSchemaManager() );
-
- // We have to deal with the referral first
- directoryService.getReferralManager().lockRead();
-
- if ( directoryService.getReferralManager().hasParentReferral( dn ) )
+ Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
+ Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
+
+ // Depending on the Context.REFERRAL property value, we will throw
+ // a different exception.
+ if ( addContext.isReferralIgnored() )
{
- Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
- Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-
- // Depending on the Context.REFERRAL property value, we will throw
- // a different exception.
- if ( addContext.isReferralIgnored() )
- {
- directoryService.getReferralManager().unlock();
-
- LdapPartialResultException exception = buildLdapPartialResultException( childDn );
- throw exception;
- }
- else
- {
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralException( parentEntry, childDn );
- throw exception;
- }
+ directoryService.getReferralManager().unlock();
+
+ LdapPartialResultException exception = buildLdapPartialResultException( childDn );
+ throw exception;
}
else
{
- // Unlock the ReferralManager
+ // Unlock the referral manager
directoryService.getReferralManager().unlock();
-
- // Call the Add method
- InterceptorChain interceptorChain = directoryService.getInterceptorChain();
- interceptorChain.add( addContext );
+
+ LdapReferralException exception = buildReferralException( parentEntry, childDn );
+ throw exception;
}
}
- finally
+ else
{
- pop();
+ // Unlock the ReferralManager
+ directoryService.getReferralManager().unlock();
+
+ // Call the Add method
+ Interceptor head = directoryService.getInterceptor( addContext.getNextInterceptor() );
+
+ head.add( addContext );
}
LOG.debug( "<< AddOperation successful" );
@@ -343,21 +334,13 @@ public class DefaultOperationManager imp
LOG.debug( ">> BindOperation : {}", bindContext );
ensureStarted();
- push( bindContext );
-
- try
- {
- // Call the Delete method
- Interceptor head = directoryService.getInterceptor( bindContext.getNextInterceptor() );
- head.bind( bindContext );
- }
- finally
- {
- pop();
+ // Call the Delete method
+ Interceptor head = directoryService.getInterceptor( bindContext.getNextInterceptor() );
+
+ head.bind( bindContext );
- LOG.debug( "<< BindOperation successful" );
- }
+ LOG.debug( "<< BindOperation successful" );
}
@@ -369,78 +352,71 @@ public class DefaultOperationManager imp
LOG.debug( ">> CompareOperation : {}", compareContext );
ensureStarted();
- push( compareContext );
-
- try
- {
- // Normalize the compareContext Dn
- Dn dn = compareContext.getDn();
- dn.apply( directoryService.getSchemaManager() );
-
- // We have to deal with the referral first
- directoryService.getReferralManager().lockRead();
-
- // Check if we have an ancestor for this Dn
- Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-
- if ( parentEntry != null )
+ // Normalize the compareContext Dn
+ Dn dn = compareContext.getDn();
+ dn.apply( directoryService.getSchemaManager() );
+
+ // We have to deal with the referral first
+ directoryService.getReferralManager().lockRead();
+
+ // Check if we have an ancestor for this Dn
+ Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
+
+ if ( parentEntry != null )
+ {
+ // We have found a parent referral for the current Dn
+ Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
+
+ if ( directoryService.getReferralManager().isReferral( dn ) )
{
- // We have found a parent referral for the current Dn
- Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-
- 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 ( !compareContext.isReferralIgnored() )
{
- // This is a referral. We can delete it if the ManageDsaIt flag is true
- // Otherwise, we just throw a LdapReferralException
- if ( !compareContext.isReferralIgnored() )
- {
- // Throw a Referral Exception
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralException( parentEntry, childDn );
- throw exception;
- }
- }
- else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
- {
- // Depending on the Context.REFERRAL property value, we will throw
- // a different exception.
- if ( compareContext.isReferralIgnored() )
- {
- directoryService.getReferralManager().unlock();
-
- LdapPartialResultException exception = buildLdapPartialResultException( childDn );
- throw exception;
- }
- else
- {
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralException( parentEntry, childDn );
- throw exception;
- }
+ // Throw a Referral Exception
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralException( parentEntry, childDn );
+ throw exception;
+ }
+ }
+ else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
+ {
+ // Depending on the Context.REFERRAL property value, we will throw
+ // a different exception.
+ if ( compareContext.isReferralIgnored() )
+ {
+ directoryService.getReferralManager().unlock();
+
+ LdapPartialResultException exception = buildLdapPartialResultException( childDn );
+ throw exception;
+ }
+ else
+ {
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralException( parentEntry, childDn );
+ throw exception;
}
}
-
- // Unlock the ReferralManager
- directoryService.getReferralManager().unlock();
-
- // populate the context with the old entry
- compareContext.setOriginalEntry( getOriginalEntry( compareContext ) );
-
- // Call the Compare method
- Interceptor head = directoryService.getInterceptor( compareContext.getNextInterceptor() );
-
- return head.compare( compareContext );
- }
- finally
- {
- pop();
-
- LOG.debug( "<< CompareOperation successful" );
}
+
+ // Unlock the ReferralManager
+ directoryService.getReferralManager().unlock();
+
+ // populate the context with the old entry
+ compareContext.setOriginalEntry( getOriginalEntry( compareContext ) );
+
+ // Call the Compare method
+ Interceptor head = directoryService.getInterceptor( compareContext.getNextInterceptor() );
+
+ boolean result = head.compare( compareContext );
+
+ LOG.debug( "<< CompareOperation successful" );
+
+ return result;
}
@@ -453,77 +429,69 @@ public class DefaultOperationManager imp
LOG_CHANGES.debug( ">> DeleteOperation : {}", deleteContext );
ensureStarted();
- push( deleteContext );
-
- try
- {
- // Normalize the deleteContext Dn
- Dn dn = deleteContext.getDn();
- dn.apply( directoryService.getSchemaManager() );
-
- // We have to deal with the referral first
- directoryService.getReferralManager().lockRead();
- Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-
- if ( parentEntry != null )
+ // Normalize the deleteContext Dn
+ Dn dn = deleteContext.getDn();
+ dn.apply( directoryService.getSchemaManager() );
+
+ // We have to deal with the referral first
+ directoryService.getReferralManager().lockRead();
+
+ Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
+
+ if ( parentEntry != null )
+ {
+ // We have found a parent referral for the current Dn
+ Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
+
+ if ( directoryService.getReferralManager().isReferral( dn ) )
{
- // We have found a parent referral for the current Dn
- Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-
- 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 ( !deleteContext.isReferralIgnored() )
{
- // This is a referral. We can delete it if the ManageDsaIt flag is true
- // Otherwise, we just throw a LdapReferralException
- if ( !deleteContext.isReferralIgnored() )
- {
- // Throw a Referral Exception
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException 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 ( deleteContext.isReferralIgnored() )
- {
- directoryService.getReferralManager().unlock();
-
- LdapPartialResultException exception = buildLdapPartialResultException( childDn );
- throw exception;
- }
- else
- {
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralException( parentEntry, childDn );
- throw exception;
- }
+ // Throw a Referral Exception
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException 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 ( deleteContext.isReferralIgnored() )
+ {
+ directoryService.getReferralManager().unlock();
+
+ LdapPartialResultException exception = buildLdapPartialResultException( childDn );
+ throw exception;
+ }
+ else
+ {
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralException( parentEntry, childDn );
+ throw exception;
}
}
-
- // Unlock the ReferralManager
- directoryService.getReferralManager().unlock();
-
- // populate the context with the old entry
- eagerlyPopulateFields( deleteContext );
-
- // Call the Delete method
- Interceptor head = directoryService.getInterceptor( deleteContext.getNextInterceptor() );
-
- head.delete( deleteContext );
- }
- finally
- {
- pop();
}
+
+ // Unlock the ReferralManager
+ directoryService.getReferralManager().unlock();
+
+ // populate the context with the old entry
+ eagerlyPopulateFields( deleteContext );
+
+ // Call the Delete method
+ Interceptor head = directoryService.getInterceptor( deleteContext.getNextInterceptor() );
+
+ head.delete( deleteContext );
LOG.debug( "<< DeleteOperation successful" );
LOG_CHANGES.debug( "<< DeleteOperation successful" );
@@ -533,50 +501,38 @@ public class DefaultOperationManager imp
/**
* {@inheritDoc}
*/
- public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext ) throws LdapException
+ public Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException
{
- LOG.debug( ">> GetRootDSEOperation : {}", getRootDseContext );
+ LOG.debug( ">> GetRootDseOperation : {}", getRootDseContext );
ensureStarted();
- push( getRootDseContext );
-
- try
- {
- Interceptor head = directoryService.getInterceptor( getRootDseContext.getNextInterceptor() );
- return head.getRootDSE( getRootDseContext );
- }
- finally
- {
- pop();
-
- LOG.debug( "<< getRootDSEOperation successful" );
- }
+ Interceptor head = directoryService.getInterceptor( getRootDseContext.getNextInterceptor() );
+
+ Entry root = head.getRootDse( getRootDseContext );
+
+ LOG.debug( "<< getRootDseOperation successful" );
+
+ return root;
}
/**
* {@inheritDoc}
*/
- public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
+ public boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException
{
LOG.debug( ">> hasEntryOperation : {}", hasEntryContext );
ensureStarted();
- push( hasEntryContext );
-
- try
- {
- Interceptor head = directoryService.getInterceptor( hasEntryContext.getNextInterceptor() );
-
- return head.hasEntry( hasEntryContext );
- }
- finally
- {
- pop();
- LOG.debug( "<< HasEntryOperation successful" );
- }
+ Interceptor head = directoryService.getInterceptor( hasEntryContext.getNextInterceptor() );
+
+ boolean result = head.hasEntry( hasEntryContext );
+
+ LOG.debug( "<< HasEntryOperation successful" );
+
+ return result;
}
@@ -588,20 +544,14 @@ public class DefaultOperationManager imp
LOG.debug( ">> ListOperation : {}", listContext );
ensureStarted();
- push( listContext );
-
- try
- {
- Interceptor head = directoryService.getInterceptor( listContext.getNextInterceptor() );
-
- return head.list( listContext );
- }
- finally
- {
- pop();
- LOG.debug( "<< ListOperation successful" );
- }
+ Interceptor head = directoryService.getInterceptor( listContext.getNextInterceptor() );
+
+ EntryFilteringCursor cursor = head.list( listContext );
+
+ LOG.debug( "<< ListOperation successful" );
+
+ return cursor;
}
@@ -613,20 +563,14 @@ public class DefaultOperationManager imp
LOG.debug( ">> LookupOperation : {}", lookupContext );
ensureStarted();
- push( lookupContext );
-
- try
- {
- Interceptor head = directoryService.getInterceptor( lookupContext.getNextInterceptor() );
-
- return head.lookup( lookupContext );
- }
- finally
- {
- pop();
- LOG.debug( "<< LookupOperation successful" );
- }
+ Interceptor head = directoryService.getInterceptor( lookupContext.getNextInterceptor() );
+
+ Entry entry = head.lookup( lookupContext );
+
+ LOG.debug( "<< LookupOperation successful" );
+
+ return entry;
}
@@ -639,85 +583,81 @@ public class DefaultOperationManager imp
LOG_CHANGES.debug( ">> ModifyOperation : {}", modifyContext );
ensureStarted();
- push( modifyContext );
- try
+ // 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 )
{
- // 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 ) )
{
- 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() )
{
- // 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;
- }
+ // 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 ) )
+ }
+ 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() )
{
- // 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;
- }
+ 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();
-
- // Call the Add method
- InterceptorChain interceptorChain = directoryService.getInterceptorChain();
- interceptorChain.modify( modifyContext );
}
- finally
- {
- pop();
+
+ // Unlock the ReferralManager
+ referralManager.unlock();
+
+ // populate the context with the old entry
+ eagerlyPopulateFields( modifyContext );
+
+ // Call the Modify method
+ Interceptor head = directoryService.getInterceptor( modifyContext.getNextInterceptor() );
+
+ head.modify( modifyContext );
- LOG.debug( "<< ModifyOperation successful" );
- LOG_CHANGES.debug( "<< ModifyOperation successful" );
- }
+ LOG.debug( "<< ModifyOperation successful" );
+ LOG_CHANGES.debug( "<< ModifyOperation successful" );
}
@@ -730,96 +670,93 @@ public class DefaultOperationManager imp
LOG_CHANGES.debug( ">> MoveOperation : {}", moveContext );
ensureStarted();
- push( moveContext );
-
- try
- {
- // Normalize the moveContext Dn
- Dn dn = moveContext.getDn();
- dn.apply( directoryService.getSchemaManager() );
-
- // Normalize the moveContext superior Dn
- Dn newSuperiorDn = moveContext.getNewSuperior();
- newSuperiorDn.apply( directoryService.getSchemaManager() );
-
- // We have to deal with the referral first
- directoryService.getReferralManager().lockRead();
- // Check if we have an ancestor for this Dn
- Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-
- if ( parentEntry != null )
+ // Normalize the moveContext Dn
+ Dn dn = moveContext.getDn();
+ dn.apply( directoryService.getSchemaManager() );
+
+ // Normalize the moveContext superior Dn
+ Dn newSuperiorDn = moveContext.getNewSuperior();
+ newSuperiorDn.apply( directoryService.getSchemaManager() );
+
+ // We have to deal with the referral first
+ directoryService.getReferralManager().lockRead();
+
+ // Check if we have an ancestor for this Dn
+ Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
+
+ if ( parentEntry != null )
+ {
+ // We have found a parent referral for the current Dn
+ Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
+
+ if ( directoryService.getReferralManager().isReferral( dn ) )
{
- // We have found a parent referral for the current Dn
- Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-
- 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 ( !moveContext.isReferralIgnored() )
- {
- // Throw a Referral Exception
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralException( parentEntry, childDn );
- throw exception;
- }
- }
- else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
+ // This is a referral. We can delete it if the ManageDsaIt flag is true
+ // Otherwise, we just throw a LdapReferralException
+ if ( !moveContext.isReferralIgnored() )
{
- // 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 ( moveContext.isReferralIgnored() )
- {
- directoryService.getReferralManager().unlock();
-
- LdapPartialResultException exception = buildLdapPartialResultException( childDn );
- throw exception;
- }
- else
- {
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralException( parentEntry, childDn );
- throw exception;
- }
+ // Throw a Referral Exception
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralException( parentEntry, childDn );
+ throw exception;
}
}
-
- // Now, check the destination
- // 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( newSuperiorDn )
- || directoryService.getReferralManager().hasParentReferral( newSuperiorDn ) )
+ else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
{
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapAffectMultipleDsaException exception = new LdapAffectMultipleDsaException();
- //exception.setRemainingName( dn );
-
- throw exception;
+ // 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 ( moveContext.isReferralIgnored() )
+ {
+ directoryService.getReferralManager().unlock();
+
+ LdapPartialResultException exception = buildLdapPartialResultException( childDn );
+ throw exception;
+ }
+ else
+ {
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralException( parentEntry, childDn );
+ throw exception;
+ }
}
-
- // Unlock the ReferralManager
- directoryService.getReferralManager().unlock();
-
- // Call the Add method
- InterceptorChain interceptorChain = directoryService.getInterceptorChain();
- interceptorChain.move( moveContext );
}
- finally
+
+ // Now, check the destination
+ // 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( newSuperiorDn )
+ || directoryService.getReferralManager().hasParentReferral( newSuperiorDn ) )
{
- pop();
-
- LOG.debug( "<< MoveOperation successful" );
- LOG_CHANGES.debug( "<< MoveOperation successful" );
- }
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapAffectMultipleDsaException exception = new LdapAffectMultipleDsaException();
+ //exception.setRemainingName( dn );
+
+ throw exception;
+ }
+
+ // Unlock the ReferralManager
+ directoryService.getReferralManager().unlock();
+
+ Entry originalEntry = getOriginalEntry( moveContext );
+
+ moveContext.setOriginalEntry( originalEntry );
+
+ // Call the Move method
+ Interceptor head = directoryService.getInterceptor( moveContext.getNextInterceptor() );
+
+ head.move( moveContext );
+
+ LOG.debug( "<< MoveOperation successful" );
+ LOG_CHANGES.debug( "<< MoveOperation successful" );
}
@@ -832,98 +769,94 @@ public class DefaultOperationManager imp
LOG_CHANGES.debug( ">> MoveAndRenameOperation : {}", moveAndRenameContext );
ensureStarted();
- push( moveAndRenameContext );
-
- try
- {
- // Normalize the moveAndRenameContext Dn
- Dn dn = moveAndRenameContext.getDn();
- dn.apply( directoryService.getSchemaManager() );
-
- // We have to deal with the referral first
- directoryService.getReferralManager().lockRead();
-
- // Check if we have an ancestor for this Dn
- Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
- if ( parentEntry != null )
+ // Normalize the moveAndRenameContext Dn
+ Dn dn = moveAndRenameContext.getDn();
+ dn.apply( directoryService.getSchemaManager() );
+
+ // We have to deal with the referral first
+ directoryService.getReferralManager().lockRead();
+
+ // Check if we have an ancestor for this Dn
+ Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
+
+ if ( parentEntry != null )
+ {
+ // We have found a parent referral for the current Dn
+ Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
+
+ if ( directoryService.getReferralManager().isReferral( dn ) )
{
- // We have found a parent referral for the current Dn
- Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-
- 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 ( !moveAndRenameContext.isReferralIgnored() )
- {
- // Throw a Referral Exception
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralException( parentEntry, childDn );
- throw exception;
- }
- }
- else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
+ // This is a referral. We can delete it if the ManageDsaIt flag is true
+ // Otherwise, we just throw a LdapReferralException
+ if ( !moveAndRenameContext.isReferralIgnored() )
{
- // 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 ( moveAndRenameContext.isReferralIgnored() )
- {
- directoryService.getReferralManager().unlock();
-
- LdapPartialResultException exception = buildLdapPartialResultException( childDn );
- throw exception;
- }
- else
- {
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralException( parentEntry, childDn );
- throw exception;
- }
+ // Throw a Referral Exception
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralException( parentEntry, childDn );
+ throw exception;
}
}
-
- // Now, check the destination
- // Normalize the moveAndRenameContext Dn
- Dn newSuperiorDn = moveAndRenameContext.getNewSuperiorDn();
- newSuperiorDn.apply( directoryService.getSchemaManager() );
-
- // 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( newSuperiorDn )
- || directoryService.getReferralManager().hasParentReferral( newSuperiorDn ) )
+ else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
{
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- // The parent Dn is a referral, we have to issue a AffectMultipleDsas result
- // as stated by RFC 3296 Section 5.6.2
- LdapAffectMultipleDsaException exception = new LdapAffectMultipleDsaException();
- //exception.setRemainingName( dn );
-
- throw exception;
+ // 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 ( moveAndRenameContext.isReferralIgnored() )
+ {
+ directoryService.getReferralManager().unlock();
+
+ LdapPartialResultException exception = buildLdapPartialResultException( childDn );
+ throw exception;
+ }
+ else
+ {
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralException( parentEntry, childDn );
+ throw exception;
+ }
}
-
- // Unlock the ReferralManager
- directoryService.getReferralManager().unlock();
-
- // Call the Add method
- InterceptorChain interceptorChain = directoryService.getInterceptorChain();
- interceptorChain.moveAndRename( moveAndRenameContext );
}
- finally
+
+ // Now, check the destination
+ // Normalize the moveAndRenameContext Dn
+ Dn newSuperiorDn = moveAndRenameContext.getNewSuperiorDn();
+ newSuperiorDn.apply( directoryService.getSchemaManager() );
+
+ // 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( newSuperiorDn )
+ || directoryService.getReferralManager().hasParentReferral( newSuperiorDn ) )
{
- pop();
-
- LOG.debug( "<< MoveAndRenameOperation successful" );
- LOG_CHANGES.debug( "<< MoveAndRenameOperation successful" );
- }
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ // The parent Dn is a referral, we have to issue a AffectMultipleDsas result
+ // as stated by RFC 3296 Section 5.6.2
+ LdapAffectMultipleDsaException exception = new LdapAffectMultipleDsaException();
+ //exception.setRemainingName( dn );
+
+ throw exception;
+ }
+
+ // Unlock the ReferralManager
+ directoryService.getReferralManager().unlock();
+
+ moveAndRenameContext.setOriginalEntry( getOriginalEntry( moveAndRenameContext ) );
+ moveAndRenameContext.setModifiedEntry( moveAndRenameContext.getOriginalEntry().clone() );
+
+ // Call the MoveAndRename method
+ Interceptor head = directoryService.getInterceptor( moveAndRenameContext.getNextInterceptor() );
+
+ head.moveAndRename( moveAndRenameContext );
+
+ LOG.debug( "<< MoveAndRenameOperation successful" );
+ LOG_CHANGES.debug( "<< MoveAndRenameOperation successful" );
}
@@ -936,86 +869,86 @@ public class DefaultOperationManager imp
LOG_CHANGES.debug( ">> RenameOperation : {}", renameContext );
ensureStarted();
- push( renameContext );
-
- try
- {
- // Normalize the renameContext Dn
- Dn dn = renameContext.getDn();
- dn.apply( directoryService.getSchemaManager() );
- // Inject the newDn into the operation context
- // Inject the new Dn into the context
- if ( !dn.isEmpty() )
+ // Normalize the renameContext Dn
+ Dn dn = renameContext.getDn();
+ dn.apply( directoryService.getSchemaManager() );
+
+ // Inject the newDn into the operation context
+ // Inject the new Dn into the context
+ if ( !dn.isEmpty() )
+ {
+ Dn newDn = dn.getParent();
+ newDn = newDn.add( renameContext.getNewRdn() );
+ renameContext.setNewDn( newDn );
+ }
+
+ // We have to deal with the referral first
+ directoryService.getReferralManager().lockRead();
+
+ // Check if we have an ancestor for this Dn
+ Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
+
+ if ( parentEntry != null )
+ {
+ // We have found a parent referral for the current Dn
+ Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
+
+ if ( directoryService.getReferralManager().isReferral( dn ) )
{
- Dn newDn = dn.getParent();
- newDn = newDn.add( renameContext.getNewRdn() );
- renameContext.setNewDn( newDn );
+ // This is a referral. We can delete it if the ManageDsaIt flag is true
+ // Otherwise, we just throw a LdapReferralException
+ if ( !renameContext.isReferralIgnored() )
+ {
+ // Throw a Referral Exception
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralException( parentEntry, childDn );
+ throw exception;
+ }
}
-
- // We have to deal with the referral first
- directoryService.getReferralManager().lockRead();
-
- // Check if we have an ancestor for this Dn
- Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-
- if ( parentEntry != null )
+ else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
{
- // We have found a parent referral for the current Dn
- Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-
- if ( directoryService.getReferralManager().isReferral( 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 ( renameContext.isReferralIgnored() )
{
- // This is a referral. We can delete it if the ManageDsaIt flag is true
- // Otherwise, we just throw a LdapReferralException
- if ( !renameContext.isReferralIgnored() )
- {
- // Throw a Referral Exception
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException 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 ( renameContext.isReferralIgnored() )
- {
- directoryService.getReferralManager().unlock();
-
- LdapPartialResultException exception = buildLdapPartialResultException( childDn );
- throw exception;
- }
- else
- {
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralException( parentEntry, childDn );
- throw exception;
- }
+ directoryService.getReferralManager().unlock();
+
+ LdapPartialResultException exception = buildLdapPartialResultException( childDn );
+ throw exception;
+ }
+ else
+ {
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralException( parentEntry, childDn );
+ throw exception;
}
}
-
- // Unlock the ReferralManager
- directoryService.getReferralManager().unlock();
-
- // Call the Add method
- InterceptorChain interceptorChain = directoryService.getInterceptorChain();
- interceptorChain.rename( renameContext );
- }
- finally
- {
- pop();
-
- LOG.debug( "<< RenameOperation successful" );
- LOG_CHANGES.debug( "<< RenameOperation successful" );
}
+
+ // Unlock the ReferralManager
+ directoryService.getReferralManager().unlock();
+
+ // Call the rename method
+ // populate the context with the old entry
+ eagerlyPopulateFields( renameContext );
+ Entry originalEntry = getOriginalEntry( renameContext );
+ renameContext.setOriginalEntry( originalEntry );
+ renameContext.setModifiedEntry( originalEntry.clone() );
+
+ // Call the Rename method
+ Interceptor head = directoryService.getInterceptor( renameContext.getNextInterceptor() );
+
+ head.rename( renameContext );
+
+ LOG.debug( "<< RenameOperation successful" );
+ LOG_CHANGES.debug( "<< RenameOperation successful" );
}
@@ -1027,78 +960,73 @@ public class DefaultOperationManager imp
LOG.debug( ">> SearchOperation : {}", searchContext );
ensureStarted();
- push( searchContext );
-
- try
- {
- // Normalize the searchContext Dn
- Dn dn = searchContext.getDn();
- dn.apply( directoryService.getSchemaManager() );
-
- // We have to deal with the referral first
- directoryService.getReferralManager().lockRead();
- // Check if we have an ancestor for this Dn
- Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
-
- if ( parentEntry != null )
+ // Normalize the searchContext Dn
+ Dn dn = searchContext.getDn();
+ dn.apply( directoryService.getSchemaManager() );
+
+ // We have to deal with the referral first
+ directoryService.getReferralManager().lockRead();
+
+ // Check if we have an ancestor for this Dn
+ Entry parentEntry = directoryService.getReferralManager().getParentReferral( dn );
+
+ if ( parentEntry != null )
+ {
+ // We have found a parent referral for the current Dn
+ Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
+
+ if ( directoryService.getReferralManager().isReferral( dn ) )
{
- // We have found a parent referral for the current Dn
- Dn childDn = dn.getDescendantOf( parentEntry.getDn() );
-
- if ( directoryService.getReferralManager().isReferral( dn ) )
+ // This is a referral. We can return it if the ManageDsaIt flag is true
+ // Otherwise, we just throw a LdapReferralException
+ if ( !searchContext.isReferralIgnored() )
{
- // This is a referral. We can return it if the ManageDsaIt flag is true
- // Otherwise, we just throw a LdapReferralException
- if ( !searchContext.isReferralIgnored() )
- {
- // Throw a Referral Exception
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralExceptionForSearch( parentEntry, childDn,
- searchContext.getScope() );
- throw exception;
- }
- }
- else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
- {
- // We can't search an entry which has an ancestor referral
-
- // Depending on the Context.REFERRAL property value, we will throw
- // a different exception.
- if ( searchContext.isReferralIgnored() )
- {
- directoryService.getReferralManager().unlock();
-
- LdapPartialResultException exception = buildLdapPartialResultException( childDn );
- throw exception;
- }
- else
- {
- // Unlock the referral manager
- directoryService.getReferralManager().unlock();
-
- LdapReferralException exception = buildReferralExceptionForSearch( parentEntry, childDn,
- searchContext.getScope() );
- throw exception;
- }
+ // Throw a Referral Exception
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralExceptionForSearch( parentEntry, childDn,
+ searchContext.getScope() );
+ throw exception;
+ }
+ }
+ else if ( directoryService.getReferralManager().hasParentReferral( dn ) )
+ {
+ // We can't search an entry which has an ancestor referral
+
+ // Depending on the Context.REFERRAL property value, we will throw
+ // a different exception.
+ if ( searchContext.isReferralIgnored() )
+ {
+ directoryService.getReferralManager().unlock();
+
+ LdapPartialResultException exception = buildLdapPartialResultException( childDn );
+ throw exception;
+ }
+ else
+ {
+ // Unlock the referral manager
+ directoryService.getReferralManager().unlock();
+
+ LdapReferralException exception = buildReferralExceptionForSearch( parentEntry, childDn,
+ searchContext.getScope() );
+ throw exception;
}
}
-
- // Unlock the ReferralManager
- directoryService.getReferralManager().unlock();
-
- // Call the Add method
- InterceptorChain interceptorChain = directoryService.getInterceptorChain();
- return interceptorChain.search( searchContext );
- }
- finally
- {
- pop();
-
- LOG.debug( "<< SearchOperation successful" );
}
+
+ // Unlock the ReferralManager
+ directoryService.getReferralManager().unlock();
+
+ // Call the Search method
+ Interceptor head = directoryService.getInterceptor( searchContext.getNextInterceptor() );
+
+ EntryFilteringCursor cursor = head.search( searchContext );
+
+ LOG.debug( "<< SearchOperation successful" );
+
+ return cursor;
}
@@ -1110,7 +1038,6 @@ public class DefaultOperationManager imp
LOG.debug( ">> UnbindOperation : {}", unbindContext );
ensureStarted();
- push( unbindContext );
try
{
@@ -1121,7 +1048,6 @@ public class DefaultOperationManager imp
}
finally
{
- pop();
}
LOG.debug( "<< UnbindOperation successful" );
@@ -1135,20 +1061,4 @@ public class DefaultOperationManager imp
throw new LdapServiceUnavailableException( ResultCodeEnum.UNAVAILABLE, I18n.err( I18n.ERR_316 ) );
}
}
-
-
- private void pop()
- {
- // TODO - need to remove Context caller and PartitionNexusProxy from Invocations
- InvocationStack stack = InvocationStack.getInstance();
- stack.pop();
- }
-
-
- private void push( OperationContext opContext )
- {
- // TODO - need to remove Context caller and PartitionNexusProxy from Invocations
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( opContext );
- }
}
Propchange: directory/apacheds/branches/apacheds-txns/dependencies/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -0,0 +1,10 @@
+/directory/apacheds/branches/apacheds-codec-merge/dependencies:982369-987590
+/directory/apacheds/branches/apacheds-config/dependencies:1023442-1029077
+/directory/apacheds/branches/apacheds-kerberos-codec-2.0/dependencies:1040956-1043765
+/directory/apacheds/branches/apacheds-replication/dependencies:749790-764110
+/directory/apacheds/branches/apacheds-schema/dependencies:806623-896441
+/directory/apacheds/branches/apacheds-subtree/dependencies:965203-965686
+/directory/apacheds/branches/milestones/dependencies:1072812-1075328
+/directory/apacheds/branches/xdbm-refactoring/dependencies:945827-946347
+/directory/apacheds/trunk/dependencies:1066126-1067785,1068026-1072718,1072800-1075329,1185228-1201283
+/directory/studio/trunk/dependencies:1067786-1067997
Propchange: directory/apacheds/branches/apacheds-txns/http-directory-bridge/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -6,6 +6,6 @@
/directory/apacheds/branches/apacheds-subtree/http-directory-bridge:965203-965686
/directory/apacheds/branches/milestones/http-directory-bridge:1072812-1075328
/directory/apacheds/branches/xdbm-refactoring/http-directory-bridge:945827-946347
-/directory/apacheds/trunk/http-directory-bridge:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/http-directory-bridge:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1201283
/directory/apacheds/trunk/interceptors/http-directory-bridge:1183435-1186974
/directory/studio/trunk/http-directory-bridge:1067786-1067997
Propchange: directory/apacheds/branches/apacheds-txns/http-integration/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -3,6 +3,6 @@
/directory/apacheds/branches/apacheds-dnfactory-experiment/http-integration:980138-980935
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/http-integration:1040956-1043765
/directory/apacheds/branches/milestones/http-integration:1072812-1075328
-/directory/apacheds/trunk/http-integration:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/http-integration:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1201283
/directory/apacheds/trunk/interceptors/http-integration:1183435-1186974
/directory/studio/trunk/http-integration:1067786-1067997
Propchange: directory/apacheds/branches/apacheds-txns/i18n/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -3,6 +3,6 @@
/directory/apacheds/branches/apacheds-dnfactory-experiment/i18n:980138-980935
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/i18n:1040956-1043765
/directory/apacheds/branches/milestones/i18n:1072812-1075328
-/directory/apacheds/trunk/i18n:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/i18n:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1201283
/directory/apacheds/trunk/interceptors/i18n:1183435-1186974
/directory/studio/trunk/i18n:1067786-1067997
Propchange: directory/apacheds/branches/apacheds-txns/installers/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -1,7 +1,7 @@
/directory/apacheds/branches/apacheds-config/installers:1023442-1029077
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/installers:1040956-1043765
/directory/apacheds/branches/milestones/installers:1072812-1075328
-/directory/apacheds/trunk/installers:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/installers:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1201283
/directory/apacheds/trunk/interceptors/installers:1183435-1186974
/directory/installers/branches/installers-schema/apacheds:806631-896441
/directory/studio/trunk/installers:1067786-1067997
Propchange: directory/apacheds/branches/apacheds-txns/installers-maven-plugin/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -1,7 +1,7 @@
/directory/apacheds/branches/apacheds-config/installers-maven-plugin:1023442-1029077
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/installers-maven-plugin:1040956-1043765
/directory/apacheds/branches/milestones/installers-maven-plugin:1072812-1075328
-/directory/apacheds/trunk/installers-maven-plugin:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/installers-maven-plugin:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1201283
/directory/apacheds/trunk/interceptors/installers-maven-plugin:1183435-1186974
/directory/daemon/branches/daemon-schema/plugin:806630-896441
/directory/studio/trunk/installers-maven-plugin:1067786-1067997
Propchange: directory/apacheds/branches/apacheds-txns/interceptor-kerberos/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -2,7 +2,8 @@
/directory/apacheds/branches/apacheds-config/interceptor-kerberos:1023442-1029077
/directory/apacheds/branches/apacheds-dnfactory-experiment/interceptor-kerberos:980138-980935
/directory/apacheds/branches/apacheds-kerberos-codec-2.0/interceptor-kerberos:1040956-1043765
+/directory/apacheds/branches/apacheds-osgi/interceptor-kerberos:1185681-1197579
/directory/apacheds/branches/milestones/interceptor-kerberos:1072812-1075328
-/directory/apacheds/trunk/interceptor-kerberos:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1186962
+/directory/apacheds/trunk/interceptor-kerberos:1066126-1067785,1068026-1072718,1072800-1075329,1177661-1201283
/directory/apacheds/trunk/interceptors/interceptor-kerberos:1183435-1186974
/directory/studio/trunk/interceptor-kerberos:1067786-1067997
Modified: directory/apacheds/branches/apacheds-txns/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Sat Nov 12 18:24:38 2011
@@ -22,17 +22,12 @@ package org.apache.directory.server.core
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -45,11 +40,11 @@ import org.apache.directory.shared.kerbe
import org.apache.directory.shared.kerberos.components.EncryptionKey;
import org.apache.directory.shared.kerberos.exceptions.KerberosException;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
import org.apache.directory.shared.ldap.model.entry.BinaryValue;
import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
import org.apache.directory.shared.ldap.model.entry.DefaultModification;
import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
import org.apache.directory.shared.ldap.model.entry.Modification;
import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
import org.apache.directory.shared.ldap.model.entry.StringValue;
@@ -77,39 +72,24 @@ public class KeyDerivationInterceptor ex
private static final Logger log = LoggerFactory.getLogger( KeyDerivationInterceptor.class );
/** The service name. */
- public static final String NAME = "keyDerivationService";
+ private static final String NAME = "keyDerivationService";
/**
- * Define the interceptors to bypass upon user lookup.
+ * Creates an instance of a KeyDerivationInterceptor.
*/
- private static final Collection<String> USERLOOKUP_BYPASS;
- static
+ public KeyDerivationInterceptor()
{
- Set<String> c = new HashSet<String>();
- c.add( "NormalizationInterceptor" );
- c.add( "AuthenticationInterceptor" );
- c.add( "ReferralInterceptor" );
- c.add( "AciAuthorizationInterceptor" );
- c.add( "DefaultAuthorizationInterceptor" );
- c.add( "AdministrativePointInterceptor" );
- c.add( "ExceptionInterceptor" );
- c.add( "OperationalAttributeInterceptor" );
- c.add( "SchemaInterceptor" );
- c.add( "CollectiveAttributeInterceptor" );
- c.add( "SubentryInterceptor" );
- c.add( "EventInterceptor" );
- c.add( "TriggerInterceptor" );
- USERLOOKUP_BYPASS = Collections.unmodifiableCollection( c );
+ super( NAME );
}
-
-
+
+
/**
* Intercept the addition of the 'userPassword' and 'krb5PrincipalName' attributes. Use the 'userPassword'
* and 'krb5PrincipalName' attributes to derive Kerberos keys for the principal. If the 'userPassword' is
* the special keyword 'randomKey', set random keys for the principal. Set the key version number (kvno)
* to '0'.
*/
- public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+ public void add( AddOperationContext addContext ) throws LdapException
{
Dn normName = addContext.getDn();
@@ -149,7 +129,7 @@ public class KeyDerivationInterceptor ex
.getName() );
}
- next.add( addContext );
+ next( addContext );
}
@@ -164,7 +144,7 @@ public class KeyDerivationInterceptor ex
*
* If the 'userPassword' is the special keyword 'randomKey', set random keys for the principal.
*/
- public void modify( NextInterceptor next, ModifyOperationContext modContext ) throws LdapException
+ public void modify( ModifyOperationContext modContext ) throws LdapException
{
ModifySubContext subContext = new ModifySubContext();
@@ -180,7 +160,7 @@ public class KeyDerivationInterceptor ex
deriveKeys( modContext, subContext );
}
- next.modify( modContext );
+ next( modContext );
}
@@ -192,8 +172,7 @@ public class KeyDerivationInterceptor ex
* @param subContext
* @throws LdapException
*/
- void detectPasswordModification( ModifyOperationContext modContext, ModifySubContext subContext )
- throws LdapException
+ void detectPasswordModification( ModifyOperationContext modContext, ModifySubContext subContext ) throws LdapException
{
List<Modification> mods = modContext.getModItems();
@@ -266,21 +245,19 @@ public class KeyDerivationInterceptor ex
* @param subContext
* @throws LdapException
*/
- void lookupPrincipalAttributes( ModifyOperationContext modContext, ModifySubContext subContext )
- throws LdapException
+ void lookupPrincipalAttributes( ModifyOperationContext modContext, ModifySubContext subContext ) throws LdapException
{
Dn principalDn = modContext.getDn();
LookupOperationContext lookupContext = modContext.newLookupContext( principalDn );
- lookupContext.setByPassed( USERLOOKUP_BYPASS );
lookupContext.setAttrsId( new String[]
- {
+ {
SchemaConstants.OBJECT_CLASS_AT,
KerberosAttribute.KRB5_PRINCIPAL_NAME_AT,
KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
- } );
+ } );
- Entry userEntry = modContext.lookup( lookupContext );
+ Entry userEntry = directoryService.getPartitionNexus().lookup( lookupContext );
if ( userEntry == null )
{
@@ -425,6 +402,7 @@ public class KeyDerivationInterceptor ex
}
}
+
static class ModifySubContext
{
private boolean isPrincipal = false;
Propchange: directory/apacheds/branches/apacheds-txns/interceptors/admin/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -1 +1 @@
-/directory/apacheds/trunk/interceptors/admin:1183435-1200383
+/directory/apacheds/trunk/interceptors/admin:1183435-1201283