You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2008/05/05 09:58:15 UTC
svn commit: r653338 - in /directory/apacheds/branches/bigbang: ./
core-integ/src/test/java/org/apache/directory/server/core/authz/ core-jndi/
core/src/main/java/org/apache/directory/server/core/interceptor/context/
core/src/main/java/org/apache/directo...
Author: elecharny
Date: Mon May 5 00:58:14 2008
New Revision: 653338
URL: http://svn.apache.org/viewvc?rev=653338&view=rev
Log:
o Moved the invocation stack handling into the OperationContext
o Added a @Factory into the AdministratorsGroup test to avoid a NPE when the test is run alone
o added a package for core-jndi (not yeat integrated into the build)
o Modify te PartitionNexusProxy to use the OperationContext modification with the Invocation
Added:
directory/apacheds/branches/bigbang/core-jndi/
Modified:
directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.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/invocation/Invocation.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
directory/apacheds/branches/bigbang/pom.xml
Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java?rev=653338&r1=653337&r2=653338&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java Mon May 5 00:58:14 2008
@@ -76,6 +76,7 @@
* @throws Exception on failures
*/
@Test
+ @Factory ( AutzIntegUtils.ServiceFactory.class )
public void testNonAdminReadAccessToGroups() throws Exception
{
Name billydDn = createUser( "billyd", "s3kr3t" );
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=653338&r1=653337&r2=653338&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 Mon May 5 00:58:14 2008
@@ -25,6 +25,8 @@
import javax.naming.ldap.Control;
+import org.apache.directory.server.core.invocation.Invocation;
+import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -55,7 +57,6 @@
/** The global registries reference */
private Registries registries;
-
/**
* Creates a new instance of AbstractOperationContext.
*
@@ -220,4 +221,26 @@
{
return registries;
}
+
+
+ /**
+ * Add the invocation into the invocation stack
+ *
+ * @param invocation The new invocation.
+ */
+ public void push( Invocation invocation )
+ {
+ InvocationStack stack = InvocationStack.getInstance();
+ stack.push( invocation );
+ }
+
+
+ /**
+ * Remove the invocation fro the invocation stack
+ */
+ public void pop()
+ {
+ InvocationStack stack = InvocationStack.getInstance();
+ stack.pop();
+ }
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/invocation/Invocation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/invocation/Invocation.java?rev=653338&r1=653337&r2=653338&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/invocation/Invocation.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/invocation/Invocation.java Mon May 5 00:58:14 2008
@@ -20,10 +20,8 @@
package org.apache.directory.server.core.invocation;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
-import java.util.List;
import java.util.Collection;
import java.util.Set;
@@ -43,7 +41,6 @@
{
private final Context caller;
private final String name;
- private final List<Object> parameters;
private final Collection<String> bypassed;
private final PartitionNexusProxy proxy;
@@ -58,20 +55,7 @@
*/
public Invocation( PartitionNexusProxy proxy, Context caller, String name )
{
- this( proxy, caller, name, null, EMPTY_STRING_SET );
- }
-
-
- /**
- * Creates a new instance.
- *
- * @param caller the JNDI {@link Context} that made this invocation
- * @param name the name of the called method
- * @param parameters the array of parameters passed to the called method
- */
- public Invocation( PartitionNexusProxy proxy, Context caller, String name, Object[] parameters )
- {
- this( proxy, caller, name, parameters, EMPTY_STRING_SET );
+ this( proxy, caller, name, EMPTY_STRING_SET );
}
@@ -83,8 +67,7 @@
* @param parameters the array of parameters passed to the called method
* @param bypassed the set of bypassed Interceptor names
*/
- public Invocation( PartitionNexusProxy proxy, Context caller, String name, Object[] parameters,
- Collection<String> bypassed )
+ public Invocation( PartitionNexusProxy proxy, Context caller, String name, Collection<String> bypassed )
{
if ( proxy == null )
{
@@ -101,11 +84,6 @@
throw new NullPointerException( "name" );
}
- if ( parameters == null )
- {
- parameters = new Object[0];
- }
-
if ( bypassed == null )
{
this.bypassed = EMPTY_STRING_SET;
@@ -118,15 +96,6 @@
this.proxy = proxy;
this.caller = caller;
this.name = name;
-
- List<Object> paramList = new ArrayList<Object>();
-
- for ( int i = 0; i < parameters.length; i++ )
- {
- paramList.add( parameters[i] );
- }
-
- this.parameters = Collections.unmodifiableList( paramList );
}
@@ -158,15 +127,6 @@
/**
- * Returns the list of parameters parameters passed to the called method.
- */
- public List<Object> getParameters()
- {
- return parameters;
- }
-
-
- /**
* Checks to see if an interceptor is bypassed.
*
* @param interceptorName the interceptorName of the interceptor to check for bypass
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?rev=653338&r1=653337&r2=653338&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java Mon May 5 00:58:14 2008
@@ -40,11 +40,14 @@
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.entry.ServerEntry;
import org.apache.directory.server.core.entry.ServerSearchResult;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.event.EventInterceptor;
+import org.apache.directory.server.core.exception.ExceptionInterceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -79,7 +82,6 @@
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.name.LdapDN;
-
/**
* A decorator that wraps other {@link PartitionNexus} to enable
* {@link InterceptorChain} and {@link InvocationStack} support.
@@ -106,6 +108,8 @@
* 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
@@ -186,6 +190,24 @@
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( AuthenticationInterceptor.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 );
+
}
@@ -316,17 +338,15 @@
public LdapDN getMatchedName( GetMatchedNameOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- Object[] args = new Object[] {opContext};
- stack.push( new Invocation( this, caller, "getMatchedName", args, bypass ) );
-
+ opContext.push( new Invocation( this, caller, "getMatchedName", bypass ) );
+
try
{
return service.getInterceptorChain().getMatchedName( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -340,16 +360,15 @@
public LdapDN getSuffix( GetSuffixOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- Object[] args = new Object[] {opContext};
- stack.push( new Invocation( this, caller, "getSuffixDn", args, bypass ) );
+ opContext.push( new Invocation( this, caller, "getSuffixDn", bypass ) );
+
try
{
return service.getInterceptorChain().getSuffix( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -363,16 +382,15 @@
public Iterator<String> listSuffixes( ListSuffixOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- Object[] args = new Object[] {};
- stack.push( new Invocation( this, caller, "listSuffixes", args, bypass ) );
+ opContext.push( new Invocation( this, caller, "listSuffices", bypass ) );
+
try
{
return service.getInterceptorChain().listSuffixes( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -386,16 +404,15 @@
public boolean compare( CompareOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "compare", new Object[]
- {opContext}, bypass ) );
+ opContext.push( new Invocation( this, caller, "compare", bypass ) );
+
try
{
return service.getInterceptorChain().compare( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -409,16 +426,15 @@
public void delete( DeleteOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "delete", new Object[]
- {opContext}, bypass ) );
+ opContext.push( new Invocation( this, caller, "delete", bypass ) );
+
try
{
service.getInterceptorChain().delete( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -432,16 +448,15 @@
public void add( AddOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "add", new Object[]
- {opContext}, bypass ) );
+ opContext.push( new Invocation( this, caller, "add", bypass ) );
+
try
{
service.getInterceptorChain().add( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -455,17 +470,15 @@
public void modify( ModifyOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "modify", new Object[]
- {opContext}, bypass ) );
-
+ opContext.push( new Invocation( this, caller, "modify", bypass ) );
+
try
{
service.getInterceptorChain().modify( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -480,16 +493,15 @@
throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "list", new Object[]
- {opContext}, bypass ) );
+ opContext.push( new Invocation( this, caller, "list", bypass ) );
+
try
{
return service.getInterceptorChain().list( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -550,16 +562,15 @@
throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "search", new Object[]
- {opContext}, bypass ) );
+ opContext.push( new Invocation( this, caller, "search", bypass ) );
+
try
{
return service.getInterceptorChain().search( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -604,16 +615,15 @@
public ServerEntry lookup( LookupOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "lookup", new Object[]
- {opContext}, bypass ) );
+ opContext.push( new Invocation( this, caller, "lookup", bypass ) );
+
try
{
return service.getInterceptorChain().lookup( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -626,16 +636,15 @@
public boolean hasEntry( EntryOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "hasEntry", new Object[]
- {opContext}, bypass ) );
+ opContext.push( new Invocation( this, caller, "hasEntry", bypass ) );
+
try
{
return service.getInterceptorChain().hasEntry( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -649,17 +658,15 @@
public void rename( RenameOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- Object[] args = new Object[]
- {opContext};
- stack.push( new Invocation( this, caller, "rename", args, bypass ) );
+ opContext.push( new Invocation( this, caller, "rename", bypass ) );
+
try
{
service.getInterceptorChain().rename( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -673,16 +680,15 @@
public void move( MoveOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "move", new Object[]
- {opContext}, bypass ) );
+ opContext.push( new Invocation( this, caller, "move", bypass ) );
+
try
{
service.getInterceptorChain().move( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -697,17 +703,15 @@
throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- Object[] args = new Object[]
- {opContext};
- stack.push( new Invocation( this, caller, "moveAndRename", args, bypass ) );
+ opContext.push( new Invocation( this, caller, "moveAndRename", bypass ) );
+
try
{
service.getInterceptorChain().moveAndRename( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -722,36 +726,31 @@
throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- Object[] args = new Object[]
- {opContext};
-
- stack.push( new Invocation( this, caller, "bind", args, bypass ) );
-
+ opContext.push( new Invocation( this, caller, "bind", bypass ) );
+
try
{
service.getInterceptorChain().bind( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
+
public void unbind( UnbindOperationContext opContext, Collection<String> bypass ) throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- Object[] args = new Object[]
- {opContext};
- stack.push( new Invocation( this, caller, "unbind", args, bypass ) );
+ opContext.push( new Invocation( this, caller, "unbind", bypass ) );
+
try
{
service.getInterceptorChain().unbind( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -776,14 +775,14 @@
{
if ( ROOT_DSE_ALL == null )
{
- ROOT_DSE_ALL = getRootDSE( null, null );
+ ROOT_DSE_ALL = getRootDSE( opContext, null );
}
}
return ROOT_DSE_ALL;
}
- return getRootDSE( null, null );
+ return getRootDSE( opContext, null );
}
@@ -791,15 +790,15 @@
throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "getRootDSE", null, bypass ) );
+ opContext.push( new Invocation( this, caller, "getRootDSE", GET_ROOT_DSE_BYPASS ) );
+
try
{
return service.getInterceptorChain().getRootDSE( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -814,16 +813,15 @@
throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "addContextPartition", new Object[]
- {opContext}, bypass ) );
+ opContext.push( new Invocation( this, caller, "addContextPartition", bypass ) );
+
try
{
service.getInterceptorChain().addContextPartition( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
@@ -838,16 +836,15 @@
throws NamingException
{
ensureStarted();
- InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( this, caller, "removeContextPartition", new Object[]
- {opContext}, bypass ) );
+ opContext.push( new Invocation( this, caller, "removeContextPartition", bypass ) );
+
try
{
service.getInterceptorChain().removeContextPartition( opContext );
}
finally
{
- stack.pop();
+ opContext.pop();
}
}
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=653338&r1=653337&r2=653338&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Mon May 5 00:58:14 2008
@@ -97,7 +97,7 @@
Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
- Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]{ dn } );
+ Invocation i = new Invocation( proxy, ctx, "lookup" );
InvocationStack.getInstance().push( i );
try
@@ -122,8 +122,7 @@
Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
- Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
- { dn }, Collections.singleton( "0" ) );
+ Invocation i = new Invocation( proxy, ctx, "lookup", Collections.singleton( "0" ) );
InvocationStack.getInstance().push( i );
try
@@ -151,8 +150,7 @@
Set<String> bypass = new HashSet<String>();
bypass.add( "0" );
bypass.add( "1" );
- Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
- { dn }, bypass );
+ Invocation i = new Invocation( proxy, ctx, "lookup", bypass );
InvocationStack.getInstance().push( i );
try
@@ -180,8 +178,7 @@
Set<String> bypass = new HashSet<String>();
bypass.add( "0" );
bypass.add( "4" );
- Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
- { dn }, bypass );
+ Invocation i = new Invocation( proxy, ctx, "lookup", bypass );
InvocationStack.getInstance().push( i );
try
@@ -208,8 +205,7 @@
Set<String> bypass = new HashSet<String>();
bypass.add( "1" );
bypass.add( "3" );
- Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
- { dn }, bypass );
+ Invocation i = new Invocation( proxy, ctx, "lookup", bypass );
InvocationStack.getInstance().push( i );
try
@@ -233,8 +229,7 @@
Context ctx = new DeadContext();
DirectoryService ds = new MockDirectoryService();
PartitionNexusProxy proxy = new PartitionNexusProxy( ctx, ds );
- Invocation i = new Invocation( proxy, ctx, "lookup", new Object[]
- { dn }, PartitionNexusProxy.BYPASS_ALL_COLLECTION );
+ Invocation i = new Invocation( proxy, ctx, "lookup", PartitionNexusProxy.BYPASS_ALL_COLLECTION );
InvocationStack.getInstance().push( i );
try
Modified: directory/apacheds/branches/bigbang/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/pom.xml?rev=653338&r1=653337&r2=653338&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/pom.xml (original)
+++ directory/apacheds/branches/bigbang/pom.xml Mon May 5 00:58:14 2008
@@ -343,7 +343,7 @@
<module>jdbm-store</module>
<module>btree-base</module>
<module>core</module>
- <!-- module>core-jndi</module -->
+ <!--module>core-jndi</module-->
<module>core-constants</module>
<module>core-shared</module>
<module>core-plugin</module>