Author: akarasulu Date: Tue Jun 17 19:55:14 2008 New Revision: 669066 URL: http://svn.apache.org/viewvc?rev=669066&view=rev Log: adding placeholder for caching the target entry to all OperationContexts instead of a select few and removing them from Add and Modify which now inherits from base classes and interfaces Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java?rev=669066&r1=669065&r2=669066&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java Tue Jun 17 19:55:14 2008 @@ -53,6 +53,9 @@ /** The DN associated with the context */ protected LdapDN dn; + /** The entry associated with the target entry of this OperationContext */ + private ClonedServerEntry entry; + /** The associated request's controls */ protected Map requestControls = new HashMap(4); @@ -438,4 +441,22 @@ this.referralHandlingMode = ReferralHandlingMode.THROW; } } + + + /** + * @param entry the entry to set + */ + public void setEntry( ClonedServerEntry entry ) + { + this.entry = entry; + } + + + /** + * @return the entry + */ + public ClonedServerEntry getEntry() + { + return entry; + } } Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java?rev=669066&r1=669065&r2=669066&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java Tue Jun 17 19:55:14 2008 @@ -103,26 +103,6 @@ /** - * @return The added attributes - */ - public ServerEntry getEntry() - { - return entry; - } - - - /** - * Set the added attributes - * - * @param entry The added attributes - */ - public void setEntry( ServerEntry entry ) - { - this.entry = entry; - } - - - /** * @return the operation name */ public String getName() Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java?rev=669066&r1=669065&r2=669066&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java Tue Jun 17 19:55:14 2008 @@ -86,6 +86,8 @@ private ReferralHandlingMode referralHandlingMode; + private ClonedServerEntry entry; + /** * Creates a new instance of BindOperationContext. @@ -478,4 +480,16 @@ { this.referralHandlingMode = referralHandlingMode; } + + + public ClonedServerEntry getEntry() + { + return entry; + } + + + public void setEntry( ClonedServerEntry entry ) + { + this.entry = entry; + } } Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java?rev=669066&r1=669065&r2=669066&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java Tue Jun 17 19:55:14 2008 @@ -117,6 +117,42 @@ /** + * Gets the server entry associated with the target DN of this + * OperationContext. The entry associated with the DN may be altered + * during the course of processing an LDAP operation through the + * InterceptorChain. This place holder is put here to prevent the need + * for repetitive lookups of the target entry. Furthermore the returned + * entry may be altered by any Interceptor in the chain and this is why a + * ClonedServerEntry is returned instead of a ServerEntry. A + * ClonedServerEntry has an immutable reference to the original state of + * the target entry. The original state can be accessed via a call to + * {@link ClonedServerEntry#getOriginalEntry()}. The return value may be + * null in which case any lookup performed to access it may set it to + * prevent the need for subsequent lookups. + * + * Also note that during the course of handling some operations such as + * those that rename, move or rename and move the entry, may alter the DN + * of this entry. Interceptor implementors should not presume the DN or + * the values contained in this entry are currently what is present in the + * DIT. The original entry contained in the ClonedServerEntry shoudl be + * used as the definitive source of information about the state of the + * entry in the DIT before returning from the Partition subsystem. + * + * @return target entry associated with the DN of this OperationContext + */ + ClonedServerEntry getEntry(); + + + /** + * Sets the server entry associated with the target DN of this + * OperationContext. + * + * @param entry the entry whose DN is associated with this OperationContext. + */ + void setEntry( ClonedServerEntry entry ); + + + /** * Adds a response control to this operation. * * @param responseControl the response control to add to this operation