You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/06/08 06:28:40 UTC
svn commit: r664437 - in /directory/apacheds/branches/bigbang/core/src:
main/java/org/apache/directory/server/core/
main/java/org/apache/directory/server/core/interceptor/context/
test/java/org/apache/directory/server/core/authz/support/
Author: akarasulu
Date: Sat Jun 7 21:28:39 2008
New Revision: 664437
URL: http://svn.apache.org/viewvc?rev=664437&view=rev
Log:
CoreSession and OperationContext changes ...
o added the referral handling mode to all OperationContexts
o added convenient Request based overloads for op functions on CoreSession
o added convenient Request based constructors to opContexts
o made a members of AbstractOperationContext protected
o added setRequestControls() to OperationContext
o added new methods to deal with AttributeTypeOptions generation in Searching
OperationContext
Modified:
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/CoreSession.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
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/CompareOperationContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchingOperationContext.java
directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/CoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/CoreSession.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/CoreSession.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/CoreSession.java Sat Jun 7 21:28:39 2008
@@ -31,11 +31,18 @@
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.shared.ldap.message.SearchRequest;
import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.AddRequest;
+import org.apache.directory.shared.ldap.message.AddResponse;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.message.CompareRequest;
+import org.apache.directory.shared.ldap.message.DeleteRequest;
+import org.apache.directory.shared.ldap.message.ModifyDnRequest;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
@@ -199,6 +206,9 @@
void add( ServerEntry entry ) throws Exception;
+ AddResponse add( AddRequest addRequest, ReferralHandlingMode referralHandlingMode ) throws Exception;
+
+
/**
* Checks to see if an attribute in an entry contains a value.
*
@@ -210,6 +220,9 @@
void compare( LdapDN dn, String oid, Object value ) throws Exception;
+ void compare( CompareRequest compareRequest ) throws Exception;
+
+
/**
* Deletes an entry in the server.
*
@@ -219,6 +232,9 @@
void delete( LdapDN dn ) throws Exception;
+ void delete( DeleteRequest deleteRequest ) throws Exception;
+
+
/**
* Looks up an entry in the server returning all attributes: both user and
* operational attributes.
@@ -229,6 +245,10 @@
ClonedServerEntry lookup( LdapDN dn ) throws Exception;
+ ClonedServerEntry lookup( LdapDN dn, Control[] requestControls, ReferralHandlingMode refMode,
+ LdapDN authorized ) throws Exception;
+
+
/**
* Modifies an entry within the server by applying a list of modifications
* to the entry.
@@ -239,7 +259,10 @@
*/
void modify( LdapDN dn, List<Modification> mods ) throws Exception;
+
+ void modify( ModifyRequest modifyRequest ) throws Exception;
+
/**
* Moves an entry or a branch of entries at a specified distinguished name
* to a position under a new parent.
@@ -251,6 +274,13 @@
void move( LdapDN dn, LdapDN newParent ) throws Exception;
+ void move( ModifyDnRequest modifyDnRequest ) throws Exception;
+
+
+// void move( LdapDN dn, LdapDN newParent, Control[] requestControls, ReferralHandlingMode refMode,
+// LdapDN authorized ) throws Exception;
+
+
/**
* Moves and renames (the relative distinguished name of) an entry (or a
* branch if the entry has children) at a specified distinguished name to
@@ -266,6 +296,13 @@
void moveAndRename( LdapDN dn, LdapDN newParent, Rdn newRdn, boolean deleteOldRdn ) throws Exception;
+ void moveAndRename( ModifyDnRequest modifyDnRequest ) throws Exception;
+
+
+// void moveAndRename( LdapDN dn, LdapDN newParent, Rdn newRdn, boolean deleteOldRdn,
+// Control[] requestControls, ReferralHandlingMode refMode, LdapDN authorized ) throws Exception;
+
+
/**
* Renames an entry by changing it's relative distinguished name. This
* has the side effect of changing the distinguished name of all entries
@@ -281,6 +318,13 @@
void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn ) throws Exception;
+ void rename( ModifyDnRequest modifyDnRequest ) throws Exception;
+
+
+// void rename( LdapDN dn, Rdn newRdn, boolean deleteOldRdn,
+// Control[] requestControls, ReferralHandlingMode refMode, LdapDN authorized ) throws Exception;
+
+
/**
* An optimized search operation using one level search scope which
* returns all the children of an entry specified by distinguished name.
@@ -341,4 +385,7 @@
*/
EntryFilteringCursor search( LdapDN dn, SearchScope scope, ExprNode filter, AliasDerefMode aliasDerefMode,
Set<AttributeTypeOptions> returningAttributes, int sizeLimit, int timeLimit ) throws Exception;
+
+
+ EntryFilteringCursor search( SearchRequest searchRequest ) throws Exception;
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java Sat Jun 7 21:28:39 2008
@@ -45,7 +45,14 @@
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.AddRequest;
+import org.apache.directory.shared.ldap.message.AddResponse;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.message.CompareRequest;
+import org.apache.directory.shared.ldap.message.DeleteRequest;
+import org.apache.directory.shared.ldap.message.ModifyDnRequest;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
+import org.apache.directory.shared.ldap.message.SearchRequest;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
@@ -320,4 +327,67 @@
{
return getEffectivePrincipal().getJndiName().isEmpty();
}
+
+
+ public AddResponse add( AddRequest addRequest, ReferralHandlingMode referralHandlingMode ) throws Exception
+ {
+ AddOperationContext opContext = new AddOperationContext( this, addRequest );
+ opContext.setReferralHandlingMode( referralHandlingMode );
+ directoryService.getOperationManager().add( opContext );
+ addRequest.getResultResponse().addAll( opContext.getResponseControls() );
+ return ( AddResponse ) addRequest.getResultResponse();
+ }
+
+
+ public void compare( CompareRequest compareRequest ) throws Exception
+ {
+ directoryService.getOperationManager().compare( new CompareOperationContext( this, compareRequest ) );
+ }
+
+
+ public void delete( DeleteRequest deleteRequest ) throws Exception
+ {
+ directoryService.getOperationManager().delete( new DeleteOperationContext( this, deleteRequest ) );
+ }
+
+
+ public ClonedServerEntry lookup( LdapDN dn, Control[] requestControls, ReferralHandlingMode refMode,
+ LdapDN authorized ) throws Exception
+ {
+ LookupOperationContext opContext = new LookupOperationContext( this, dn );
+ opContext.setReferralHandlingMode( refMode );
+ opContext.addRequestControls( requestControls );
+ return directoryService.getOperationManager().lookup( opContext );
+ }
+
+
+ public void modify( ModifyRequest modifyRequest ) throws Exception
+ {
+ directoryService.getOperationManager().modify( new ModifyOperationContext( this, modifyRequest ) );
+ }
+
+
+ public void move( ModifyDnRequest modifyDnRequest ) throws Exception
+ {
+ directoryService.getOperationManager().move( new MoveOperationContext( this, modifyDnRequest ) );
+ }
+
+
+ public void moveAndRename( ModifyDnRequest modifyDnRequest ) throws Exception
+ {
+ directoryService.getOperationManager().moveAndRename(
+ new MoveAndRenameOperationContext( this, modifyDnRequest ) );
+ }
+
+
+ public void rename( ModifyDnRequest modifyDnRequest ) throws Exception
+ {
+ directoryService.getOperationManager().rename( new RenameOperationContext( this, modifyDnRequest ) );
+ }
+
+
+ public EntryFilteringCursor search( SearchRequest searchRequest ) throws Exception
+ {
+ return directoryService.getOperationManager().search( new SearchOperationContext( this, searchRequest ) );
+ }
}
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=664437&r1=664436&r2=664437&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 Sat Jun 7 21:28:39 2008
@@ -29,6 +29,7 @@
import javax.naming.ldap.Control;
import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.ReferralHandlingMode;
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
@@ -45,27 +46,30 @@
*/
public abstract class AbstractOperationContext implements OperationContext
{
- private static final Control[] EMPTY_CONTROLS = new Control[0];
+ protected static final Control[] EMPTY_CONTROLS = new Control[0];
/** The DN associated with the context */
- private LdapDN dn;
+ protected LdapDN dn;
/** The associated request's controls */
- private Map<String, Control> requestControls = new HashMap<String, Control>(4);
+ protected Map<String, Control> requestControls = new HashMap<String, Control>(4);
/** The associated response's controls */
- private Map<String, Control> responseControls = new HashMap<String, Control>(4);
+ protected Map<String, Control> responseControls = new HashMap<String, Control>(4);
/** the Interceptors bypassed by this operation */
- private Collection<String> byPassed;
+ protected Collection<String> byPassed;
- private LdapPrincipal authorizedPrincipal;
+ protected LdapPrincipal authorizedPrincipal;
- private CoreSession session;
+ /** an operation can override the session's referral handling mode */
+ protected ReferralHandlingMode referralHandlingMode;
- private OperationContext next;
+ protected CoreSession session;
- private OperationContext previous;
+ protected OperationContext next;
+
+ protected OperationContext previous;
/**
@@ -201,6 +205,12 @@
}
+ public void setRequestControls( Map<String, Control> requestControls )
+ {
+ this.requestControls = requestControls;
+ }
+
+
/**
* @return the operation name
*/
@@ -395,4 +405,22 @@
{
this.previous = previous;
}
+
+
+ /**
+ * @param referralHandlingMode the referralHandlingMode to set
+ */
+ public void setReferralHandlingMode( ReferralHandlingMode referralHandlingMode )
+ {
+ this.referralHandlingMode = referralHandlingMode;
+ }
+
+
+ /**
+ * @return the referralHandlingMode
+ */
+ public ReferralHandlingMode getReferralHandlingMode()
+ {
+ return referralHandlingMode;
+ }
}
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=664437&r1=664436&r2=664437&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 Sat Jun 7 21:28:39 2008
@@ -22,6 +22,8 @@
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.shared.ldap.message.AddRequest;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -89,6 +91,16 @@
}
+ public AddOperationContext( CoreSession session, AddRequest addRequest ) throws Exception
+ {
+ super( session );
+ this.entry = ServerEntryUtils.toServerEntry( addRequest.getAttributes(), addRequest.getEntry(),
+ session.getDirectoryService().getRegistries() );
+ this.dn = addRequest.getEntry();
+ this.requestControls = addRequest.getControls();
+ }
+
+
/**
* @return The added attributes
*/
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=664437&r1=664436&r2=664437&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 Sat Jun 7 21:28:39 2008
@@ -30,6 +30,7 @@
import org.apache.commons.lang.NotImplementedException;
import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.ReferralHandlingMode;
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
@@ -83,6 +84,8 @@
private OperationContext previous;
+ private ReferralHandlingMode referralHandlingMode;
+
/**
* Creates a new instance of BindOperationContext.
@@ -463,4 +466,16 @@
opContext.setByPassed( byPassed );
return session.getDirectoryService().getOperationManager().hasEntry( opContext );
}
+
+
+ public ReferralHandlingMode getReferralHandlingMode()
+ {
+ return referralHandlingMode;
+ }
+
+
+ public void setReferralHandlingMode( ReferralHandlingMode referralHandlingMode )
+ {
+ this.referralHandlingMode = referralHandlingMode;
+ }
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java Sat Jun 7 21:28:39 2008
@@ -21,6 +21,7 @@
import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.shared.ldap.message.CompareRequest;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -101,6 +102,15 @@
}
+ public CompareOperationContext( CoreSession session, CompareRequest compareRequest )
+ {
+ super( session, compareRequest.getName() );
+ this.oid = compareRequest.getAttributeId();
+ this.value = compareRequest.getAssertionValue();
+ this.requestControls = compareRequest.getControls();
+ }
+
+
/**
* @return The compared OID
*/
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java Sat Jun 7 21:28:39 2008
@@ -21,6 +21,7 @@
import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.shared.ldap.message.DeleteRequest;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -54,6 +55,13 @@
}
+ public DeleteOperationContext( CoreSession session, DeleteRequest deleteRequest )
+ {
+ super( session, deleteRequest.getName() );
+ this.requestControls = deleteRequest.getControls();
+ }
+
+
/**
* @return the operation name
*/
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Sat Jun 7 21:28:39 2008
@@ -24,14 +24,17 @@
import java.util.List;
import javax.naming.NamingException;
+import javax.naming.directory.ModificationItem;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.entry.ServerModification;
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -72,6 +75,16 @@
}
+ public ModifyOperationContext( CoreSession session, ModifyRequest modifyRequest ) throws Exception
+ {
+ super( session, modifyRequest.getName() );
+ this.modItems = ServerEntryUtils.toServerModification(
+ modifyRequest.getModificationItems().toArray( new ModificationItem[0]),
+ session.getDirectoryService().getRegistries().getAttributeTypeRegistry() );
+ this.requestControls = modifyRequest.getControls();
+ }
+
+
/**
* Set the modified attributes
* @param modItems The modified attributes
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java Sat Jun 7 21:28:39 2008
@@ -21,6 +21,7 @@
import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.shared.ldap.message.ModifyDnRequest;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
@@ -62,6 +63,19 @@
}
+ public MoveAndRenameOperationContext( CoreSession session, ModifyDnRequest modifyDnRequest )
+ {
+ // super sets the newRdn and the delOldRdn members and tests
+ super( session, modifyDnRequest );
+ this.parent = modifyDnRequest.getNewSuperior();
+
+ if ( parent == null )
+ {
+ throw new IllegalStateException( "NewSuperior must not be null: " + modifyDnRequest );
+ }
+ }
+
+
/**
* @return The parent DN
*/
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java Sat Jun 7 21:28:39 2008
@@ -22,6 +22,7 @@
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
+import org.apache.directory.shared.ldap.message.ModifyDnRequest;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -57,6 +58,24 @@
}
+ public MoveOperationContext( CoreSession session, ModifyDnRequest modifyDnRequest )
+ {
+ super( session, modifyDnRequest.getName() );
+ this.parent = modifyDnRequest.getNewSuperior();
+
+ if ( parent == null )
+ {
+ throw new IllegalArgumentException( "The new superior cannot be null for " + modifyDnRequest );
+ }
+
+ this.requestControls = modifyDnRequest.getControls();
+ if ( modifyDnRequest.getNewRdn() != null )
+ {
+ throw new IllegalArgumentException( modifyDnRequest + " represents a move and rename operation." );
+ }
+ }
+
+
/**
* @return The parent DN
*/
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=664437&r1=664436&r2=664437&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 Sat Jun 7 21:28:39 2008
@@ -26,6 +26,7 @@
import javax.naming.ldap.Control;
import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.ReferralHandlingMode;
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
@@ -254,6 +255,25 @@
CoreSession getSession();
+ /**
+ * Sets the {@link ReferralHandlingMode} session override for this
+ * OperationContext.
+ *
+ * @param referralHandlingMode the ReferralHandlingMode override to apply
+ */
+ void setReferralHandlingMode( ReferralHandlingMode referralHandlingMode );
+
+
+ /**
+ * Gets the {@link ReferralHandlingMode} override for this
+ * OperationContext, or if the override is not set it returns the
+ * ReferralHandlingMode associated with the CoreSession if present.
+ *
+ * @return the {@link ReferralHandlingMode} to apply for this operation
+ */
+ ReferralHandlingMode getReferralHandlingMode();
+
+
// -----------------------------------------------------------------------
// Utility Factory Methods to Create New OperationContexts
// -----------------------------------------------------------------------
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java Sat Jun 7 21:28:39 2008
@@ -22,6 +22,7 @@
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
+import org.apache.directory.shared.ldap.message.ModifyDnRequest;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
@@ -68,6 +69,21 @@
}
+ public RenameOperationContext( CoreSession session, ModifyDnRequest modifyDnRequest )
+ {
+ super( session, modifyDnRequest.getName() );
+ this.newRdn = modifyDnRequest.getNewRdn();
+
+ if ( newRdn == null )
+ {
+ throw new IllegalStateException( "newRdn must not be null for a rename: " + modifyDnRequest );
+ }
+
+ this.delOldDn = modifyDnRequest.getDeleteOldRdn();
+ this.requestControls = modifyDnRequest.getControls();
+ }
+
+
/**
* @return The delete old DN flag
*/
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java Sat Jun 7 21:28:39 2008
@@ -29,6 +29,7 @@
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
+import org.apache.directory.shared.ldap.message.SearchRequest;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
@@ -51,7 +52,43 @@
*/
public SearchOperationContext( CoreSession session )
{
- super( session );
+ super( session );
+ }
+
+
+ /**
+ * Creates a new instance of SearchOperationContext.
+ * @throws Exception
+ */
+ public SearchOperationContext( CoreSession session, SearchRequest searchRequest ) throws Exception
+ {
+ super( session );
+
+ this.dn = searchRequest.getBase();
+ this.filter = searchRequest.getFilter();
+ this.abandoned = searchRequest.isAbandoned();
+ this.aliasDerefMode = searchRequest.getDerefAliases();
+
+ this.requestControls = searchRequest.getControls();
+
+ // TODO - fix this and use one Scope enumerated type
+ switch( searchRequest.getScope() )
+ {
+ case BASE_OBJECT:
+ this.scope = SearchScope.OBJECT;
+ break;
+ case SINGLE_LEVEL:
+ this.scope = SearchScope.ONELEVEL;
+ break;
+ case WHOLE_SUBTREE:
+ this.scope = SearchScope.SUBTREE;
+ break;
+ }
+
+ this.sizeLimit = searchRequest.getSizeLimit();
+ this.timeLimit = searchRequest.getTimeLimit();
+ this.noAttributes = searchRequest.getTypesOnly();
+ setReturningAttributes( searchRequest.getAttributes() );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchingOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchingOperationContext.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchingOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/SearchingOperationContext.java Sat Jun 7 21:28:39 2008
@@ -20,6 +20,7 @@
package org.apache.directory.server.core.interceptor.context;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -53,33 +54,35 @@
{
/** The LoggerFactory used by this Interceptor */
private static Logger LOG = LoggerFactory.getLogger( SearchingOperationContext.class );
+
+ private static String[] EMPTY_STR_ARRAY = new String[0];
/** A flag describing the way alias should be handled */
- private AliasDerefMode aliasDerefMode = AliasDerefMode.DEREF_ALWAYS;
+ protected AliasDerefMode aliasDerefMode = AliasDerefMode.DEREF_ALWAYS;
/** The sizeLimit for this search operation */
- private long sizeLimit = 0;
+ protected long sizeLimit = 0;
/** The timeLimit for this search operation */
- private int timeLimit = 0;
+ protected int timeLimit = 0;
/** The scope for this search : default to One Level */
- private SearchScope scope = ONELEVEL;
+ protected SearchScope scope = ONELEVEL;
/** A flag set if the returned attributes set contains '+' */
- private boolean allOperationalAttributes = false;
+ protected boolean allOperationalAttributes = false;
/** A flag set if the returned attributes set contains '*' */
- private boolean allUserAttributes = false;
+ protected boolean allUserAttributes = false;
/** A flag set if the returned attributes set contains '1.1' */
- private boolean noAttributes = false;
+ protected boolean noAttributes = false;
/** A set containing the returning attributeTypesOptions */
- private Set<AttributeTypeOptions> returningAttributes;
+ protected Set<AttributeTypeOptions> returningAttributes;
/** A flag if the search operation is abandoned */
- private boolean abandoned = false;
+ protected boolean abandoned = false;
/**
@@ -115,27 +118,20 @@
}
- /**
- * Creates a new instance of ListOperationContext.
- *
- * @param dn The DN to get the suffix from
- * @param aliasDerefMode the alias dereferencing mode to use
- * @throws NamingException
- */
- public SearchingOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode,
- SearchControls searchControls ) throws NamingException
+ protected void setReturningAttributes( Collection<String> attributesIds )
+ throws Exception
{
- super( session, dn );
- this.aliasDerefMode = aliasDerefMode;
- this.scope = SearchScope.getSearchScope( searchControls );
- this.timeLimit = searchControls.getTimeLimit();
- this.sizeLimit = searchControls.getCountLimit();
-
- if ( searchControls.getReturningAttributes() != null )
+ setReturningAttributes( attributesIds.toArray( EMPTY_STR_ARRAY ) );
+ }
+
+
+ protected void setReturningAttributes( String[] attributesIds ) throws Exception
+ {
+ if ( attributesIds != null )
{
returningAttributes = new HashSet<AttributeTypeOptions>();
- for ( String returnAttribute : searchControls.getReturningAttributes() )
+ for ( String returnAttribute : attributesIds )
{
if ( returnAttribute.equals( SchemaConstants.NO_ATTRIBUTE ) )
{
@@ -174,6 +170,29 @@
}
}
}
+
+
+ /**
+ * Creates a new instance of ListOperationContext.
+ *
+ * @param dn The DN to get the suffix from
+ * @param aliasDerefMode the alias dereferencing mode to use
+ * @throws NamingException
+ */
+ public SearchingOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode,
+ SearchControls searchControls ) throws Exception
+ {
+ super( session, dn );
+ this.aliasDerefMode = aliasDerefMode;
+ this.scope = SearchScope.getSearchScope( searchControls );
+ this.timeLimit = searchControls.getTimeLimit();
+ this.sizeLimit = searchControls.getCountLimit();
+
+ if ( searchControls.getReturningAttributes() != null )
+ {
+ setReturningAttributes( searchControls.getReturningAttributes() );
+ }
+ }
/**
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=664437&r1=664436&r2=664437&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Sat Jun 7 21:28:39 2008
@@ -25,6 +25,7 @@
import org.apache.directory.server.core.DefaultDirectoryService;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.OperationManager;
+import org.apache.directory.server.core.ReferralHandlingMode;
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.changelog.ChangeLog;
import org.apache.directory.server.core.cursor.Cursor;
@@ -453,6 +454,20 @@
// TODO Auto-generated method stub
return false;
}
+
+
+ public ReferralHandlingMode getReferralHandlingMode()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ public void setReferralHandlingMode( ReferralHandlingMode referralHandlingMode )
+ {
+ // TODO Auto-generated method stub
+
+ }
}
class MockDirectoryService implements DirectoryService