You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2011/11/12 19:24:43 UTC
svn commit: r1201297 [7/9] - in /directory/apacheds/branches/apacheds-txns:
all/ apache-felix/ core-annotations/ core-api/
core-api/src/main/java/org/apache/directory/server/core/api/
core-api/src/main/java/org/apache/directory/server/core/api/intercep...
Modified: directory/apacheds/branches/apacheds-txns/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Sat Nov 12 18:24:38 2011
@@ -23,14 +23,14 @@ package org.apache.directory.server.core
import org.apache.commons.collections.map.LRUMap;
import org.apache.directory.server.core.api.CoreSession;
import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.HasEntryOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -97,14 +97,18 @@ public class ExceptionInterceptor extend
*/
public ExceptionInterceptor()
{
+ super( InterceptorEnum.EXCEPTION_INTERCEPTOR );
}
+ /**
+ * {@inheritDoc}
+ */
public void init( DirectoryService directoryService ) throws LdapException
{
super.init( directoryService );
nexus = directoryService.getPartitionNexus();
- Value<?> attr = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
+ Value<?> attr = nexus.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
subschemSubentryDn = directoryService.getDnFactory().create( attr.getString() );
}
@@ -118,7 +122,7 @@ public class ExceptionInterceptor extend
* In the pre-invocation state this interceptor method checks to see if the entry to be added already exists. If it
* does an exception is raised.
*/
- public void add( NextInterceptor nextInterceptor, AddOperationContext addContext ) throws LdapException
+ public void add( AddOperationContext addContext ) throws LdapException
{
Dn name = addContext.getDn();
@@ -132,7 +136,7 @@ public class ExceptionInterceptor extend
// we're adding the suffix entry so just ignore stuff to mess with the parent
if ( suffix.equals( name ) )
{
- nextInterceptor.add( addContext );
+ next( addContext );
return;
}
@@ -186,7 +190,7 @@ public class ExceptionInterceptor extend
}
}
- nextInterceptor.add( addContext );
+ next( addContext );
}
@@ -237,7 +241,7 @@ public class ExceptionInterceptor extend
/**
- * Checks to see the base being searched exists, otherwise throws the appropriate LdapException.
+ * {@inheritDoc}
*/
public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
@@ -258,9 +262,9 @@ public class ExceptionInterceptor extend
/**
- * Checks to see the entry being modified exists, otherwise throws the appropriate LdapException.
+ * {@inheritDoc}
*/
- public void modify( NextInterceptor nextInterceptor, ModifyOperationContext modifyContext ) throws LdapException
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
// check if entry to modify exists
String msg = "Attempt to modify non-existant entry: ";
@@ -269,7 +273,7 @@ public class ExceptionInterceptor extend
// and never try to look it up in the nexus below
if ( modifyContext.getDn().equals( subschemSubentryDn ) )
{
- nextInterceptor.modify( modifyContext );
+ next( modifyContext );
return;
}
@@ -290,98 +294,97 @@ public class ExceptionInterceptor extend
}
}
- nextInterceptor.modify( modifyContext );
+ next( modifyContext );
}
/**
- * Checks to see the entry being renamed exists, otherwise throws the appropriate LdapException.
+ * {@inheritDoc}
*/
- public void rename( NextInterceptor nextInterceptor, RenameOperationContext renameContext ) throws LdapException
+ public void move( MoveOperationContext moveContext ) throws LdapException
{
- Dn dn = renameContext.getDn();
+ Dn oriChildName = moveContext.getDn();
- if ( dn.equals( subschemSubentryDn ) )
+ if ( oriChildName.equals( subschemSubentryDn ) )
{
- throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_255,
+ throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258,
subschemSubentryDn, subschemSubentryDn ) );
}
- // check to see if target entry exists
- Dn newDn = renameContext.getNewDn();
-
- if ( nexus.hasEntry( new EntryOperationContext( renameContext.getSession(), newDn ) ) )
- {
- LdapEntryAlreadyExistsException e;
- e = new LdapEntryAlreadyExistsException( I18n.err( I18n.ERR_250_ENTRY_ALREADY_EXISTS, newDn.getName() ) );
- //e.setResolvedName( DNFactory.create( newDn.getName() ) );
- throw e;
- }
+ next( moveContext );
- // Remove the previous entry from the notAnAlias cache
+ // Remove the original entry from the NotAlias cache, if needed
synchronized ( notAliasCache )
{
- if ( notAliasCache.containsKey( dn.getNormName() ) )
+ if ( notAliasCache.containsKey( oriChildName.getNormName() ) )
{
- notAliasCache.remove( dn.getNormName() );
+ notAliasCache.remove( oriChildName.getNormName() );
}
}
-
- nextInterceptor.rename( renameContext );
}
/**
* {@inheritDoc}
*/
- public void move( NextInterceptor nextInterceptor, MoveOperationContext moveContext ) throws LdapException
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
- Dn oriChildName = moveContext.getDn();
+ Dn oldDn = moveAndRenameContext.getDn();
- if ( oriChildName.equals( subschemSubentryDn ) )
+ // Don't allow M&R in the SSSE
+ if ( oldDn.equals( subschemSubentryDn ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258,
subschemSubentryDn, subschemSubentryDn ) );
}
- nextInterceptor.move( moveContext );
-
// Remove the original entry from the NotAlias cache, if needed
synchronized ( notAliasCache )
{
- if ( notAliasCache.containsKey( oriChildName.getNormName() ) )
+ if ( notAliasCache.containsKey( oldDn.getNormName() ) )
{
- notAliasCache.remove( oriChildName.getNormName() );
+ notAliasCache.remove( oldDn.getNormName() );
}
}
+
+ next( moveAndRenameContext );
}
/**
- * Checks to see the entry being moved exists, and so does its parent, otherwise throws the appropriate
- * LdapException.
+ * {@inheritDoc}
*/
- public void moveAndRename( NextInterceptor nextInterceptor, MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+ public void rename( RenameOperationContext renameContext ) throws LdapException
{
- Dn oldDn = moveAndRenameContext.getDn();
+ Dn dn = renameContext.getDn();
- // Don't allow M&R in the SSSE
- if ( oldDn.equals( subschemSubentryDn ) )
+ if ( dn.equals( subschemSubentryDn ) )
{
- throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258,
+ throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_255,
subschemSubentryDn, subschemSubentryDn ) );
}
- // Remove the original entry from the NotAlias cache, if needed
+ // check to see if target entry exists
+ Dn newDn = renameContext.getNewDn();
+
+ if ( nexus.hasEntry( new HasEntryOperationContext( renameContext.getSession(), newDn ) ) )
+ {
+ LdapEntryAlreadyExistsException e;
+ e = new LdapEntryAlreadyExistsException( I18n.err( I18n.ERR_250_ENTRY_ALREADY_EXISTS, newDn.getName() ) );
+ //e.setResolvedName( DNFactory.create( newDn.getName() ) );
+ throw e;
+ }
+
+ // Remove the previous entry from the notAnAlias cache
synchronized ( notAliasCache )
{
- if ( notAliasCache.containsKey( oldDn.getNormName() ) )
+ if ( notAliasCache.containsKey( dn.getNormName() ) )
{
- notAliasCache.remove( oldDn.getNormName() );
+ notAliasCache.remove( dn.getNormName() );
}
}
- nextInterceptor.moveAndRename( moveAndRenameContext );
+ next( renameContext );
}
Propchange: directory/apacheds/branches/apacheds-txns/interceptors/hash/
------------------------------------------------------------------------------
svn:mergeinfo = /directory/apacheds/trunk/interceptors/hash:1183435-1201283
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/CryptPasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/CryptPasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/CryptPasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/CryptPasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class CryptPasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a CryptPasswordHashingInterceptor
+ */
public CryptPasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_CRYPT );
+ super( "CryptPasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_CRYPT );
}
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Md5PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Md5PasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Md5PasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Md5PasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class Md5PasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a Md5PasswordHashingInterceptor
+ */
public Md5PasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_MD5 );
+ super( "Md5PasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_MD5 );
}
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -23,16 +23,15 @@ package org.apache.directory.server.core
import java.util.List;
+import org.apache.directory.server.core.api.authn.PasswordUtil;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.api.authn.PasswordUtil;
import org.apache.directory.shared.ldap.model.constants.LdapSecurityConstants;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
import org.apache.directory.shared.ldap.model.entry.BinaryValue;
import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
import org.apache.directory.shared.ldap.model.entry.Modification;
import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -43,42 +42,35 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class PasswordHashingInterceptor extends BaseInterceptor
+public abstract class PasswordHashingInterceptor extends BaseInterceptor
{
/** the hashing algorithm to be used, if null then the password won't be changed */
private LdapSecurityConstants algorithm;
-
- /**
- * Creates a new instance of PasswordHashingInterceptor which does not hash the passwords.
- */
- public PasswordHashingInterceptor()
- {
- this( null );
- }
-
-
/**
*
* Creates a new instance of PasswordHashingInterceptor which hashes the
* incoming non-hashed password using the given algorithm.
* If the password is found already hashed then it will skip hashing it.
- *
+ *
* @param algorithm the name of the algorithm to be used
*/
- public PasswordHashingInterceptor( LdapSecurityConstants algorithm )
+ protected PasswordHashingInterceptor( String name, LdapSecurityConstants algorithm )
{
+ super( name );
this.algorithm = algorithm;
}
- @Override
- public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void add( AddOperationContext addContext ) throws LdapException
{
if ( algorithm == null )
{
- next.add( addContext );
+ next( addContext );
return;
}
@@ -88,16 +80,18 @@ public class PasswordHashingInterceptor
includeHashedPassword( pwdAt );
- next.add( addContext );
+ next( addContext );
}
- @Override
- public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
if ( algorithm == null )
{
- next.modify( modifyContext );
+ next( modifyContext );
return;
}
@@ -107,7 +101,7 @@ public class PasswordHashingInterceptor
{
String oid = mod.getAttribute().getAttributeType().getOid();
- // check for modification on 'userPassword' AT
+ // check for modification on 'userPassword' AT
if ( SchemaConstants.USER_PASSWORD_AT_OID.equals( oid ) )
{
includeHashedPassword( mod.getAttribute() );
@@ -115,7 +109,7 @@ public class PasswordHashingInterceptor
}
}
- next.modify( modifyContext );
+ next( modifyContext );
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha256PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha256PasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha256PasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha256PasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class Sha256PasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a Sha256PasswordHashingInterceptor
+ */
public Sha256PasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_SHA256 );
+ super( "Sha256PasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_SHA256 );
}
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha384PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha384PasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha384PasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha384PasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class Sha384PasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a Sha384PasswordHashingInterceptor
+ */
public Sha384PasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_SHA384 );
+ super( "Sha384PasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_SHA384 );
}
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha512PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha512PasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha512PasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Sha512PasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class Sha512PasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a Sha512PasswordHashingInterceptor
+ */
public Sha512PasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_SHA512 );
+ super( "Sha512PasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_SHA512 );
}
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ShaPasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ShaPasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ShaPasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ShaPasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class ShaPasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a ShaPasswordHashingInterceptor
+ */
public ShaPasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_SHA );
+ super( "ShaPasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_SHA );
}
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Smd5PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Smd5PasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Smd5PasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Smd5PasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class Smd5PasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a Smd5PasswordHashingInterceptor
+ */
public Smd5PasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_SMD5 );
+ super( "Smd5PasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_SMD5 );
}
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha256PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha256PasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha256PasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha256PasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class Ssha256PasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a Ssha256PasswordHashingInterceptor
+ */
public Ssha256PasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_SSHA256 );
+ super( "Ssha256PasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_SSHA256 );
}
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha384PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha384PasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha384PasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha384PasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class Ssha384PasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a Ssha384PasswordHashingInterceptor
+ */
public Ssha384PasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_SSHA384 );
+ super( "Ssha384PasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_SSHA384 );
}
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha512PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha512PasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha512PasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/Ssha512PasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class Ssha512PasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a Ssha512PasswordHashingInterceptor
+ */
public Ssha512PasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_SSHA512 );
+ super( "Ssha512PasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_SSHA512 );
}
}
Modified: directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/SshaPasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/SshaPasswordHashingInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/SshaPasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/SshaPasswordHashingInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,8 +29,11 @@ import org.apache.directory.shared.ldap.
*/
public class SshaPasswordHashingInterceptor extends PasswordHashingInterceptor
{
+ /**
+ * Creates an instance of a SshaPasswordHashingInterceptor
+ */
public SshaPasswordHashingInterceptor()
{
- super( LdapSecurityConstants.HASH_METHOD_SSHA );
+ super( "SshaPasswordHashingInterceptor", LdapSecurityConstants.HASH_METHOD_SSHA );
}
}
Propchange: directory/apacheds/branches/apacheds-txns/interceptors/journal/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -1 +1 @@
-/directory/apacheds/trunk/interceptors/journal:1183435-1200383
+/directory/apacheds/trunk/interceptors/journal:1183435-1201283
Modified: directory/apacheds/branches/apacheds-txns/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java Sat Nov 12 18:24:38 2011
@@ -22,8 +22,8 @@ package org.apache.directory.server.core
import java.util.concurrent.atomic.AtomicLong;
import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -53,39 +53,47 @@ public class JournalInterceptor extends
{
/** for debugging */
private static final Logger LOG = LoggerFactory.getLogger( JournalInterceptor.class );
-
+
/** A flag set to true if the journal interceptor is enabled */
private boolean journalEnabled;
-
- /** A shared number stored within each change */
+
+ /** A shared number stored within each change */
private AtomicLong revision;
-
+
/** the Journal service to log changes to */
private Journal journal;
-
+ /**
+ * Creates a new instance of a JournalInterceptor.
+ */
+ public JournalInterceptor()
+ {
+ super( InterceptorEnum.JOURNAL_INTERCEPTOR );
+ }
+
+
// -----------------------------------------------------------------------
// Overridden init() and destroy() methods
// -----------------------------------------------------------------------
/**
- * The init method will initialize the local variables and load the
+ * The init method will initialize the local variables and load the
* entryDeleted AttributeType.
*/
public void init( DirectoryService directoryService ) throws LdapException
{
super.init( directoryService );
-
+
if ( directoryService.getJournal().isEnabled() )
{
- journalEnabled = true;
+ journalEnabled = true;
journal = directoryService.getJournal();
revision = new AtomicLong( System.currentTimeMillis() );
}
LOG.debug( "JournalInterceptor has been initialized" );
}
-
-
+
+
/**
* Log the operation, manage the logs rotations.
*/
@@ -93,22 +101,22 @@ public class JournalInterceptor extends
{
journal.log( getPrincipal( opCtx ), revision, ldif );
}
-
-
+
+
// -----------------------------------------------------------------------
// Overridden (only change inducing) intercepted methods
// -----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
- public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+ public void add( AddOperationContext addContext ) throws LdapException
{
long opRevision = 0;
-
+
if ( journalEnabled )
{
opRevision = revision.incrementAndGet();
-
+
// Store the added entry
Entry addEntry = addContext.getEntry();
@@ -121,13 +129,13 @@ public class JournalInterceptor extends
AttributeType attributeType = attribute.getAttributeType();
ldif.addAttribute( addEntry.get( attributeType).clone() );
}
-
+
log( addContext, opRevision, ldif );
}
try
{
- next.add( addContext );
+ next( addContext );
if ( journalEnabled )
{
@@ -142,7 +150,7 @@ public class JournalInterceptor extends
// log the NACK
journal.nack( opRevision );
}
-
+
throw le;
}
}
@@ -154,16 +162,16 @@ public class JournalInterceptor extends
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
long opRevision = 0;
-
+
if ( journalEnabled )
{
opRevision = revision.incrementAndGet();
-
+
// Store the deleted entry
LdifEntry ldif = new LdifEntry();
ldif.setChangeType( ChangeType.Delete );
ldif.setDn( deleteContext.getDn() );
-
+
journal.log( getPrincipal( deleteContext ), opRevision, ldif );
}
@@ -184,7 +192,7 @@ public class JournalInterceptor extends
// log the NACK
journal.nack( opRevision );
}
-
+
throw e;
}
}
@@ -193,31 +201,31 @@ public class JournalInterceptor extends
/**
* {@inheritDoc}
*/
- public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
long opRevision = 0;
-
+
if ( journalEnabled )
{
opRevision = revision.incrementAndGet();
-
+
// Store the modified entry
LdifEntry ldif = new LdifEntry();
ldif.setChangeType( ChangeType.Modify );
ldif.setDn( modifyContext.getDn() );
-
- // Store the modifications
+
+ // Store the modifications
for ( Modification modification:modifyContext.getModItems() )
{
ldif.addModification( modification );
}
-
+
journal.log( getPrincipal( modifyContext ), opRevision, ldif );
}
-
+
try
{
- next.modify( modifyContext );
+ next( modifyContext );
if ( journalEnabled )
{
@@ -240,28 +248,27 @@ public class JournalInterceptor extends
/**
* {@inheritDoc}
*/
- public void rename ( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
+ public void move( MoveOperationContext moveContext ) throws LdapException
{
long opRevision = 0;
-
+
if ( journalEnabled )
{
opRevision = revision.incrementAndGet();
-
- // Store the renamed entry
+
+ // Store the moved entry
LdifEntry ldif = new LdifEntry();
- ldif.setChangeType( ChangeType.ModRdn );
- ldif.setDn( renameContext.getDn() );
- ldif.setNewRdn( renameContext.getNewRdn().getNormName() );
- ldif.setDeleteOldRdn( renameContext.getDeleteOldRdn() );
-
- journal.log( getPrincipal( renameContext ), opRevision, ldif );
+ ldif.setChangeType( ChangeType.ModDn );
+ ldif.setDn( moveContext.getDn() );
+ ldif.setNewSuperior( moveContext.getNewSuperior().getNormName() );
+
+ journal.log( getPrincipal( moveContext ), opRevision, ldif );
}
-
+
try
{
- next.rename( renameContext );
-
+ next( moveContext );
+
if ( journalEnabled )
{
// log the ACK
@@ -275,7 +282,7 @@ public class JournalInterceptor extends
// log the NACK
journal.nack( opRevision );
}
-
+
throw e;
}
}
@@ -284,15 +291,14 @@ public class JournalInterceptor extends
/**
* {@inheritDoc}
*/
- public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext )
- throws LdapException
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
long opRevision = 0;
-
+
if ( journalEnabled )
{
opRevision = revision.incrementAndGet();
-
+
// Store the renamed entry
LdifEntry ldif = new LdifEntry();
ldif.setChangeType( ChangeType.ModDn );
@@ -300,14 +306,14 @@ public class JournalInterceptor extends
ldif.setNewRdn( moveAndRenameContext.getNewRdn().getNormName() );
ldif.setDeleteOldRdn( moveAndRenameContext.getDeleteOldRdn() );
ldif.setNewSuperior( moveAndRenameContext.getNewDn().getNormName() );
-
+
journal.log( getPrincipal( moveAndRenameContext ), opRevision, ldif );
}
-
+
try
{
- next.moveAndRename( moveAndRenameContext );
-
+ next( moveAndRenameContext );
+
if ( journalEnabled )
{
// log the ACK
@@ -321,7 +327,7 @@ public class JournalInterceptor extends
// log the NACK
journal.nack( opRevision );
}
-
+
throw e;
}
}
@@ -330,27 +336,28 @@ public class JournalInterceptor extends
/**
* {@inheritDoc}
*/
- public void move( NextInterceptor next, MoveOperationContext moveContext ) throws LdapException
+ public void rename( RenameOperationContext renameContext ) throws LdapException
{
long opRevision = 0;
-
+
if ( journalEnabled )
{
opRevision = revision.incrementAndGet();
-
- // Store the moved entry
+
+ // Store the renamed entry
LdifEntry ldif = new LdifEntry();
- ldif.setChangeType( ChangeType.ModDn );
- ldif.setDn( moveContext.getDn() );
- ldif.setNewSuperior( moveContext.getNewSuperior().getNormName() );
-
- journal.log( getPrincipal( moveContext ), opRevision, ldif );
+ ldif.setChangeType( ChangeType.ModRdn );
+ ldif.setDn( renameContext.getDn() );
+ ldif.setNewRdn( renameContext.getNewRdn().getNormName() );
+ ldif.setDeleteOldRdn( renameContext.getDeleteOldRdn() );
+
+ journal.log( getPrincipal( renameContext ), opRevision, ldif );
}
-
+
try
{
- next.move( moveContext );
-
+ next( renameContext );
+
if ( journalEnabled )
{
// log the ACK
@@ -364,8 +371,8 @@ public class JournalInterceptor extends
// log the NACK
journal.nack( opRevision );
}
-
+
throw e;
}
- }
+ }
}
\ No newline at end of file
Propchange: directory/apacheds/branches/apacheds-txns/interceptors/logger/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -1 +1 @@
-/directory/apacheds/trunk/interceptors/logger:1183435-1200383
+/directory/apacheds/trunk/interceptors/logger:1183435-1201283
Modified: directory/apacheds/branches/apacheds-txns/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java Sat Nov 12 18:24:38 2011
@@ -25,13 +25,12 @@ import java.util.concurrent.atomic.Atomi
import org.apache.directory.server.core.api.DirectoryService;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.GetRootDSEOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.GetRootDseOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.HasEntryOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -69,9 +68,6 @@ public class TimerInterceptor extends Ba
private static final boolean IS_DEBUG_STATS = OPERATION_STATS.isDebugEnabled();
private static final boolean IS_DEBUG_TIME = OPERATION_TIME.isDebugEnabled();
- /** The Logger's name */
- private String name;
-
/** Stats for the add operation */
private static AtomicLong totalAdd = new AtomicLong( 0 );
private static AtomicInteger nbAddCalls = new AtomicInteger( 0 );
@@ -88,9 +84,9 @@ public class TimerInterceptor extends Ba
private static AtomicLong totalDelete = new AtomicLong( 0 );
private static AtomicInteger nbDeleteCalls = new AtomicInteger( 0 );
- /** Stats for the GetRootDSE operation */
- private static AtomicLong totalGetRootDSE = new AtomicLong( 0 );
- private static AtomicInteger nbGetRootDSECalls = new AtomicInteger( 0 );
+ /** Stats for the GetRootDse operation */
+ private static AtomicLong totalGetRootDse = new AtomicLong( 0 );
+ private static AtomicInteger nbGetRootDseCalls = new AtomicInteger( 0 );
/** Stats for the HasEntry operation */
private static AtomicLong totalHasEntry = new AtomicLong( 0 );
@@ -132,21 +128,37 @@ public class TimerInterceptor extends Ba
*
* Creates a new instance of TimerInterceptor.
*
- * @param name This interceptor's name
+ * @param name This interceptor's getName()
*/
public TimerInterceptor( String name )
{
- this.name = name;
+ super( name );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void init( DirectoryService directoryService ) throws LdapException
+ {
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void destroy()
+ {
}
/**
* {@inheritDoc}
*/
- public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+ public void add( AddOperationContext addContext ) throws LdapException
{
long t0 = System.nanoTime();
- next.add( addContext );
+ next( addContext );
long delta = System.nanoTime() - t0;
if ( IS_DEBUG_STATS )
@@ -157,13 +169,13 @@ public class TimerInterceptor extends Ba
if ( nbAddCalls.get() % 1000 == 0 )
{
long average = totalAdd.get()/(nbAddCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average add = {} microseconds, nb adds = {}", average, nbAddCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average add = {} microseconds, nb adds = {}", average, nbAddCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta add = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta add = {}", getName(), delta );
}
}
@@ -171,7 +183,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public void bind( NextInterceptor next, BindOperationContext bindContext ) throws LdapException
+ public void bind( BindOperationContext bindContext ) throws LdapException
{
long t0 = System.nanoTime();
next( bindContext );
@@ -185,13 +197,13 @@ public class TimerInterceptor extends Ba
if ( nbBindCalls.get() % 1000 == 0 )
{
long average = totalBind.get()/(nbBindCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average bind = {} microseconds, nb binds = {}", average, nbBindCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average bind = {} microseconds, nb binds = {}", average, nbBindCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta bind = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta bind = {}", getName(), delta );
}
}
@@ -213,13 +225,13 @@ public class TimerInterceptor extends Ba
if ( nbCompareCalls.get() % 1000 == 0 )
{
long average = totalCompare.get()/(nbCompareCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average compare = {} microseconds, nb compares = {}", average, nbCompareCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average compare = {} microseconds, nb compares = {}", average, nbCompareCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta compare = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta compare = {}", getName(), delta );
}
return compare;
@@ -243,13 +255,13 @@ public class TimerInterceptor extends Ba
if ( nbDeleteCalls.get() % 1000 == 0 )
{
long average = totalDelete.get()/(nbDeleteCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average delete = {} microseconds, nb deletes = {}", average, nbDeleteCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average delete = {} microseconds, nb deletes = {}", average, nbDeleteCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta delete = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta delete = {}", getName(), delta );
}
}
@@ -257,54 +269,37 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public void destroy()
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- public String getName()
- {
- return name;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext ) throws LdapException
+ public Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException
{
long t0 = System.nanoTime();
- Entry rootDSE = next( getRootDseContext );
+ Entry rootDse = next( getRootDseContext );
long delta = System.nanoTime() - t0;
if ( IS_DEBUG_STATS )
{
- nbGetRootDSECalls.incrementAndGet();
- totalGetRootDSE.getAndAdd( delta );
+ nbGetRootDseCalls.incrementAndGet();
+ totalGetRootDse.getAndAdd( delta );
- if ( nbGetRootDSECalls.get() % 1000 == 0 )
+ if ( nbGetRootDseCalls.get() % 1000 == 0 )
{
- long average = totalGetRootDSE.get()/(nbGetRootDSECalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average getRootDSE = {} microseconds, nb getRootDSEs = {}", average, nbGetRootDSECalls.get() );
+ long average = totalGetRootDse.get()/(nbGetRootDseCalls.get() * 1000);
+ OPERATION_STATS.debug( getName() + " : Average getRootDSE = {} microseconds, nb getRootDSEs = {}", average, nbGetRootDseCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta getRootDSE = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta getRootDSE = {}", getName(), delta );
}
- return rootDSE;
+ return rootDse;
}
/**
* {@inheritDoc}
*/
- public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
+ public boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException
{
long t0 = System.nanoTime();
boolean hasEntry = next( hasEntryContext );
@@ -318,13 +313,13 @@ public class TimerInterceptor extends Ba
if ( nbHasEntryCalls.get() % 1000 == 0 )
{
long average = totalHasEntry.get()/(nbHasEntryCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average hasEntry = {} microseconds, nb hasEntrys = {}", average, nbHasEntryCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average hasEntry = {} microseconds, nb hasEntrys = {}", average, nbHasEntryCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta hasEntry = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta hasEntry = {}", getName(), delta );
}
return hasEntry;
@@ -334,14 +329,6 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public void init( DirectoryService directoryService ) throws LdapException
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -356,13 +343,13 @@ public class TimerInterceptor extends Ba
if ( nbListCalls.get() % 1000 == 0 )
{
long average = totalList.get()/(nbListCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average list = {} microseconds, nb lists = {}", average, nbListCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average list = {} microseconds, nb lists = {}", average, nbListCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta list = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta list = {}", getName(), delta );
}
return cursor;
@@ -386,13 +373,13 @@ public class TimerInterceptor extends Ba
if ( nbLookupCalls.get() % 1000 == 0 )
{
long average = totalLookup.get()/(nbLookupCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average lookup = {} microseconds, nb lookups = {}", average, nbLookupCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average lookup = {} microseconds, nb lookups = {}", average, nbLookupCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta lookup = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta lookup = {}", getName(), delta );
}
return entry;
@@ -402,10 +389,10 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
long t0 = System.nanoTime();
- next.modify( modifyContext );
+ next( modifyContext );
long delta = System.nanoTime() - t0;
if ( IS_DEBUG_STATS )
@@ -416,13 +403,13 @@ public class TimerInterceptor extends Ba
if ( nbModifyCalls.get() % 1000 == 0 )
{
long average = totalModify.get()/(nbModifyCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average modify = {} microseconds, nb modifys = {}", average, nbModifyCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average modify = {} microseconds, nb modifys = {}", average, nbModifyCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta modify = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta modify = {}", getName(), delta );
}
}
@@ -430,10 +417,10 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public void move( NextInterceptor next, MoveOperationContext moveContext ) throws LdapException
+ public void move( MoveOperationContext moveContext ) throws LdapException
{
long t0 = System.nanoTime();
- next.move( moveContext );
+ next( moveContext );
long delta = System.nanoTime() - t0;
if ( IS_DEBUG_STATS )
@@ -444,13 +431,13 @@ public class TimerInterceptor extends Ba
if ( nbMoveCalls.get() % 1000 == 0 )
{
long average = totalMove.get()/(nbMoveCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average move = {} microseconds, nb moves = {}", average, nbMoveCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average move = {} microseconds, nb moves = {}", average, nbMoveCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta move = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta move = {}", getName(), delta );
}
}
@@ -458,10 +445,10 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
long t0 = System.nanoTime();
- next.moveAndRename( moveAndRenameContext );
+ next( moveAndRenameContext );
long delta = System.nanoTime() - t0;
if ( IS_DEBUG_STATS )
@@ -472,13 +459,13 @@ public class TimerInterceptor extends Ba
if ( nbMoveAndRenameCalls.get() % 1000 == 0 )
{
long average = totalMoveAndRename.get()/(nbMoveAndRenameCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average moveAndRename = {} microseconds, nb moveAndRenames = {}", average, nbMoveAndRenameCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average moveAndRename = {} microseconds, nb moveAndRenames = {}", average, nbMoveAndRenameCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta moveAndRename = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta moveAndRename = {}", getName(), delta );
}
}
@@ -486,10 +473,10 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
+ public void rename( RenameOperationContext renameContext ) throws LdapException
{
long t0 = System.nanoTime();
- next.rename( renameContext );
+ next( renameContext );
long delta = System.nanoTime() - t0;
if ( IS_DEBUG_STATS )
@@ -500,13 +487,13 @@ public class TimerInterceptor extends Ba
if ( nbRenameCalls.get() % 1000 == 0 )
{
long average = totalRename.get()/(nbRenameCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average rename = {} microseconds, nb renames = {}", average, nbRenameCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average rename = {} microseconds, nb renames = {}", average, nbRenameCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta rename = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta rename = {}", getName(), delta );
}
}
@@ -514,10 +501,10 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext ) throws LdapException
+ public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
long t0 = System.nanoTime();
- EntryFilteringCursor cursor = next.search( searchContext );
+ EntryFilteringCursor cursor = next( searchContext );
long delta = System.nanoTime() - t0;
if ( IS_DEBUG_STATS )
@@ -528,13 +515,13 @@ public class TimerInterceptor extends Ba
if ( nbSearchCalls.get() % 1000 == 0 )
{
long average = totalSearch.get()/(nbSearchCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average search = {} microseconds, nb searches = {}", average, nbSearchCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average search = {} microseconds, nb searches = {}", average, nbSearchCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta search = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta search = {}", getName(), delta );
}
return cursor;
@@ -558,13 +545,13 @@ public class TimerInterceptor extends Ba
if ( nbUnbindCalls.get() % 1000 == 0 )
{
long average = totalUnbind.get()/(nbUnbindCalls.get() * 1000);
- OPERATION_STATS.debug( name + " : Average unbind = {} microseconds, nb unbinds = {}", average, nbUnbindCalls.get() );
+ OPERATION_STATS.debug( getName() + " : Average unbind = {} microseconds, nb unbinds = {}", average, nbUnbindCalls.get() );
}
}
if ( IS_DEBUG_TIME )
{
- OPERATION_TIME.debug( "{} : Delta unbind = {}", name, delta );
+ OPERATION_TIME.debug( "{} : Delta unbind = {}", getName(), delta );
}
}
}
Propchange: directory/apacheds/branches/apacheds-txns/interceptors/normalization/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -1 +1 @@
-/directory/apacheds/trunk/interceptors/normalization:1183435-1200383
+/directory/apacheds/trunk/interceptors/normalization:1183435-1201283
Modified: directory/apacheds/branches/apacheds-txns/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Sat Nov 12 18:24:38 2011
@@ -23,15 +23,15 @@ package org.apache.directory.server.core
import java.util.List;
import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.HasEntryOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -80,6 +80,15 @@ public class NormalizationInterceptor ex
private FilterNormalizingVisitor normVisitor;
/**
+ * Creates a new instance of a NormalizationInterceptor.
+ */
+ public NormalizationInterceptor()
+ {
+ super( InterceptorEnum.NORMALIZATION_INTERCEPTOR );
+ }
+
+
+ /**
* Initialize the registries, normalizers.
*/
public void init( DirectoryService directoryService ) throws LdapException
@@ -107,12 +116,55 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
- public void add( NextInterceptor nextInterceptor, AddOperationContext addContext ) throws LdapException
+ public void add( AddOperationContext addContext ) throws LdapException
{
addContext.getDn().apply( schemaManager );
addContext.getEntry().getDn().apply( schemaManager );
addRdnAttributesToEntry( addContext.getDn(), addContext.getEntry() );
- nextInterceptor.add( addContext );
+ next( addContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void bind( BindOperationContext bindContext ) throws LdapException
+ {
+ bindContext.getDn().apply( schemaManager );
+ next( bindContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
+ {
+ if ( !compareContext.getDn().isSchemaAware() )
+ {
+ compareContext.getDn().apply( schemaManager );
+ }
+
+ // Get the attributeType from the OID
+ try
+ {
+ AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( compareContext.getOid() );
+
+ // Translate the value from binary to String if the AT is HR
+ if ( attributeType.getSyntax().isHumanReadable() && ( !compareContext.getValue().isHumanReadable() ) )
+ {
+ String value = compareContext.getValue().getString();
+ compareContext.setValue( new StringValue( value ) );
+ }
+
+ compareContext.setAttributeType( attributeType );
+ }
+ catch ( LdapException le )
+ {
+ throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
+ }
+
+ return next( compareContext );
}
@@ -135,54 +187,71 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
- public void modify( NextInterceptor nextInterceptor, ModifyOperationContext modifyContext ) throws LdapException
+ public boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException
{
- if ( !modifyContext.getDn().isSchemaAware() )
- {
- modifyContext.getDn().apply( schemaManager );
- }
+ hasEntryContext.getDn().apply( schemaManager );
- if ( modifyContext.getModItems() != null )
- {
- for ( Modification modification : modifyContext.getModItems() )
- {
- AttributeType attributeType = schemaManager.getAttributeType( modification.getAttribute().getId() );
- modification.apply( attributeType );
- }
- }
+ return next( hasEntryContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
+ {
+ listContext.getDn().apply( schemaManager );
- nextInterceptor.modify( modifyContext );
+ return next( listContext );
}
/**
* {@inheritDoc}
*/
- public void rename( NextInterceptor nextInterceptor, RenameOperationContext renameContext ) throws LdapException
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
- // Normalize the new Rdn and the Dn if needed
+ lookupContext.getDn().apply( schemaManager );
- if ( !renameContext.getDn().isSchemaAware() )
+ List<String> attrIds = lookupContext.getAttrsId();
+
+ if ( ( attrIds != null ) && ( attrIds.size() > 0 ) )
{
- renameContext.getDn().apply( schemaManager );
+ // We have to normalize the requested IDs
+ lookupContext.setAttrsId( normalizeAttrsId( lookupContext.getAttrsIdArray() ) );
}
- renameContext.getNewRdn().apply( schemaManager );
+ return next( lookupContext );
+ }
- if ( !renameContext.getNewDn().isSchemaAware() )
+
+ /**
+ * {@inheritDoc}
+ */
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
+ {
+ if ( !modifyContext.getDn().isSchemaAware() )
{
- renameContext.getNewDn().apply( schemaManager );
+ modifyContext.getDn().apply( schemaManager );
}
- // Push to the next interceptor
- nextInterceptor.rename( renameContext );
+ if ( modifyContext.getModItems() != null )
+ {
+ for ( Modification modification : modifyContext.getModItems() )
+ {
+ AttributeType attributeType = schemaManager.getAttributeType( modification.getAttribute().getId() );
+ modification.apply( attributeType );
+ }
+ }
+
+ next( modifyContext );
}
/**
* {@inheritDoc}
*/
- public void move( NextInterceptor nextInterceptor, MoveOperationContext moveContext ) throws LdapException
+ public void move( MoveOperationContext moveContext ) throws LdapException
{
if ( !moveContext.getDn().isSchemaAware() )
{
@@ -209,16 +278,15 @@ public class NormalizationInterceptor ex
moveContext.getRdn().apply( schemaManager );
}
- nextInterceptor.move( moveContext );
+ next( moveContext );
}
/**
* {@inheritDoc}
*/
- public void moveAndRename( NextInterceptor nextInterceptor, MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
-
if ( !moveAndRenameContext.getNewRdn().isSchemaAware() )
{
moveAndRenameContext.getNewRdn().apply( schemaManager );
@@ -239,14 +307,38 @@ public class NormalizationInterceptor ex
moveAndRenameContext.getNewSuperiorDn().apply( schemaManager );
}
- nextInterceptor.moveAndRename( moveAndRenameContext );
+ next( moveAndRenameContext );
}
/**
* {@inheritDoc}
*/
- public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext ) throws LdapException
+ public void rename( RenameOperationContext renameContext ) throws LdapException
+ {
+ // Normalize the new Rdn and the Dn if needed
+
+ if ( !renameContext.getDn().isSchemaAware() )
+ {
+ renameContext.getDn().apply( schemaManager );
+ }
+
+ renameContext.getNewRdn().apply( schemaManager );
+
+ if ( !renameContext.getNewDn().isSchemaAware() )
+ {
+ renameContext.getNewDn().apply( schemaManager );
+ }
+
+ // Push to the next interceptor
+ next( renameContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
Dn dn = searchContext.getDn();
@@ -276,7 +368,7 @@ public class NormalizationInterceptor ex
searchContext.setFilter( filter );
// TODO Normalize the returned Attributes, storing the UP attributes to format the returned values.
- return nextInterceptor.search( searchContext );
+ return next( searchContext );
}
}
@@ -284,28 +376,6 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
- public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
- {
- hasEntryContext.getDn().apply( schemaManager );
-
- return next( hasEntryContext );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
- {
- listContext.getDn().apply( schemaManager );
-
- return next( listContext );
- }
-
-
- /**
- * {@inheritDoc}
- */
private String[] normalizeAttrsId( String[] attrIds ) throws LdapException
{
if ( attrIds == null )
@@ -326,72 +396,10 @@ public class NormalizationInterceptor ex
}
- /**
- * {@inheritDoc}
- */
- public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
- {
- lookupContext.getDn().apply( schemaManager );
-
- List<String> attrIds = lookupContext.getAttrsId();
-
- if ( ( attrIds != null ) && ( attrIds.size() > 0 ) )
- {
- // We have to normalize the requested IDs
- lookupContext.setAttrsId( normalizeAttrsId( lookupContext.getAttrsIdArray() ) );
- }
-
- return next( lookupContext );
- }
-
-
// ------------------------------------------------------------------------
// Normalize all Name based arguments for other interface operations
// ------------------------------------------------------------------------
/**
- * {@inheritDoc}
- */
- public boolean compare( CompareOperationContext compareContext ) throws LdapException
- {
- if ( !compareContext.getDn().isSchemaAware() )
- {
- compareContext.getDn().apply( schemaManager );
- }
-
- // Get the attributeType from the OID
- try
- {
- AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( compareContext.getOid() );
-
- // Translate the value from binary to String if the AT is HR
- if ( attributeType.getSyntax().isHumanReadable() && ( !compareContext.getValue().isHumanReadable() ) )
- {
- String value = compareContext.getValue().getString();
- compareContext.setValue( new StringValue( value ) );
- }
-
- compareContext.setAttributeType( attributeType );
- }
- catch ( LdapException le )
- {
- throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
- }
-
- return next( compareContext );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void bind( BindOperationContext bindContext ) throws LdapException
- {
- bindContext.getDn().apply( schemaManager );
- next( bindContext );
- }
-
-
- /**
* Adds missing Rdn's attributes and values to the entry.
*
* @param dn the Dn
Propchange: directory/apacheds/branches/apacheds-txns/interceptors/operational/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -1 +1 @@
-/directory/apacheds/trunk/interceptors/operational:1183435-1200383
+/directory/apacheds/trunk/interceptors/operational:1183435-1201283
Modified: directory/apacheds/branches/apacheds-txns/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1201297&r1=1201296&r2=1201297&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-txns/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Sat Nov 12 18:24:38 2011
@@ -29,12 +29,12 @@ import java.util.UUID;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.filtering.EntryFilter;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
@@ -80,6 +80,16 @@ public class OperationalAttributeInterce
/** The LoggerFactory used by this Interceptor */
private static Logger LOG = LoggerFactory.getLogger( OperationalAttributeInterceptor.class );
+ private final EntryFilter DENORMALIZING_SEARCH_FILTER = new OperationalAttributeDenormalizingSearchFilter();
+
+ private final EntryFilter SEARCH_FILTER = new OperationalAttributeSearchFilter();
+
+ /** The subschemasubentry Dn */
+ private Dn subschemaSubentryDn;
+
+ /** The admin Dn */
+ private Dn adminDn;
+
/**
* the search result filter to use for collective attribute injection
*/
@@ -95,8 +105,7 @@ public class OperationalAttributeInterce
return filterDenormalized( entry );
}
}
-
- private final EntryFilter DENORMALIZING_SEARCH_FILTER = new OperationalAttributeDenormalizingSearchFilter();
+
/**
* the database search result filter to register with filter service
@@ -109,20 +118,14 @@ public class OperationalAttributeInterce
|| filterOperationalAttributes( entry );
}
}
-
- private final EntryFilter SEARCH_FILTER = new OperationalAttributeSearchFilter();
-
- /** The subschemasubentry Dn */
- private Dn subschemaSubentryDn;
-
- /** The admin Dn */
- private Dn adminDn;
-
+
+
/**
* Creates the operational attribute management service interceptor.
*/
public OperationalAttributeInterceptor()
{
+ super( InterceptorEnum.OPERATIONAL_ATTRIBUTE_INTERCEPTOR );
}
@@ -131,7 +134,7 @@ public class OperationalAttributeInterce
super.init( directoryService );
// stuff for dealing with subentries (garbage for now)
- Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDSE( null ).get(
+ Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDse( null ).get(
SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
@@ -180,7 +183,10 @@ public class OperationalAttributeInterce
* - entryCSN
* - entryUUID
*/
- public void add( NextInterceptor nextInterceptor, AddOperationContext addContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void add( AddOperationContext addContext ) throws LdapException
{
String principal = getPrincipal( addContext ).getName();
@@ -228,14 +234,48 @@ public class OperationalAttributeInterce
// The SubSchemaSybentry attribute
checkAddOperationalAttribute( isAdmin, entry, SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
- nextInterceptor.add( addContext );
+ next( addContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
+ {
+ EntryFilteringCursor cursor = next( listContext );
+ cursor.addEntryFilter( SEARCH_FILTER );
+
+ return cursor;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
+ {
+ Entry result = next( lookupContext );
+
+ if ( lookupContext.getAttrsId() == null )
+ {
+ filterOperationalAttributes( result );
+ }
+ else if ( !lookupContext.hasAllOperational() )
+ {
+ filter( lookupContext, result );
+ }
+
+ denormalizeEntryOpAttrs( result );
+
+ return result;
}
/**
* {@inheritDoc}
*/
- public void modify( NextInterceptor nextInterceptor, ModifyOperationContext modifyContext ) throws LdapException
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
// We must check that the user hasn't injected either the modifiersName
// or the modifyTimestamp operational attributes : they are not supposed to be
@@ -340,30 +380,14 @@ public class OperationalAttributeInterce
}
// Go down in the chain
- nextInterceptor.modify( modifyContext );
- }
-
-
- public void rename( NextInterceptor nextInterceptor, RenameOperationContext renameContext ) throws LdapException
- {
- Entry entry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getClonedEntry();
- entry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
- entry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
-
- Entry modifiedEntry = renameContext.getOriginalEntry().clone();
- modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
- modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
- //modifiedEntry.setDn( renameContext.getNewDn() );
- renameContext.setModifiedEntry( modifiedEntry );
-
- nextInterceptor.rename( renameContext );
+ next( modifyContext );
}
/**
* {@inheritDoc}
*/
- public void move( NextInterceptor nextInterceptor, MoveOperationContext moveContext ) throws LdapException
+ public void move( MoveOperationContext moveContext ) throws LdapException
{
Entry modifiedEntry = moveContext.getOriginalEntry().clone();
modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( moveContext ).getName() );
@@ -371,11 +395,14 @@ public class OperationalAttributeInterce
modifiedEntry.setDn( moveContext.getNewDn() );
moveContext.setModifiedEntry( modifiedEntry );
- nextInterceptor.move( moveContext );
+ next( moveContext );
}
- public void moveAndRename( NextInterceptor nextInterceptor, MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
Entry modifiedEntry = moveAndRenameContext.getOriginalEntry().clone();
modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( moveAndRenameContext ).getName() );
@@ -383,41 +410,35 @@ public class OperationalAttributeInterce
modifiedEntry.setDn( moveAndRenameContext.getNewDn() );
moveAndRenameContext.setModifiedEntry( modifiedEntry );
- nextInterceptor.moveAndRename( moveAndRenameContext );
+ next( moveAndRenameContext );
}
- public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void rename( RenameOperationContext renameContext ) throws LdapException
{
- Entry result = next( lookupContext );
-
- if ( lookupContext.getAttrsId() == null )
- {
- filterOperationalAttributes( result );
- }
- else if ( !lookupContext.hasAllOperational() )
- {
- filter( lookupContext, result );
- }
-
- denormalizeEntryOpAttrs( result );
-
- return result;
- }
-
+ Entry entry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getClonedEntry();
+ entry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
+ entry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
- public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
- {
- EntryFilteringCursor cursor = next( listContext );
- cursor.addEntryFilter( SEARCH_FILTER );
+ Entry modifiedEntry = renameContext.getOriginalEntry().clone();
+ modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
+ modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
+ //modifiedEntry.setDn( renameContext.getNewDn() );
+ renameContext.setModifiedEntry( modifiedEntry );
- return cursor;
+ next( renameContext );
}
- public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
- EntryFilteringCursor cursor = nextInterceptor.search( searchContext );
+ EntryFilteringCursor cursor = next( searchContext );
if ( searchContext.isAllOperationalAttributes()
|| ( searchContext.getReturningAttributes() != null && !searchContext.getReturningAttributes().isEmpty() ) )
@@ -431,6 +452,7 @@ public class OperationalAttributeInterce
}
cursor.addEntryFilter( SEARCH_FILTER );
+
return cursor;
}
Propchange: directory/apacheds/branches/apacheds-txns/interceptors/referral/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 12 18:24:38 2011
@@ -1 +1 @@
-/directory/apacheds/trunk/interceptors/referral:1183435-1200383
+/directory/apacheds/trunk/interceptors/referral:1183435-1201283