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/02 16:00:26 UTC
svn commit: r662440 [4/8] - in /directory:
apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/
apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/
apacheds/branches/bigbang/c...
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListOperationContext.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListOperationContext.java Mon Jun 2 07:00:23 2008
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.interceptor.context;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
@@ -37,9 +37,9 @@
/**
* Creates a new instance of ListOperationContext.
*/
- public ListOperationContext( Registries registries )
+ public ListOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
@@ -48,9 +48,9 @@
*
* @param dn The DN to get the suffix from
*/
- public ListOperationContext( Registries registries, LdapDN dn )
+ public ListOperationContext( CoreSession session, LdapDN dn )
{
- super( registries, dn );
+ super( session, dn );
}
@@ -60,9 +60,9 @@
* @param dn The DN to get the suffix from
* @param aliasDerefMode the alias dereferencing mode to use
*/
- public ListOperationContext( Registries registries, LdapDN dn, AliasDerefMode aliasDerefMode )
+ public ListOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode )
{
- super( registries, dn, aliasDerefMode );
+ super( session, dn, aliasDerefMode );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java Mon Jun 2 07:00:23 2008
@@ -19,9 +19,12 @@
*/
package org.apache.directory.server.core.interceptor.context;
+
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.name.LdapDN;
+
/**
* A ListSuffix context used for Interceptors. It contains all the informations
* needed for the ListSuffix operation, and used by all the interceptors
@@ -34,9 +37,9 @@
/**
* Creates a new instance of ListSuffixOperationContext.
*/
- public ListSuffixOperationContext( Registries registries )
+ public ListSuffixOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
/**
@@ -44,9 +47,9 @@
*
* @param dn The DN to get the suffix from
*/
- public ListSuffixOperationContext( Registries registries, LdapDN dn )
+ public ListSuffixOperationContext( CoreSession session, Registries registries, LdapDN dn )
{
- super( registries, dn );
+ super( session, dn );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java Mon Jun 2 07:00:23 2008
@@ -18,15 +18,17 @@
*
*/
package org.apache.directory.server.core.interceptor.context;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.util.StringTools;
+
/**
* A Lookup context used for Interceptors. It contains all the informations
* needed for the lookup operation, and used by all the interceptors
@@ -42,34 +44,37 @@
/** The list of attributes OIDs for attributes to be returned */
private List<String> attrsOid;
+
/**
*
* Creates a new instance of LookupOperationContext.
*
*/
- public LookupOperationContext( Registries registries )
+ public LookupOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
+
/**
*
* Creates a new instance of LookupOperationContext.
*
*/
- public LookupOperationContext( Registries registries, LdapDN dn )
+ public LookupOperationContext( CoreSession session, LdapDN dn )
{
- super( registries, dn );
+ super( session, dn );
}
+
/**
*
* Creates a new instance of LookupOperationContext.
*
*/
- public LookupOperationContext( Registries registries, String attrsId[] )
+ public LookupOperationContext( CoreSession session, String attrsId[] )
{
- super( registries );
+ super( session );
this.attrsId = new ArrayList<String>();
attrsOid = new ArrayList<String>();
setAttrsId( attrsId );
@@ -80,9 +85,9 @@
* Creates a new instance of LookupOperationContext.
*
*/
- public LookupOperationContext( Registries registries, LdapDN dn, String attrsId[] )
+ public LookupOperationContext( CoreSession session, LdapDN dn, String attrsId[] )
{
- super( registries, dn );
+ super( session, dn );
this.attrsId = new ArrayList<String>();
attrsOid = new ArrayList<String>();
setAttrsId( attrsId );
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=662440&r1=662439&r2=662440&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 Mon Jun 2 07:00:23 2008
@@ -19,20 +19,22 @@
*/
package org.apache.directory.server.core.interceptor.context;
+
import java.util.ArrayList;
import java.util.List;
import javax.naming.NamingException;
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.ServerModification;
-import org.apache.directory.server.schema.registries.Registries;
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.name.LdapDN;
+
/**
* A Modify context used for Interceptors. It contains all the informations
* needed for the modify operation, and used by all the interceptors
@@ -49,13 +51,11 @@
/**
- *
* Creates a new instance of ModifyOperationContext.
- *
*/
- public ModifyOperationContext( Registries registries )
+ public ModifyOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
@@ -65,9 +65,9 @@
* @param dn the dn of the entry to be modified
* @param modItems the modifications to be performed on the entry
*/
- public ModifyOperationContext( Registries registries, LdapDN dn, List<Modification> modItems )
+ public ModifyOperationContext( CoreSession session, LdapDN dn, List<Modification> modItems )
{
- super( registries, dn );
+ super( session, dn );
this.modItems = modItems;
}
@@ -79,9 +79,10 @@
* @param modItems the modifications to be performed on the entry
* @param collateralOperation true if op is collateral, false otherwise
*/
- public ModifyOperationContext( Registries registries, LdapDN dn, List<Modification> modItems, boolean collateralOperation )
+ public ModifyOperationContext( CoreSession session, LdapDN dn,
+ List<Modification> modItems, boolean collateralOperation )
{
- super( registries, dn, collateralOperation );
+ super( session, dn, collateralOperation );
this.modItems = modItems;
}
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=662440&r1=662439&r2=662440&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 Mon Jun 2 07:00:23 2008
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.interceptor.context;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
@@ -41,9 +41,9 @@
/**
* Creates a new instance of MoveAndRenameOperationContext.
*/
- public MoveAndRenameOperationContext( Registries registries )
+ public MoveAndRenameOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
@@ -55,9 +55,9 @@
* @param newRdn the new rdn to use for the target once renamed
* @param delOldRdn true if the old rdn value is deleted, false otherwise
*/
- public MoveAndRenameOperationContext( Registries registries, LdapDN oldDn, LdapDN parent, Rdn newRdn, boolean delOldRdn )
+ public MoveAndRenameOperationContext( CoreSession session, LdapDN oldDn, LdapDN parent, Rdn newRdn, boolean delOldRdn )
{
- super( registries, oldDn, newRdn, delOldRdn );
+ super( session, oldDn, newRdn, delOldRdn );
this.parent = parent;
}
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=662440&r1=662439&r2=662440&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 Mon Jun 2 07:00:23 2008
@@ -19,10 +19,12 @@
*/
package org.apache.directory.server.core.interceptor.context;
-import org.apache.directory.server.schema.registries.Registries;
+
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
+
/**
* A Move context used for Interceptors. It contains all the informations
* needed for the modify DN operation, and used by all the interceptors
@@ -35,27 +37,26 @@
/** The parent DN */
private LdapDN parent;
+
/**
- *
* Creates a new instance of MoveOperationContext.
- *
*/
- public MoveOperationContext( Registries registries )
+ public MoveOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
+
/**
- *
* Creates a new instance of MoveOperationContext.
- *
*/
- public MoveOperationContext( Registries registries, LdapDN oldDn, LdapDN parent )
+ public MoveOperationContext( CoreSession session, LdapDN oldDn, LdapDN parent )
{
- super( registries, oldDn );
+ super( session, oldDn );
this.parent = parent;
}
+
/**
* @return The parent DN
*/
@@ -63,6 +64,7 @@
{
return parent;
}
+
/**
* Set the parent DN
@@ -92,5 +94,4 @@
return "ReplaceContext for old DN '" + getDn().getUpName() + "'" +
", parent '" + parent + "'";
}
-
}
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=662440&r1=662439&r2=662440&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 Mon Jun 2 07:00:23 2008
@@ -20,9 +20,12 @@
package org.apache.directory.server.core.interceptor.context;
+import java.util.Collection;
+
import javax.naming.ldap.Control;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -60,11 +63,6 @@
/**
- * @return The global registries
- */
- Registries getRegistries();
-
- /**
* Set the context DN
*
* @param dn The DN to set
@@ -140,6 +138,14 @@
/**
+ * Checks if any request controls exists for this operation.
+ *
+ * @return true if any request controls exist, false otherwise
+ */
+ boolean hasRequestControls();
+
+
+ /**
* Gets a request control if present for this request.
*
* @param numericOid the numeric OID of the control also known as it's type OID
@@ -157,21 +163,62 @@
/**
- * Set the principal DN into this context.
- *
- * @param principalDn the principal DN
+ * @return the operation's name
+ */
+ String getName();
+
+
+ /**
+ * Checks to see if an Interceptor is bypassed for this operation.
+ *
+ * @param interceptorName the interceptorName of the Interceptor to check for bypass
+ * @return true if the Interceptor should be bypassed, false otherwise
*/
- void setPrincipalDN( LdapDN principalDn );
+ boolean isBypassed( String interceptorName );
+
+ /**
+ * Checks to see if any Interceptors are bypassed by this Invocation.
+ *
+ * @return true if at least one bypass exists
+ */
+ boolean hasBypass();
+
/**
- * @return the PrincipalDN
+ * Gets the set of bypassed Interceptors.
+ *
+ * @return the set of bypassed Interceptors
*/
- LdapDN getPrincipalDN();
+ Collection<String> getByPassed();
/**
- * @return the operation's name
+ * Sets the set of bypassed Interceptors.
+ *
+ * @param byPassed the set of bypassed Interceptors
*/
- String getName();
+ void setByPassed( Collection<String> byPassed );
+
+
+ /**
+ * Gets the session associated with this operation.
+ *
+ * @return the session associated with this operation
+ */
+ CoreSession getSession();
+
+
+ // -----------------------------------------------------------------------
+ // Utility Factory Methods to Create New OperationContexts
+ // -----------------------------------------------------------------------
+
+
+ LookupOperationContext newLookupContext( LdapDN dn );
+
+
+ ClonedServerEntry lookup( LdapDN dn, Collection<String> bypass ) throws Exception;
+
+
+ ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception;
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java Mon Jun 2 07:00:23 2008
@@ -19,9 +19,11 @@
*/
package org.apache.directory.server.core.interceptor.context;
-import org.apache.directory.server.schema.registries.Registries;
+
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.name.LdapDN;
+
/**
* A RemoveContextPartition context used for Interceptors. It contains all the informations
* needed for the removeContextPartition operation, and used by all the interceptors
@@ -34,20 +36,21 @@
/**
* Creates a new instance of RemoveContextPartitionOperationContext.
*/
- public RemoveContextPartitionOperationContext( Registries registries )
+ public RemoveContextPartitionOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
+
/**
* Creates a new instance of RemoveContextPartitionOperationContext.
*
* @param registries
* @param dn The Entry DN from which the partition should be removed
*/
- public RemoveContextPartitionOperationContext( Registries registries, LdapDN dn )
+ public RemoveContextPartitionOperationContext( CoreSession session, LdapDN dn )
{
- super( registries, dn );
+ super( session, dn );
}
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=662440&r1=662439&r2=662440&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 Mon Jun 2 07:00:23 2008
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.interceptor.context;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
@@ -47,9 +47,9 @@
/**
* Creates a new instance of RenameOperationContext.
*/
- public RenameOperationContext( Registries registries )
+ public RenameOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
@@ -60,9 +60,9 @@
* @param newRdn the new RDN to use for the target
* @param delOldDn true if we delete the old RDN value
*/
- public RenameOperationContext( Registries registries, LdapDN oldDn, Rdn newRdn, boolean delOldDn )
+ public RenameOperationContext( CoreSession session, LdapDN oldDn, Rdn newRdn, boolean delOldDn )
{
- super( registries, oldDn );
+ super( session, oldDn );
this.newRdn = newRdn;
this.delOldDn = delOldDn;
}
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=662440&r1=662439&r2=662440&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 Mon Jun 2 07:00:23 2008
@@ -23,7 +23,7 @@
import javax.naming.NamingException;
import javax.naming.directory.SearchControls;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
@@ -46,9 +46,9 @@
/**
* Creates a new instance of SearchOperationContext.
*/
- public SearchOperationContext( Registries registries )
+ public SearchOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
@@ -60,10 +60,10 @@
* @param searchControls the search controls
* @throws NamingException
*/
- public SearchOperationContext( Registries registries, LdapDN dn, AliasDerefMode aliasDerefMode, ExprNode filter,
+ public SearchOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode, ExprNode filter,
SearchControls searchControls ) throws NamingException
{
- super( registries, dn, aliasDerefMode, searchControls );
+ super( session, dn, aliasDerefMode, searchControls );
this.filter = filter;
}
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=662440&r1=662439&r2=662440&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 Mon Jun 2 07:00:23 2008
@@ -27,7 +27,7 @@
import javax.naming.directory.NoSuchAttributeException;
import javax.naming.directory.SearchControls;
-import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.filter.SearchScope;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
@@ -85,9 +85,9 @@
/**
* Creates a new instance of ListOperationContext.
*/
- public SearchingOperationContext( Registries registries )
+ public SearchingOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
@@ -96,9 +96,9 @@
*
* @param dn The DN to get the suffix from
*/
- public SearchingOperationContext( Registries registries, LdapDN dn )
+ public SearchingOperationContext( CoreSession session, LdapDN dn )
{
- super( registries, dn );
+ super( session, dn );
}
@@ -108,9 +108,9 @@
* @param dn The DN to get the suffix from
* @param aliasDerefMode the alias dereferencing mode to use
*/
- public SearchingOperationContext( Registries registries, LdapDN dn, AliasDerefMode aliasDerefMode )
+ public SearchingOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode )
{
- super( registries, dn );
+ super( session, dn );
this.aliasDerefMode = aliasDerefMode;
}
@@ -122,10 +122,10 @@
* @param aliasDerefMode the alias dereferencing mode to use
* @throws NamingException
*/
- public SearchingOperationContext( Registries registries, LdapDN dn, AliasDerefMode aliasDerefMode,
+ public SearchingOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode,
SearchControls searchControls ) throws NamingException
{
- super( registries, dn );
+ super( session, dn );
this.aliasDerefMode = aliasDerefMode;
this.scope = SearchScope.getSearchScope( searchControls );
this.timeLimit = searchControls.getTimeLimit();
@@ -159,7 +159,9 @@
{
String id = SchemaUtils.stripOptions( returnAttribute );
Set<String> options = SchemaUtils.getOptions( returnAttribute );
- AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( id );
+
+ AttributeType attributeType = session.getDirectoryService()
+ .getRegistries().getAttributeTypeRegistry().lookup( id );
AttributeTypeOptions attrOptions = new AttributeTypeOptions( attributeType, options );
returningAttributes.add( attrOptions );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java Mon Jun 2 07:00:23 2008
@@ -19,10 +19,12 @@
*/
package org.apache.directory.server.core.interceptor.context;
-import org.apache.directory.server.schema.registries.Registries;
+
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.shared.ldap.message.MessageTypeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
+
/**
* A Unbind context used for Interceptors. It contains all the informations
* needed for the unbind operation, and used by all the interceptors
@@ -35,19 +37,20 @@
/**
* Creates a new instance of UnbindOperationContext.
*/
- public UnbindOperationContext( Registries registries )
+ public UnbindOperationContext( CoreSession session )
{
- super( registries );
+ super( session );
}
+
/**
* Creates a new instance of UnbindOperationContext.
*
* @param principalDn The principal DN to unbind
*/
- public UnbindOperationContext( Registries registries, LdapDN principalDn )
+ public UnbindOperationContext( CoreSession session, LdapDN principalDn )
{
- super( registries, principalDn );
+ super( session, principalDn );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/invocation/InvocationStack.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/invocation/InvocationStack.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/invocation/InvocationStack.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/invocation/InvocationStack.java Mon Jun 2 07:00:23 2008
@@ -26,7 +26,7 @@
import java.util.List;
import java.util.Map;
-import javax.naming.Context;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
/**
@@ -34,9 +34,6 @@
* occurs in the same thread since it is called first, so we manages stacks
* for each invocation in {@link ThreadLocal}-like manner. You can just use
* {@link #getInstance()} to get current invocation stack.
- * <p>
- * Using {@link InvocationStack}, you can find out current effective JNDI
- * {@link Context} or detect infinite recursions.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
@@ -50,8 +47,9 @@
Collections.synchronizedMap( new IdentityHashMap<Thread, InvocationStack>() );
private final Thread thread;
- private final List<Invocation> stack = new ArrayList<Invocation>();
+ private final List<OperationContext> stack = new ArrayList<OperationContext>();
+
/**
* Returns the invocation stack of current thread.
*/
@@ -68,6 +66,7 @@
return ctx;
}
+
private InvocationStack( Thread currentThread )
{
@@ -80,9 +79,9 @@
* Returns an array of {@link Invocation}s. 0th element is the
* latest invocation.
*/
- public Invocation[] toArray()
+ public OperationContext[] toArray()
{
- Invocation[] result = new Invocation[stack.size()];
+ OperationContext[] result = new OperationContext[stack.size()];
result = stack.toArray( result );
return result;
}
@@ -91,7 +90,7 @@
/**
* Returns the latest invocation.
*/
- public Invocation peek()
+ public OperationContext peek()
{
return stack.get( 0 );
}
@@ -109,9 +108,9 @@
/**
* Pushes the specified invocation to this stack.
*/
- public void push( Invocation invocation )
+ public void push( OperationContext opContext )
{
- stack.add( 0, invocation );
+ stack.add( 0, opContext );
}
@@ -119,9 +118,9 @@
* Pops the latest invocation from this stack. This stack is released
* automatically if you pop all items from this stack.
*/
- public Invocation pop()
+ public OperationContext pop()
{
- Invocation invocation = stack.remove( 0 );
+ OperationContext invocation = stack.remove( 0 );
if ( stack.size() == 0 )
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java Mon Jun 2 07:00:23 2008
@@ -20,6 +20,7 @@
package org.apache.directory.server.core.jndi;
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -74,8 +75,8 @@
ServerLdapContext ctx = null;
try
{
- ctx = ( ServerLdapContext ) service.getJndiContext( principalDn, principal, credential,
- authentication, providerUrl );
+ CoreSession session = service.getSession( principalDn, credential, authentication );
+ ctx = new ServerLdapContext( service, session, new LdapDN( providerUrl ) );
}
catch ( Exception e )
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Mon Jun 2 07:00:23 2008
@@ -20,10 +20,10 @@
package org.apache.directory.server.core.jndi;
+import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DefaultCoreSession;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.authn.AuthenticationInterceptor;
import org.apache.directory.server.core.authn.LdapPrincipal;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.entry.ServerEntryUtils;
@@ -42,7 +42,6 @@
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.Modification;
@@ -98,9 +97,6 @@
/** The directory service which owns this context **/
private final DirectoryService service;
- /** The global registries **/
- protected final Registries registries;
-
/** The interceptor proxy to the backend nexus */
private final PartitionNexus nexusProxy;
@@ -124,6 +120,8 @@
/** Connection level controls associated with the session */
protected Control[] connectControls = EMPTY_CONTROLS;
+
+ private final CoreSession session;
// ------------------------------------------------------------------------
@@ -151,7 +149,7 @@
this.service = service;
// set references to cloned env and the proxy
- this.nexusProxy = new PartitionNexusProxy( this, service );
+ this.nexusProxy = new PartitionNexusProxy( service );
this.env = env;
LdapJndiProperties props = LdapJndiProperties.getLdapJndiProperties( this.env );
@@ -161,9 +159,9 @@
doBindOperation( props.getBindDn(), props.getCredentials(), props.getAuthenticationMechanisms(), props
.getSaslAuthId() );
- registries = service.getRegistries();
-
- if ( !nexusProxy.hasEntry( new EntryOperationContext( registries, dn ) ) )
+ session = new DefaultCoreSession( principal, service );
+
+ if ( !nexusProxy.hasEntry( new EntryOperationContext( session, dn ) ) )
{
throw new NameNotFoundException( dn + " does not exist" );
}
@@ -188,14 +186,27 @@
this.env = new Hashtable<String, Object>();
this.env.put( PROVIDER_URL, dn.toString() );
this.env.put( DirectoryService.JNDI_KEY, service );
- this.nexusProxy = new PartitionNexusProxy( this, service );
+ this.nexusProxy = new PartitionNexusProxy( service );
this.principal = principal;
- registries = service.getRegistries();
+ session = new DefaultCoreSession( principal, service );
+ }
+
+
+ public ServerContext( DirectoryService service, CoreSession session, Name dn ) throws Exception
+ {
+ this.service = service;
+ this.dn = ( LdapDN ) dn.clone();
+ this.env = new Hashtable<String, Object>();
+ this.env.put( PROVIDER_URL, dn.toString() );
+ this.env.put( DirectoryService.JNDI_KEY, service );
+ this.nexusProxy = new PartitionNexusProxy( service );
+ this.principal = session.getEffectivePrincipal();
+ this.session = session;
}
// ------------------------------------------------------------------------
- // Protected Methods for Control [De]Marshalling
+ // Protected Methods for Operations
// ------------------------------------------------------------------------
// Use these methods instead of manually calling the nexusProxy so we can
// add request controls to operation contexts before the call and extract
@@ -212,7 +223,7 @@
protected void doAddOperation( LdapDN target, ServerEntry entry ) throws Exception
{
// setup the op context and populate with request controls
- AddOperationContext opCtx = new AddOperationContext( service.getRegistries(), entry );
+ AddOperationContext opCtx = new AddOperationContext( session, entry );
opCtx.addRequestControls( requestControls );
@@ -232,7 +243,7 @@
protected void doDeleteOperation( LdapDN target ) throws Exception
{
// setup the op context and populate with request controls
- DeleteOperationContext opCtx = new DeleteOperationContext( registries, target );
+ DeleteOperationContext opCtx = new DeleteOperationContext( session, target );
opCtx.addRequestControls( requestControls );
// execute delete operation
@@ -256,7 +267,7 @@
ExprNode filter, SearchControls searchControls ) throws Exception
{
// setup the op context and populate with request controls
- SearchOperationContext opCtx = new SearchOperationContext( registries, dn, aliasDerefMode, filter,
+ SearchOperationContext opCtx = new SearchOperationContext( session, dn, aliasDerefMode, filter,
searchControls );
opCtx.addRequestControls( requestControls );
@@ -277,7 +288,7 @@
protected EntryFilteringCursor doListOperation( LdapDN target ) throws Exception
{
// setup the op context and populate with request controls
- ListOperationContext opCtx = new ListOperationContext( registries, target );
+ ListOperationContext opCtx = new ListOperationContext( session, target );
opCtx.addRequestControls( requestControls );
// execute list operation
@@ -293,7 +304,7 @@
protected ServerEntry doGetRootDSEOperation( LdapDN target ) throws Exception
{
- GetRootDSEOperationContext opCtx = new GetRootDSEOperationContext( registries, target );
+ GetRootDSEOperationContext opCtx = new GetRootDSEOperationContext( session, target );
opCtx.addRequestControls( requestControls );
// do not reset request controls since this is not an external
@@ -311,7 +322,7 @@
LookupOperationContext opCtx;
// execute lookup/getRootDSE operation
- opCtx = new LookupOperationContext( registries, target );
+ opCtx = new LookupOperationContext( session, target );
opCtx.addRequestControls( requestControls );
ServerEntry serverEntry = nexusProxy.lookup( opCtx );
@@ -331,7 +342,7 @@
LookupOperationContext opCtx;
// execute lookup/getRootDSE operation
- opCtx = new LookupOperationContext( registries, target, attrIds );
+ opCtx = new LookupOperationContext( session, target, attrIds );
opCtx.addRequestControls( requestControls );
ServerEntry serverEntry = nexusProxy.lookup( opCtx );
@@ -356,17 +367,16 @@
/**
* Used to encapsulate [de]marshalling of controls before and after bind operations.
*/
- protected void doBindOperation( LdapDN bindDn, byte[] credentials, List<String> mechanisms, String saslAuthId )
- throws Exception
+ protected BindOperationContext doBindOperation( LdapDN bindDn, byte[] credentials, List<String> mechanisms,
+ String saslAuthId ) throws Exception
{
// setup the op context and populate with request controls
- BindOperationContext opCtx = new BindOperationContext( registries );
+ BindOperationContext opCtx = new BindOperationContext( null );
opCtx.setDn( bindDn );
opCtx.setCredentials( credentials );
opCtx.setMechanisms( mechanisms );
opCtx.setSaslAuthId( saslAuthId );
opCtx.addRequestControls( requestControls );
- opCtx.setPrincipalDN( bindDn );
// execute bind operation
this.nexusProxy.bind( opCtx );
@@ -374,6 +384,7 @@
// clear the request controls and set the response controls
requestControls = EMPTY_CONTROLS;
responseControls = opCtx.getResponseControls();
+ return opCtx;
}
@@ -384,7 +395,7 @@
throws Exception
{
// setup the op context and populate with request controls
- MoveAndRenameOperationContext opCtx = new MoveAndRenameOperationContext( registries, oldDn, parent, new Rdn(
+ MoveAndRenameOperationContext opCtx = new MoveAndRenameOperationContext( session, oldDn, parent, new Rdn(
newRdn ), delOldDn );
opCtx.addRequestControls( requestControls );
@@ -403,7 +414,7 @@
protected void doModifyOperation( LdapDN dn, List<Modification> modifications ) throws Exception
{
// setup the op context and populate with request controls
- ModifyOperationContext opCtx = new ModifyOperationContext( registries, dn, modifications );
+ ModifyOperationContext opCtx = new ModifyOperationContext( session, dn, modifications );
opCtx.addRequestControls( requestControls );
// execute modify operation
@@ -421,7 +432,7 @@
protected void doMove( LdapDN oldDn, LdapDN target ) throws Exception
{
// setup the op context and populate with request controls
- MoveOperationContext opCtx = new MoveOperationContext( registries, oldDn, target );
+ MoveOperationContext opCtx = new MoveOperationContext( session, oldDn, target );
opCtx.addRequestControls( requestControls );
// execute move operation
@@ -439,7 +450,7 @@
protected void doRename( LdapDN oldDn, String newRdn, boolean delOldRdn ) throws Exception
{
// setup the op context and populate with request controls
- RenameOperationContext opCtx = new RenameOperationContext( registries, oldDn, new Rdn( newRdn ), delOldRdn );
+ RenameOperationContext opCtx = new RenameOperationContext( session, oldDn, new Rdn( newRdn ), delOldRdn );
opCtx.addRequestControls( requestControls );
// execute rename operation
@@ -450,7 +461,19 @@
responseControls = opCtx.getResponseControls();
}
-
+
+ protected CoreSession getSession()
+ {
+ return session;
+ }
+
+
+ protected DirectoryService getDirectoryService()
+ {
+ return service;
+ }
+
+
// ------------------------------------------------------------------------
// New Impl Specific Public Methods
// ------------------------------------------------------------------------
@@ -496,9 +519,9 @@
* @param wrapper the wrapper - has to go
* @todo get ride of using this wrapper and protect this call with a security manager
*/
- public void setPrincipal( AuthenticationInterceptor.TrustedPrincipalWrapper wrapper )
+ public void setPrincipal( LdapPrincipal principal )
{
- this.principal = wrapper.getPrincipal();
+ this.principal = principal;
}
@@ -603,7 +626,7 @@
public Context createSubcontext( Name name ) throws NamingException
{
LdapDN target = buildTarget( name );
- ServerEntry serverEntry = new DefaultServerEntry( registries, target );
+ ServerEntry serverEntry = service.newEntry( target );
serverEntry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, JavaLdapSupport.JCONTAINER_ATTR );
// Now add the CN attribute, which is mandatory
@@ -734,7 +757,7 @@
// let's be sure that the Attributes is case insensitive
ServerEntry outServerEntry = ServerEntryUtils.toServerEntry( AttributeUtils.toCaseInsensitive( res
- .getAttributes() ), target, registries );
+ .getAttributes() ), target, service.getRegistries() );
if ( outServerEntry != null )
{
@@ -774,7 +797,7 @@
else if ( obj instanceof Serializable )
{
// Serialize and add outAttrs
- ServerEntry serverEntry = new DefaultServerEntry( registries, target );
+ ServerEntry serverEntry = service.newEntry( target );
if ( ( outServerEntry != null ) && ( outServerEntry.size() > 0 ) )
{
@@ -788,7 +811,7 @@
injectRdnAttributeValues( target, serverEntry );
// Serialize object into entry attributes and add it.
- JavaLdapSupport.serialize( serverEntry, obj, registries );
+ JavaLdapSupport.serialize( serverEntry, obj, service.getRegistries() );
try
{
doAddOperation( target, serverEntry );
@@ -802,7 +825,7 @@
{
// Grab attributes and merge with outAttrs
ServerEntry serverEntry = ServerEntryUtils.toServerEntry( ( ( DirContext ) obj ).getAttributes( "" ),
- target, registries );
+ target, service.getRegistries() );
if ( ( outServerEntry != null ) && ( outServerEntry.size() > 0 ) )
{
@@ -940,7 +963,7 @@
try
{
- if ( nexusProxy.hasEntry( new EntryOperationContext( registries, target ) ) )
+ if ( nexusProxy.hasEntry( new EntryOperationContext( session, target ) ) )
{
doDeleteOperation( target );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Mon Jun 2 07:00:23 2008
@@ -20,6 +20,7 @@
package org.apache.directory.server.core.jndi;
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.entry.ServerEntry;
@@ -113,6 +114,13 @@
// DirContext Implementations
// ------------------------------------------------------------------------
+
+ public ServerDirContext( DirectoryService service, CoreSession session, LdapDN bindDn ) throws Exception
+ {
+ super( service, session, bindDn );
+ }
+
+
/**
* @see javax.naming.directory.DirContext#getAttributes(java.lang.String)
*/
@@ -201,8 +209,8 @@
}
}
- List<Modification> newMods = ServerEntryUtils.toServerModification( modItems, registries
- .getAttributeTypeRegistry() );
+ List<Modification> newMods = ServerEntryUtils.toServerModification( modItems,
+ getDirectoryService().getRegistries().getAttributeTypeRegistry() );
try
{
@@ -256,7 +264,7 @@
public void modifyAttributes( Name name, ModificationItem[] mods ) throws NamingException
{
List<Modification> newMods = ServerEntryUtils
- .toServerModification( mods, registries.getAttributeTypeRegistry() );
+ .toServerModification( mods, getDirectoryService().getRegistries().getAttributeTypeRegistry() );
try
{
doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
@@ -275,7 +283,7 @@
public void modifyAttributes( Name name, List<ModificationItemImpl> mods ) throws NamingException
{
List<Modification> newMods = ServerEntryUtils
- .toServerModification( mods, registries.getAttributeTypeRegistry() );
+ .toServerModification( mods, getDirectoryService().getRegistries().getAttributeTypeRegistry() );
try
{
doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
@@ -319,7 +327,7 @@
LdapDN target = buildTarget( name );
ServerEntry serverEntry = ServerEntryUtils.toServerEntry( AttributeUtils.toCaseInsensitive( attrs ), target,
- registries );
+ getDirectoryService().getRegistries() );
// No object binding so we just add the attributes
if ( null == obj )
@@ -338,7 +346,8 @@
// First, use state factories to do a transformation
DirStateFactory.Result res = DirectoryManager.getStateToBind( obj, name, this, getEnvironment(), attrs );
- ServerEntry outServerEntry = ServerEntryUtils.toServerEntry( res.getAttributes(), target, registries );
+ ServerEntry outServerEntry = ServerEntryUtils.toServerEntry(
+ res.getAttributes(), target, getDirectoryService().getRegistries() );
if ( outServerEntry != serverEntry )
{
@@ -390,7 +399,7 @@
}
// Serialize object into entry attributes and add it.
- JavaLdapSupport.serialize( serverEntry, obj, registries );
+ JavaLdapSupport.serialize( serverEntry, obj, getDirectoryService().getRegistries() );
try
{
// setup the op context
@@ -405,7 +414,7 @@
{
// Grab attributes and merge with outAttrs
ServerEntry entry = ServerEntryUtils.toServerEntry( ( ( DirContext ) obj ).getAttributes( "" ), target,
- registries );
+ getDirectoryService().getRegistries() );
if ( ( outServerEntry != null ) && ( outServerEntry.size() > 0 ) )
{
@@ -452,7 +461,7 @@
try
{
- if ( getNexusProxy().hasEntry( new EntryOperationContext( registries, target ) ) )
+ if ( getNexusProxy().hasEntry( new EntryOperationContext( getSession(), target ) ) )
{
doDeleteOperation( target );
}
@@ -533,7 +542,8 @@
// Add the new context to the server which as a side effect adds
try
{
- ServerEntry serverEntry = ServerEntryUtils.toServerEntry( attributes, target, registries );
+ ServerEntry serverEntry = ServerEntryUtils.toServerEntry( attributes,
+ target, getDirectoryService().getRegistries() );
doAddOperation( target, serverEntry );
}
catch ( Exception e )
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Mon Jun 2 07:00:23 2008
@@ -28,6 +28,7 @@
import javax.naming.ldap.ExtendedResponse;
import javax.naming.ldap.LdapContext;
+import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.entry.ServerBinaryValue;
@@ -80,7 +81,14 @@
public ServerLdapContext( DirectoryService service, LdapPrincipal principal, LdapDN dn ) throws Exception
{
super( service, principal, dn );
- refService = ( ( ReferralInterceptor ) service.getInterceptorChain().get( ReferralInterceptor.class.getName() ) );
+ refService = ( ( ReferralInterceptor )
+ service.getInterceptorChain().get( ReferralInterceptor.class.getName() ) );
+ }
+
+
+ public ServerLdapContext( DirectoryService service, CoreSession session, LdapDN bindDn ) throws Exception
+ {
+ super( service, session, bindDn );
}
@@ -216,7 +224,7 @@
}
- CompareOperationContext opCtx = new CompareOperationContext( registries, name, oid, val );
+ CompareOperationContext opCtx = new CompareOperationContext( getSession(), name, oid, val );
opCtx.addRequestControls( requestControls );
// execute operation
@@ -248,7 +256,7 @@
public void ldapUnbind() throws NamingException
{
LdapDN principalDn = super.getPrincipal().getJndiName();
- UnbindOperationContext opCtx = new UnbindOperationContext( registries, principalDn );
+ UnbindOperationContext opCtx = new UnbindOperationContext( getSession(), principalDn );
opCtx.addRequestControls( requestControls );
try
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Mon Jun 2 07:00:23 2008
@@ -199,7 +199,8 @@
// Make the modify() call happen
// -------------------------------------------------------------------
- ModifyOperationContext newModify = new ModifyOperationContext( registries, opContext.getDn(), modItemList );
+ ModifyOperationContext newModify = new ModifyOperationContext( opContext.getSession(),
+ opContext.getDn(), modItemList );
service.getPartitionNexus().modify( newModify );
}
@@ -221,7 +222,7 @@
List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );
- ModifyOperationContext newModify = new ModifyOperationContext( registries, newDn, items );
+ ModifyOperationContext newModify = new ModifyOperationContext( opContext.getSession(), newDn, items );
service.getPartitionNexus().modify( newModify );
}
@@ -240,7 +241,7 @@
ModifyOperationContext newModify =
- new ModifyOperationContext( registries, opContext.getParent(), items );
+ new ModifyOperationContext( opContext.getSession(), opContext.getParent(), items );
service.getPartitionNexus().modify( newModify );
}
@@ -259,8 +260,7 @@
List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );
ModifyOperationContext newModify =
- new ModifyOperationContext( registries,
- opContext.getParent(), items );
+ new ModifyOperationContext( opContext.getSession(), opContext.getParent(), items );
service.getPartitionNexus().modify( newModify );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Mon Jun 2 07:00:23 2008
@@ -152,7 +152,7 @@
{
try
{
- return lookup( new LookupOperationContext( entryContext.getRegistries(), entryContext.getDn() ) ) != null;
+ return lookup( entryContext.newLookupContext( entryContext.getDn() ) ) != null;
}
catch ( NameNotFoundException e )
{
Added: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/ByPassConstants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/ByPassConstants.java?rev=662440&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/ByPassConstants.java (added)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/ByPassConstants.java Mon Jun 2 07:00:23 2008
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.server.core.partition;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+
+import org.apache.directory.server.core.authn.AuthenticationInterceptor;
+import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
+import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
+import org.apache.directory.server.core.changelog.ChangeLogInterceptor;
+import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
+import org.apache.directory.server.core.event.EventInterceptor;
+import org.apache.directory.server.core.exception.ExceptionInterceptor;
+import org.apache.directory.server.core.normalization.NormalizationInterceptor;
+import org.apache.directory.server.core.operational.OperationalAttributeInterceptor;
+import org.apache.directory.server.core.referral.ReferralInterceptor;
+import org.apache.directory.server.core.schema.SchemaInterceptor;
+import org.apache.directory.server.core.subtree.SubentryInterceptor;
+import org.apache.directory.server.core.trigger.TriggerInterceptor;
+
+/**
+ * TODO ByPassConstants.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ByPassConstants
+{
+
+ /**
+ * safe to use set of bypass instructions to lookup raw entries
+ */
+ public final static Collection<String> LOOKUP_BYPASS;
+
+ /**
+ * safe to use set of bypass instructions to getMatchedDn
+ */
+ public static final Collection<String> GETMATCHEDDN_BYPASS;
+
+ /**
+ * safe to use set of bypass instructions to lookup raw entries excluding operational attributes
+ */
+ public static final Collection<String> LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS;
+
+ public static final Collection<String> GET_ROOT_DSE_BYPASS;
+
+ /**
+ * Bypass String to use when ALL interceptors should be skipped
+ */
+ public static final String BYPASS_ALL = "*";
+
+ /**
+ * Bypass String to use when ALL interceptors should be skipped
+ */
+ public static final Collection<String> BYPASS_ALL_COLLECTION = Collections.singleton( BYPASS_ALL );
+
+
+ static
+ {
+ Collection<String> c = new HashSet<String>();
+ c.add( NormalizationInterceptor.class.getName() );
+ c.add( AuthenticationInterceptor.class.getName() );
+ c.add( ReferralInterceptor.class.getName() );
+ c.add( AciAuthorizationInterceptor.class.getName() );
+ c.add( DefaultAuthorizationInterceptor.class.getName() );
+ c.add( OperationalAttributeInterceptor.class.getName() );
+ c.add( SchemaInterceptor.class.getName() );
+ c.add( SubentryInterceptor.class.getName() );
+ c.add( EventInterceptor.class.getName() );
+ LOOKUP_BYPASS = Collections.unmodifiableCollection( c );
+
+ c = new HashSet<String>();
+ c.add( AuthenticationInterceptor.class.getName() );
+ c.add( ReferralInterceptor.class.getName() );
+ c.add( AciAuthorizationInterceptor.class.getName() );
+ c.add( DefaultAuthorizationInterceptor.class.getName() );
+ c.add( SchemaInterceptor.class.getName() );
+ c.add( OperationalAttributeInterceptor.class.getName() );
+ c.add( SubentryInterceptor.class.getName() );
+ c.add( EventInterceptor.class.getName() );
+ GETMATCHEDDN_BYPASS = Collections.unmodifiableCollection( c );
+
+ c = new HashSet<String>();
+ c.add( NormalizationInterceptor.class.getName() );
+ c.add( AuthenticationInterceptor.class.getName() );
+ c.add( ReferralInterceptor.class.getName() );
+ c.add( AciAuthorizationInterceptor.class.getName() );
+ c.add( DefaultAuthorizationInterceptor.class.getName() );
+ c.add( SchemaInterceptor.class.getName() );
+ c.add( SubentryInterceptor.class.getName() );
+ c.add( EventInterceptor.class.getName() );
+ c.add( TriggerInterceptor.class.getName() );
+ LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS = Collections.unmodifiableCollection( c );
+
+ c = new HashSet<String>();
+ c.add( NormalizationInterceptor.class.getName() );
+ c.add( ChangeLogInterceptor.class.getName() );
+ c.add( ReferralInterceptor.class.getName() );
+ c.add( AciAuthorizationInterceptor.class.getName() );
+ c.add( DefaultAuthorizationInterceptor.class.getName() );
+ c.add( ExceptionInterceptor.class.getName() );
+ c.add( OperationalAttributeInterceptor.class.getName() );
+ c.add( SchemaInterceptor.class.getName() );
+ c.add( SubentryInterceptor.class.getName() );
+ c.add( CollectiveAttributeInterceptor.class.getName() );
+ c.add( EventInterceptor.class.getName() );
+ c.add( TriggerInterceptor.class.getName() );
+ GET_ROOT_DSE_BYPASS = Collections.unmodifiableCollection( c );
+ }
+}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=662440&r1=662439&r2=662440&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Mon Jun 2 07:00:23 2008
@@ -21,7 +21,10 @@
import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.CoreSession;
+import org.apache.directory.server.core.DefaultCoreSession;
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.cursor.SingletonCursor;
import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.DefaultServerAttribute;
@@ -59,6 +62,7 @@
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.MultiException;
import org.apache.directory.shared.ldap.NotImplementedException;
+import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Value;
@@ -313,8 +317,13 @@
while ( partitions.hasNext() )
{
Partition partition = partitions.next();
+ LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+ adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ CoreSession adminSession = new DefaultCoreSession(
+ new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
+
AddContextPartitionOperationContext opCtx =
- new AddContextPartitionOperationContext( registries, partition );
+ new AddContextPartitionOperationContext( adminSession, partition );
addContextPartition( opCtx );
initializedPartitions.add( opCtx.getPartition() );
}
@@ -407,7 +416,7 @@
Set<String> indexOids = new HashSet<String>();
OidRegistry registry = registries.getOidRegistry();
- for ( Index index : indices )
+ for ( Index<?,ServerEntry> index : indices )
{
indexOids.add( registry.getOid( index.getAttributeId() ) );
}
@@ -417,7 +426,7 @@
LOG.warn( "CAUTION: You have not included objectClass as an indexed attribute" +
"in the system partition configuration. This will lead to poor " +
"performance. The server is automatically adding this index for you." );
- JdbmIndex index = new JdbmIndex();
+ JdbmIndex<?,ServerEntry> index = new JdbmIndex<Object,ServerEntry>();
index.setAttributeId( SchemaConstants.OBJECT_CLASS_AT );
indices.add( index );
}
@@ -436,7 +445,7 @@
// Add objectClass attribute for the system partition
Set<Index<?,ServerEntry>> indexedAttrs = new HashSet<Index<?,ServerEntry>>();
- indexedAttrs.add( new JdbmIndex( SchemaConstants.OBJECT_CLASS_AT ) );
+ indexedAttrs.add( new JdbmIndex<Object,ServerEntry>( SchemaConstants.OBJECT_CLASS_AT ) );
( ( JdbmPartition ) system ).setIndexedAttributes( indexedAttrs );
// Add context entry for system partition
@@ -508,7 +517,12 @@
{
try
{
- removeContextPartition( new RemoveContextPartitionOperationContext( registries, new LdapDN( suffix ) ) );
+ LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+ adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ CoreSession adminSession = new DefaultCoreSession(
+ new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
+ removeContextPartition( new RemoveContextPartitionOperationContext(
+ adminSession, new LdapDN( suffix ) ) );
}
catch ( Exception e )
{
@@ -558,6 +572,7 @@
// ContextPartitionNexus Method Implementations
// ------------------------------------------------------------------------
+
public boolean compare( CompareOperationContext compareContext ) throws Exception
{
Partition partition = getPartition( compareContext.getDn() );
@@ -571,7 +586,8 @@
AttributeType attrType = registry.lookup( compareContext.getOid() );
- EntryAttribute attr = partition.lookup( new LookupOperationContext( registries, compareContext.getDn() ) ).get( attrType.getName() );
+ EntryAttribute attr = partition.lookup( compareContext.newLookupContext(
+ compareContext.getDn() ) ).get( attrType.getName() );
// complain if the attribute being compared does not exist in the entry
if ( attr == null )
@@ -734,13 +750,13 @@
/**
* @see PartitionNexus#getMatchedName( GetMatchedNameOperationContext )
*/
- public LdapDN getMatchedName ( GetMatchedNameOperationContext getMatchedNameContext ) throws Exception
+ public LdapDN getMatchedName ( GetMatchedNameOperationContext matchedNameContext ) throws Exception
{
- LdapDN dn = ( LdapDN ) getMatchedNameContext.getDn().clone();
+ LdapDN dn = ( LdapDN ) matchedNameContext.getDn().clone();
while ( dn.size() > 0 )
{
- if ( hasEntry( new EntryOperationContext( registries, dn ) ) )
+ if ( hasEntry( new EntryOperationContext( matchedNameContext.getSession(), dn ) ) )
{
return dn;
}
@@ -963,7 +979,7 @@
ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() );
- ServerEntry rootDSE = getRootDSE( new GetRootDSEOperationContext( registries ) );
+ ServerEntry rootDSE = getRootDSE( new GetRootDSEOperationContext( opContext.getSession() ) );
for ( EntryAttribute attribute:rootDSE )
{