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/10 00:03:58 UTC
svn commit: r1200023 - in /directory/apacheds/trunk:
core-api/src/main/java/org/apache/directory/server/core/api/interceptor/
core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/
core-api/src/test/java/org/apache/directory/s...
Author: elecharny
Date: Wed Nov 9 23:03:58 2011
New Revision: 1200023
URL: http://svn.apache.org/viewvc?rev=1200023&view=rev
Log:
Moved the Compare operation out of the InterceptorChain
Modified:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/InterceptorChain.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/NextInterceptor.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/CompareOperationContext.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
directory/apacheds/trunk/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java
directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java Wed Nov 9 23:03:58 2011
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.core.api.interceptor;
@@ -58,9 +58,9 @@ import org.apache.directory.shared.ldap.
*/
public abstract class BaseInterceptor implements Interceptor
{
- /** The interceptor's name. Default to the class name */
- private String name;
-
+ /** The interceptor's name. Default to the class name */
+ private String name;
+
/** A reference to the DirectoryService instance */
protected DirectoryService directoryService;
@@ -163,7 +163,7 @@ public abstract class BaseInterceptor im
/**
* {@inheritDoc}
*/
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
return nexus.compare( compareContext );
}
@@ -210,9 +210,9 @@ public abstract class BaseInterceptor im
*/
public Entry lookup( NextInterceptor next, LookupOperationContext lookupContext )
throws LdapException
- {
+ {
return nexus.lookup( lookupContext );
- }
+ }
/**
@@ -238,9 +238,9 @@ public abstract class BaseInterceptor im
*/
public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext )
throws LdapException
- {
+ {
nexus.moveAndRename( moveAndRenameContext );
- }
+ }
/**
@@ -257,9 +257,9 @@ public abstract class BaseInterceptor im
*/
public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext )
throws LdapException
- {
+ {
return nexus.search( searchContext );
- }
+ }
/**
@@ -300,7 +300,7 @@ public abstract class BaseInterceptor im
*/
protected BaseInterceptor()
{
- name = getClass().getSimpleName();
+ name = getClass().getSimpleName();
}
@@ -309,13 +309,13 @@ public abstract class BaseInterceptor im
*/
protected BaseInterceptor( String name )
{
- this.name = name;
+ this.name = name;
}
/**
* This method does nothing by default.
- * @throws Exception
+ * @throws Exception
*/
public void init( DirectoryService directoryService ) throws LdapException
{
@@ -340,7 +340,7 @@ public abstract class BaseInterceptor im
TRIGGER_EXECUTION_SUBENTRIES_AT = schemaManager
.getAttributeType( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
UNIQUE_MEMBER_AT = schemaManager.getAttributeType( SchemaConstants.UNIQUE_MEMBER_AT_OID );
-
+
FINAL_INTERCEPTOR.init( directoryService );
}
@@ -354,7 +354,7 @@ public abstract class BaseInterceptor im
/**
- * Computes the next interceptor to call for a given operation. If we find none,
+ * Computes the next interceptor to call for a given operation. If we find none,
* we return the proxy to the nexus.
*
* @param operationContext The operation context
@@ -362,18 +362,18 @@ public abstract class BaseInterceptor im
*/
private Interceptor getNextInterceptor( OperationContext operationContext )
{
- String currentInterceptor = operationContext.getNextInterceptor();
-
- if ( currentInterceptor.equals( "FINAL" ) )
- {
- return FINAL_INTERCEPTOR;
- }
-
- Interceptor interceptor = directoryService.getInterceptor( currentInterceptor );
-
- return interceptor;
+ String currentInterceptor = operationContext.getNextInterceptor();
+
+ if ( currentInterceptor.equals( "FINAL" ) )
+ {
+ return FINAL_INTERCEPTOR;
+ }
+
+ Interceptor interceptor = directoryService.getInterceptor( currentInterceptor );
+
+ return interceptor;
}
-
+
// ------------------------------------------------------------------------
// Interceptor's Invoke Method
@@ -390,11 +390,56 @@ public abstract class BaseInterceptor im
/**
* {@inheritDoc}
*/
+ public void bind( BindOperationContext bindContext ) throws LdapException
+ {
+ // Do nothing
+ }
+
+
+ /**
+ * Calls the next interceptor for the bind operation.
+ *
+ * @param bindContext The context in which we are executing this operation
+ * @throws LdapException If something went wrong
+ */
+ protected final void next( BindOperationContext bindContext ) throws LdapException
+ {
+ Interceptor interceptor = getNextInterceptor( bindContext );
+
+ interceptor.bind( bindContext );
+ }
+
+
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
+ {
+ // Return false in any case
+ return false;
+ }
+
+
+ /**
+ * Calls the next interceptor for the compare operation.
+ *
+ * @param compareContext The context in which we are executing this operation
+ * @return a boolean indicating if the comparison is successfull
+ * @throws LdapException If something went wrong
+ */
+ protected final boolean next( CompareOperationContext compareContext ) throws LdapException
+ {
+ Interceptor interceptor = getNextInterceptor( compareContext );
+
+ return interceptor.compare( compareContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
- // Do nothing
+ // Do nothing
}
-
+
/**
* Calls the next interceptor for the delete operation.
@@ -404,43 +449,44 @@ public abstract class BaseInterceptor im
*/
protected final void next( DeleteOperationContext deleteContext ) throws LdapException
{
- Interceptor interceptor = getNextInterceptor( deleteContext );
-
- interceptor.delete( deleteContext );
+ Interceptor interceptor = getNextInterceptor( deleteContext );
+
+ interceptor.delete( deleteContext );
}
-
+
/**
* {@inheritDoc}
*/
public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext ) throws LdapException
{
- // Nothing to do
+ // Nothing to do
return null;
}
-
-
+
+
/**
* Calls the next interceptor for the getRootDse operation.
*
* @param getRootDseContext The context in which we are executing this operation
+ * @return the rootDSE
* @throws LdapException If something went wrong
*/
protected final Entry next( GetRootDSEOperationContext getRootDseContext ) throws LdapException
{
- Interceptor interceptor = getNextInterceptor( getRootDseContext );
+ Interceptor interceptor = getNextInterceptor( getRootDseContext );
return interceptor.getRootDSE( getRootDseContext );
}
-
+
/**
* {@inheritDoc}
*/
public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
{
- // Return false in any case
- return false;
+ // Return false in any case
+ return false;
}
@@ -453,12 +499,12 @@ public abstract class BaseInterceptor im
*/
protected final boolean next( EntryOperationContext hasEntryContext ) throws LdapException
{
- Interceptor interceptor = getNextInterceptor( hasEntryContext );
+ Interceptor interceptor = getNextInterceptor( hasEntryContext );
return interceptor.hasEntry( hasEntryContext );
}
-
+
public EntryFilteringCursor list( NextInterceptor next, ListOperationContext listContext ) throws LdapException
{
return next.list( listContext );
@@ -477,19 +523,6 @@ public abstract class BaseInterceptor im
}
- public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext )
- throws LdapException
- {
- next.moveAndRename( moveAndRenameContext );
- }
-
-
- public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
- {
- next.rename( renameContext );
- }
-
-
/**
* {@inheritDoc}
*/
@@ -499,40 +532,24 @@ public abstract class BaseInterceptor im
}
- public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext )
+ public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext )
throws LdapException
- {
- return next.search( searchContext );
- }
+ {
+ next.moveAndRename( moveAndRenameContext );
+ }
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+ public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
{
- return next.compare( compareContext );
+ next.rename( renameContext );
}
- /**
- * {@inheritDoc}
- */
- public void bind( BindOperationContext bindContext ) throws LdapException
- {
- // Do nothing
- }
-
-
- /**
- * Calls the next interceptor for the bind operation.
- *
- * @param bindContext The context in which we are executing this operation
- * @throws LdapException If something went wrong
- */
- protected final void next( BindOperationContext bindContext ) throws LdapException
- {
- Interceptor interceptor = getNextInterceptor( bindContext );
-
- interceptor.bind( bindContext );
- }
+ public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext )
+ throws LdapException
+ {
+ return next.search( searchContext );
+ }
/**
@@ -542,8 +559,8 @@ public abstract class BaseInterceptor im
{
// Nothing to do
}
-
-
+
+
/**
* Compute the next interceptor for the unbind operation.
*
@@ -552,7 +569,7 @@ public abstract class BaseInterceptor im
*/
protected final void next( UnbindOperationContext unbindContext ) throws LdapException
{
- Interceptor interceptor = getNextInterceptor( unbindContext );
+ Interceptor interceptor = getNextInterceptor( unbindContext );
interceptor.unbind( unbindContext );
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java Wed Nov 9 23:03:58 2011
@@ -145,7 +145,7 @@ public interface Interceptor
/**
* Filters {@link DefaultPartitionNexus#compare( CompareOperationContext )} call.
*/
- boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException;
+ boolean compare( CompareOperationContext compareContext ) throws LdapException;
/**
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/InterceptorChain.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/InterceptorChain.java Wed Nov 9 23:03:58 2011
@@ -103,9 +103,9 @@ public class InterceptorChain
}
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
- return nexus.compare( compareContext );
+ return false;
}
@@ -504,29 +504,6 @@ public class InterceptorChain
}
- public boolean compare( CompareOperationContext compareContext ) throws LdapException
- {
- Element entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
- compareContext.setOriginalEntry( getOriginalEntry( compareContext ) );
-
- try
- {
- return head.compare( next, compareContext );
- }
- catch ( LdapException le )
- {
- throw le;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
/**
* Eagerly populates fields of operation contexts so multiple Interceptors
* in the processing pathway can reuse this value without performing a
@@ -860,31 +837,6 @@ public class InterceptorChain
}
- public boolean compare( CompareOperationContext compareContext ) throws LdapException
- {
- Element next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- //System.out.println( ">>> Entering into " + interceptor.getClass().getSimpleName() + ", compareRequest" );
- boolean result = interceptor.compare( next.nextInterceptor, compareContext );
- //System.out.println( "<<< Exiting from " + interceptor.getClass().getSimpleName() + ", compareRequest" );
-
- return result;
- }
- catch ( LdapException le )
- {
- throw le;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
public void add( AddOperationContext addContext ) throws LdapException
{
Element next = getNextEntry();
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/NextInterceptor.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/NextInterceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/NextInterceptor.java Wed Nov 9 23:03:58 2011
@@ -22,8 +22,6 @@ package org.apache.directory.server.core
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
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;
@@ -49,11 +47,6 @@ public interface NextInterceptor
*/
void add( AddOperationContext addContext ) throws LdapException;
- /**
- * Calls the next interceptor's {@link Interceptor#compare( NextInterceptor, CompareOperationContext )}.
- */
- boolean compare( CompareOperationContext compareContext ) throws LdapException;
-
/**
* Calls the next interceptor's {@link Interceptor#list( NextInterceptor, ListOperationContext )}.
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/CompareOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/CompareOperationContext.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/CompareOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/CompareOperationContext.java Wed Nov 9 23:03:58 2011
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.OperationEnum;
import org.apache.directory.shared.ldap.model.entry.BinaryValue;
import org.apache.directory.shared.ldap.model.entry.Value;
import org.apache.directory.shared.ldap.model.message.CompareRequest;
@@ -57,6 +58,7 @@ public class CompareOperationContext ext
public CompareOperationContext( CoreSession session )
{
super( session );
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.COMPARE ) );
}
@@ -68,6 +70,7 @@ public class CompareOperationContext ext
public CompareOperationContext( CoreSession session, Dn dn )
{
super( session, dn );
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.COMPARE ) );
}
@@ -80,6 +83,7 @@ public class CompareOperationContext ext
{
super( session );
this.oid = oid;
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.COMPARE ) );
}
@@ -92,6 +96,7 @@ public class CompareOperationContext ext
{
super( session, dn );
this.oid = oid;
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.COMPARE ) );
}
@@ -105,6 +110,7 @@ public class CompareOperationContext ext
super( session, dn );
this.oid = oid;
this.value = value;
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.COMPARE ) );
}
@@ -114,6 +120,7 @@ public class CompareOperationContext ext
this.oid = compareRequest.getAttributeId();
this.value = compareRequest.getAssertionValue();
this.requestControls = compareRequest.getControls();
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.COMPARE ) );
if ( requestControls.containsKey( ManageDsaIT.OID ) )
{
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java Wed Nov 9 23:03:58 2011
@@ -102,10 +102,10 @@ public class MockInterceptor extends Bas
/**
* {@inheritDoc}
*/
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
interceptors.add( this );
- return next.compare( compareContext );
+ return next( compareContext );
}
@@ -124,10 +124,10 @@ public class MockInterceptor extends Bas
*/
public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext )
throws LdapException
- {
+ {
interceptors.add( this );
return next( getRootDseContext );
- }
+ }
/**
@@ -213,7 +213,7 @@ public class MockInterceptor extends Bas
/**
* {@inheritDoc}
*/
- public void unbind( UnbindOperationContext unbindContext ) throws LdapException
+ public void unbind( UnbindOperationContext unbindContext ) throws LdapException
{
interceptors.add( this );
next( unbindContext );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java Wed Nov 9 23:03:58 2011
@@ -108,7 +108,7 @@ public class DefaultOperationManager imp
// We have to use the admin session here, otherwise we may have
// trouble reading the entry due to insufficient access rights
CoreSession adminSession = opContext.getSession().getDirectoryService().getAdminSession();
-
+
LookupOperationContext lookupContext = new LookupOperationContext( adminSession, opContext.getDn(), SchemaConstants.ALL_ATTRIBUTES_ARRAY );
Entry foundEntry = opContext.getSession().getDirectoryService().getPartitionNexus().lookup( lookupContext );
@@ -128,8 +128,30 @@ public class DefaultOperationManager imp
}
- private LdapReferralException buildReferralException( Entry parentEntry, Dn childDn )
- throws LdapException //, LdapURLEncodingException
+ private Entry getOriginalEntry( OperationContext opContext ) throws LdapException
+ {
+ // We have to use the admin session here, otherwise we may have
+ // trouble reading the entry due to insufficient access rights
+ CoreSession adminSession = opContext.getSession().getDirectoryService().getAdminSession();
+
+ Entry foundEntry = adminSession.lookup( opContext.getDn(), SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES );
+
+ if ( foundEntry != null )
+ {
+ return foundEntry;
+ }
+ else
+ {
+ // This is an error : we *must* have an entry if we want to be able to rename.
+ LdapNoSuchObjectException ldnfe = new LdapNoSuchObjectException( I18n.err( I18n.ERR_256_NO_SUCH_OBJECT,
+ opContext.getDn() ) );
+
+ throw ldnfe;
+ }
+ }
+
+
+ private LdapReferralException buildReferralException( Entry parentEntry, Dn childDn ) throws LdapException
{
// Get the Ref attributeType
Attribute refs = parentEntry.get( SchemaConstants.REF_AT );
@@ -143,14 +165,14 @@ public class DefaultOperationManager imp
{
// we have to replace the parent by the referral
LdapUrl ldapUrl = new LdapUrl( url.getString() );
-
+
// We have a problem with the Dn : we can't use the UpName,
// as we may have some spaces around the ',' and '+'.
// So we have to take the Rdn one by one, and create a
// new Dn with the type and value UP form
-
+
Dn urlDn = ldapUrl.getDn().add( childDn );
-
+
ldapUrl.setDn( urlDn );
urls.add( ldapUrl.toString() );
}
@@ -170,8 +192,7 @@ public class DefaultOperationManager imp
}
- private LdapReferralException buildReferralExceptionForSearch( Entry parentEntry, Dn childDn, SearchScope scope )
- throws LdapException
+ private LdapReferralException buildReferralExceptionForSearch( Entry parentEntry, Dn childDn, SearchScope scope ) throws LdapException
{
// Get the Ref attributeType
Attribute refs = parentEntry.get( SchemaConstants.REF_AT );
@@ -406,9 +427,13 @@ public class DefaultOperationManager imp
// Unlock the ReferralManager
directoryService.getReferralManager().unlock();
- // Call the Add method
- InterceptorChain interceptorChain = directoryService.getInterceptorChain();
- return interceptorChain.compare( compareContext );
+ // populate the context with the old entry
+ compareContext.setOriginalEntry( getOriginalEntry( compareContext ) );
+
+ // Call the Compare method
+ Interceptor head = directoryService.getInterceptor( compareContext.getNextInterceptor() );
+
+ return head.compare( compareContext );
}
finally
{
Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Wed Nov 9 23:03:58 2011
@@ -115,7 +115,7 @@ public class AuthenticationInterceptor e
/** A Set of all the existing Authenticator to be used by the bind operation */
private Set<Authenticator> authenticators = new HashSet<Authenticator>();
-
+
/** A map of authenticators associated with the authentication level required */
private final Map<AuthenticationLevel, Collection<Authenticator>> authenticatorsMapByType = new HashMap<AuthenticationLevel, Collection<Authenticator>>();
@@ -167,7 +167,7 @@ public class AuthenticationInterceptor e
{
setDefaultAuthenticators();
}
-
+
// Register all authenticators
for ( Authenticator authenticator : authenticators )
{
@@ -187,7 +187,7 @@ public class AuthenticationInterceptor e
{
authenticators = new HashSet<Authenticator>();
}
-
+
authenticators.clear();
authenticators.add( new AnonymousAuthenticator() );
authenticators.add( new SimpleAuthenticator() );
@@ -226,16 +226,16 @@ public class AuthenticationInterceptor e
{
throw new IllegalArgumentException( "The given authenticators set is null" );
}
-
+
this.authenticators.clear();
- for (Authenticator authenticator : authenticators)
+ for (Authenticator authenticator : authenticators)
{
this.authenticators.add( authenticator );
}
}
-
-
+
+
/**
* Deinitializes and deregisters all {@link Authenticator}s from this service.
*/
@@ -306,14 +306,14 @@ public class AuthenticationInterceptor e
checkAuthenticated( addContext );
Entry entry = addContext.getEntry();
-
-
+
+
if ( !directoryService.isPwdPolicyEnabled() )
{
next.add( addContext );
return;
}
-
+
PasswordPolicyConfiguration policyConfig = getPwdPolicy( entry );
boolean isPPolicyReqCtrlPresent = addContext.hasRequestControl( PasswordPolicy.OID );
@@ -335,7 +335,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyDecorator responseControl =
+ PasswordPolicyDecorator responseControl =
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true );
responseControl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.get( e.getErrorCode() ) );
addContext.addResponseControl( responseControl );
@@ -346,7 +346,7 @@ public class AuthenticationInterceptor e
}
String pwdChangedTime = DateUtils.getGeneralizedTime();
-
+
if ( ( policyConfig.getPwdMinAge() > 0 ) || ( policyConfig.getPwdMaxAge() > 0 ) )
{
Attribute pwdChangedTimeAt = new DefaultAttribute( AT_PWD_CHANGED_TIME );
@@ -400,7 +400,7 @@ public class AuthenticationInterceptor e
checkAuthenticated( getRootDseContext );
checkPwdReset( getRootDseContext );
-
+
return next( getRootDseContext );
}
@@ -417,7 +417,7 @@ public class AuthenticationInterceptor e
checkAuthenticated( hasEntryContext );
checkPwdReset( hasEntryContext );
-
+
return next( hasEntryContext );
}
@@ -431,7 +431,7 @@ public class AuthenticationInterceptor e
checkAuthenticated( listContext );
checkPwdReset( listContext );
-
+
return next.list( listContext );
}
@@ -445,7 +445,7 @@ public class AuthenticationInterceptor e
checkAuthenticated( lookupContext );
checkPwdReset( lookupContext );
-
+
return next.lookup( lookupContext );
}
@@ -474,7 +474,7 @@ public class AuthenticationInterceptor e
checkAuthenticated( modifyContext );
-
+
if ( ! directoryService.isPwdPolicyEnabled() )
{
next.modify( modifyContext );
@@ -484,12 +484,12 @@ public class AuthenticationInterceptor e
// handle the case where pwdPolicySubentry AT is about to be deleted in thid modify()
PasswordPolicyConfiguration policyConfig = getPwdPolicy( modifyContext.getEntry() );
-
+
boolean isPPolicyReqCtrlPresent = modifyContext.hasRequestControl( PasswordPolicy.OID );
Dn userDn = modifyContext.getSession().getAuthenticatedPrincipal().getDn();
PwdModDetailsHolder pwdModDetails = null;
-
+
pwdModDetails = getPwdModDetails( modifyContext, policyConfig );
if ( pwdModDetails.isPwdModPresent() )
@@ -500,7 +500,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyDecorator responseControl =
+ PasswordPolicyDecorator responseControl =
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true );
responseControl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.CHANGE_AFTER_RESET );
modifyContext.addResponseControl( responseControl );
@@ -515,10 +515,10 @@ public class AuthenticationInterceptor e
if ( pwdModDetails.isAddOrReplace() && !pwdModDetails.isDelete() )
{
LOG.debug( "trying to update password attribute without the supplying the old password" );
-
+
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyDecorator responseControl =
+ PasswordPolicyDecorator responseControl =
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true );
responseControl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.MUST_SUPPLY_OLD_PASSWORD );
modifyContext.addResponseControl( responseControl );
@@ -532,7 +532,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyDecorator responseControl =
+ PasswordPolicyDecorator responseControl =
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true );
responseControl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.PASSWORD_MOD_NOT_ALLOWED );
modifyContext.addResponseControl( responseControl );
@@ -547,7 +547,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyDecorator responseControl =
+ PasswordPolicyDecorator responseControl =
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true );
responseControl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.PASSWORD_TOO_YOUNG );
modifyContext.addResponseControl( responseControl );
@@ -558,11 +558,11 @@ public class AuthenticationInterceptor e
}
byte[] newPassword = null;
-
+
if ( ( pwdModDetails != null ) )
{
newPassword = pwdModDetails.getNewPwd();
-
+
try
{
String userName = entry.getDn().getRdn().getUpValue().getString();
@@ -572,7 +572,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyDecorator responseControl =
+ PasswordPolicyDecorator responseControl =
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true );
responseControl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.get( e.getErrorCode() ) );
modifyContext.addResponseControl( responseControl );
@@ -591,12 +591,12 @@ public class AuthenticationInterceptor e
if ( histSize > 0 )
{
Attribute pwdHistoryAt = entry.get( PWD_HISTORY_AT );
-
+
if ( pwdHistoryAt == null )
{
pwdHistoryAt = new DefaultAttribute( AT_PWD_HISTORY );
}
-
+
List<PasswordHistory> pwdHistLst = new ArrayList<PasswordHistory>();
for ( Value<?> value : pwdHistoryAt )
@@ -609,7 +609,7 @@ public class AuthenticationInterceptor e
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyDecorator responseControl =
+ PasswordPolicyDecorator responseControl =
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true );
responseControl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.PASSWORD_IN_HISTORY );
modifyContext.addResponseControl( responseControl );
@@ -626,14 +626,14 @@ public class AuthenticationInterceptor e
{
// see the javadoc of PasswordHistory
Collections.sort( pwdHistLst );
-
+
// remove the oldest value
PasswordHistory remPwdHist = ( PasswordHistory ) pwdHistLst.toArray()[histSize - 1];
Attribute tempAt = new DefaultAttribute( AT_PWD_HISTORY );
tempAt.add( remPwdHist.getHistoryValue() );
pwdRemHistMod = new DefaultModification( REMOVE_ATTRIBUTE, tempAt );
}
-
+
pwdHistoryAt.clear();
PasswordHistory newPwdHist = new PasswordHistory( pwdChangedTime, newPassword );
pwdHistoryAt.clear();
@@ -642,11 +642,11 @@ public class AuthenticationInterceptor e
}
next.modify( modifyContext );
-
+
invalidateAuthenticatorCaches( modifyContext.getDn() );
List<Modification> mods = new ArrayList<Modification>();
-
+
if ( ( policyConfig.getPwdMinAge() > 0 ) || ( policyConfig.getPwdMaxAge() > 0 ) )
{
Attribute pwdChangedTimeAt = new DefaultAttribute( AT_PWD_CHANGED_TIME );
@@ -666,7 +666,7 @@ public class AuthenticationInterceptor e
}
boolean removeFromPwdResetSet = false;
-
+
if ( policyConfig.isPwdMustChange() )
{
Attribute pwdMustChangeAt = new DefaultAttribute( AT_PWD_RESET );
@@ -687,14 +687,14 @@ public class AuthenticationInterceptor e
}
Attribute pwdFailureTimeAt = entry.get( PWD_FAILURE_TIME_AT );
-
+
if ( pwdFailureTimeAt != null )
{
mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdFailureTimeAt ) );
}
Attribute pwdGraceUseTimeAt = entry.get( PWD_GRACE_USE_TIME_AT );
-
+
if ( pwdGraceUseTimeAt != null )
{
mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdGraceUseTimeAt ) );
@@ -732,7 +732,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
if ( IS_DEBUG )
{
@@ -741,7 +741,7 @@ public class AuthenticationInterceptor e
checkAuthenticated( compareContext );
checkPwdReset( compareContext );
- boolean result = next.compare( compareContext );
+ boolean result = next( compareContext );
invalidateAuthenticatorCaches( compareContext.getDn() );
return result;
@@ -750,7 +750,7 @@ public class AuthenticationInterceptor e
public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext )
throws LdapException
- {
+ {
if ( IS_DEBUG )
{
LOG.debug( "Operation Context: {}", moveAndRenameContext );
@@ -760,7 +760,7 @@ public class AuthenticationInterceptor e
checkPwdReset( moveAndRenameContext );
next.moveAndRename( moveAndRenameContext );
invalidateAuthenticatorCaches( moveAndRenameContext.getDn() );
- }
+ }
/**
@@ -782,7 +782,7 @@ public class AuthenticationInterceptor e
public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext )
throws LdapException
- {
+ {
if ( IS_DEBUG )
{
LOG.debug( "Operation Context: {}", searchContext );
@@ -790,9 +790,9 @@ public class AuthenticationInterceptor e
checkAuthenticated( searchContext );
checkPwdReset( searchContext );
-
+
return next.search( searchContext );
- }
+ }
/**
@@ -861,7 +861,7 @@ public class AuthenticationInterceptor e
}
boolean isPPolicyReqCtrlPresent = bindContext.hasRequestControl( PasswordPolicy.OID );
- PasswordPolicyDecorator pwdRespCtrl =
+ PasswordPolicyDecorator pwdRespCtrl =
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true );
boolean authenticated = false;
@@ -875,7 +875,7 @@ public class AuthenticationInterceptor e
{
// perform the authentication
LdapPrincipal principal = authenticator.authenticate( bindContext );
-
+
LdapPrincipal clonedPrincipal = ( LdapPrincipal ) ( principal.clone() );
// remove creds so there is no security risk
@@ -887,7 +887,7 @@ public class AuthenticationInterceptor e
bindContext.setSession( session );
authenticated = true;
-
+
// break out of the loop if the authentication succeeded
break;
}
@@ -927,12 +927,12 @@ public class AuthenticationInterceptor e
Dn dn = bindContext.getDn();
Entry userEntry = bindContext.getEntry();
-
+
PasswordPolicyConfiguration policyConfig = getPwdPolicy( userEntry );
-
+
// check if the user entry is null, it will be null
// in cases of anonymous bind
- if ( authenticated && ( userEntry == null ) && directoryService.isAllowAnonymousAccess() )
+ if ( authenticated && ( userEntry == null ) && directoryService.isAllowAnonymousAccess() )
{
return;
}
@@ -947,7 +947,7 @@ public class AuthenticationInterceptor e
if ( ( policyConfig != null ) && ( userEntry != null ) )
{
Attribute pwdFailTimeAt = userEntry.get( PWD_FAILURE_TIME_AT );
-
+
if ( pwdFailTimeAt == null )
{
pwdFailTimeAt = new DefaultAttribute( AT_PWD_FAILURE_TIME );
@@ -979,7 +979,7 @@ public class AuthenticationInterceptor e
{
pwdAccountLockedTimeAt.add( failureTime );
}
-
+
Modification pwdAccountLockedMod = new DefaultModification( ADD_ATTRIBUTE, pwdAccountLockedTimeAt );
mods.add( pwdAccountLockedMod );
@@ -1029,7 +1029,7 @@ public class AuthenticationInterceptor e
}
Attribute pwdFailTimeAt = userEntry.get( AT_PWD_FAILURE_TIME );
-
+
if ( pwdFailTimeAt != null )
{
Modification pwdFailTimeMod = new DefaultModification( REMOVE_ATTRIBUTE, pwdFailTimeAt );
@@ -1037,7 +1037,7 @@ public class AuthenticationInterceptor e
}
Attribute pwdAccLockedTimeAt = userEntry.get( AT_PWD_ACCOUNT_LOCKED_TIME );
-
+
if ( pwdAccLockedTimeAt != null )
{
Modification pwdAccLockedTimeMod = new DefaultModification( REMOVE_ATTRIBUTE, pwdAccLockedTimeAt );
@@ -1048,17 +1048,17 @@ public class AuthenticationInterceptor e
if ( ( policyConfig.getPwdMaxAge() > 0 ) && ( policyConfig.getPwdGraceAuthNLimit() > 0 ) )
{
Attribute pwdChangeTimeAttr = userEntry.get( PWD_CHANGED_TIME_AT );
-
+
if ( pwdChangeTimeAttr != null )
{
boolean expired = PasswordUtil.isPwdExpired( pwdChangeTimeAttr.getString(),
policyConfig.getPwdMaxAge() );
-
+
if ( expired )
{
Attribute pwdGraceUseAttr = userEntry.get( PWD_GRACE_USE_TIME_AT );
int numGraceAuth = 0;
-
+
if ( pwdGraceUseAttr != null )
{
numGraceAuth = policyConfig.getPwdGraceAuthNLimit() - ( pwdGraceUseAttr.size() + 1 );
@@ -1068,7 +1068,7 @@ public class AuthenticationInterceptor e
pwdGraceUseAttr = new DefaultAttribute( AT_PWD_GRACE_USE_TIME );
numGraceAuth = policyConfig.getPwdGraceAuthNLimit() - 1;
}
-
+
pwdRespCtrl.getResponse().setGraceAuthNsRemaining( numGraceAuth );
pwdGraceUseAttr.add( DateUtils.getGeneralizedTime() );
@@ -1090,7 +1090,7 @@ public class AuthenticationInterceptor e
if ( isPPolicyReqCtrlPresent )
{
int expiryWarnTime = getPwdTimeBeforeExpiry( userEntry, policyConfig );
-
+
if ( expiryWarnTime > 0 )
{
pwdRespCtrl.getResponse().setTimeBeforeExpiration( expiryWarnTime );
@@ -1185,10 +1185,10 @@ public class AuthenticationInterceptor e
}
String strPassword = Strings.utf8ToString(password);
-
+
// perform the length validation
validatePasswordLength( strPassword, policyConfig );
-
+
policyConfig.getPwdValidator().validate( strPassword, username );
}
@@ -1231,7 +1231,7 @@ public class AuthenticationInterceptor e
}
int warningAge = policyConfig.getPwdExpireWarning();
-
+
if ( warningAge <= 0 )
{
return 0;
@@ -1242,14 +1242,14 @@ public class AuthenticationInterceptor e
long currentTime = DateUtils.getDate( DateUtils.getGeneralizedTime() ).getTime();
int pwdAge = ( int ) ( currentTime - changedTime ) / 1000;
-
+
if ( pwdAge > policyConfig.getPwdMaxAge() )
{
return 0;
}
warningAge = policyConfig.getPwdMaxAge() - warningAge;
-
+
if ( pwdAge >= warningAge )
{
return policyConfig.getPwdMaxAge() - pwdAge;
@@ -1274,14 +1274,14 @@ public class AuthenticationInterceptor e
}
Attribute pwdChangedTimeAt = userEntry.get( PWD_CHANGED_TIME_AT );
-
+
if ( pwdChangedTimeAt != null )
{
long changedTime = DateUtils.getDate( pwdChangedTimeAt.getString() ).getTime();
changedTime += policyConfig.getPwdMinAge() * 1000;
-
+
long currentTime = DateUtils.getDate( DateUtils.getGeneralizedTime() ).getTime();
-
+
if ( changedTime > currentTime )
{
return true;
@@ -1304,7 +1304,7 @@ public class AuthenticationInterceptor e
boolean mustChange = false;
Attribute pwdResetAt = userEntry.get( PWD_RESET_AT );
-
+
if ( pwdResetAt != null )
{
mustChange = Boolean.parseBoolean( pwdResetAt.getString() );
@@ -1319,7 +1319,7 @@ public class AuthenticationInterceptor e
PwdModDetailsHolder pwdModDetails = new PwdModDetailsHolder();
List<Modification> mods = modifyContext.getModItems();
-
+
for ( Modification m : mods )
{
Attribute at = m.getAttribute();
@@ -1370,7 +1370,7 @@ public class AuthenticationInterceptor e
.hasRequestControl( PasswordPolicy.OID );
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyDecorator pwdRespCtrl =
+ PasswordPolicyDecorator pwdRespCtrl =
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true );
pwdRespCtrl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.CHANGE_AFTER_RESET );
opContext.addResponseControl( pwdRespCtrl );
@@ -1381,7 +1381,7 @@ public class AuthenticationInterceptor e
}
}
-
+
private static class PwdModDetailsHolder
{
private boolean pwdModPresent = false;
@@ -1454,10 +1454,10 @@ public class AuthenticationInterceptor e
this.newPwd = newPwd;
}
}
-
+
/**
- * Gets the effective password policy of the given entry.
+ * Gets the effective password policy of the given entry.
* If the entry has defined a custom password policy by setting "pwdPolicySubentry" attribute
* then the password policy associated with the Dn specified at the above attribute's value will be returned.
* Otherwise the default password policy will be returned (if present)
@@ -1472,27 +1472,27 @@ public class AuthenticationInterceptor e
{
return null;
}
-
+
if ( pwdPolicyContainer.hasCustomConfigs() )
{
Attribute pwdPolicySubentry = userEntry.get( pwdPolicySubentryAT );
-
+
if ( pwdPolicySubentry != null )
{
Dn configDn = adminSession.getDirectoryService().getDnFactory().create( pwdPolicySubentry.getString() );
-
+
return pwdPolicyContainer.getPolicyConfig( configDn );
}
}
-
+
return pwdPolicyContainer.getDefaultPolicy();
}
-
-
+
+
/**
* set all the password policies to be used by the server.
* This includes a default(i.e applicable to all entries) and custom(a.k.a per user) password policies
- *
+ *
* @param policyContainer the container holding all the password policies
*/
public void setPwdPolicies( PpolicyConfigContainer policyContainer )
@@ -1506,8 +1506,8 @@ public class AuthenticationInterceptor e
*/
public boolean isPwdPolicyEnabled()
{
- return ( ( pwdPolicyContainer != null )
- && ( ( pwdPolicyContainer.getDefaultPolicy() != null )
+ return ( ( pwdPolicyContainer != null )
+ && ( ( pwdPolicyContainer.getDefaultPolicy() != null )
|| ( pwdPolicyContainer.hasCustomConfigs() ) ) );
}
Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Wed Nov 9 23:03:58 2011
@@ -165,7 +165,7 @@ public class AciAuthorizationInterceptor
private PartitionNexus nexus;
public static final SearchControls DEFAULT_SEARCH_CONTROLS = new SearchControls();
-
+
/** The SubentryUtils instance */
private static SubentryUtils subentryUtils;
@@ -184,7 +184,7 @@ public class AciAuthorizationInterceptor
{ SchemaConstants.PRESCRIPTIVE_ACI_AT } );
ExprNode filter =
- new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue( SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) );
+ new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue( SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) );
CoreSession adminSession = new DefaultCoreSession( new LdapPrincipal( schemaManager, adminDn, AuthenticationLevel.STRONG ),
directoryService );
@@ -296,7 +296,7 @@ public class AciAuthorizationInterceptor
// Init the caches now
initTupleCache();
initGroupCache();
-
+
// Init the SubentryUtils instance
subentryUtils = new SubentryUtils( directoryService );
}
@@ -336,8 +336,7 @@ public class AciAuthorizationInterceptor
* @throws Exception if there are problems accessing attribute values
* @param proxy the partition nexus proxy object
*/
- private void addPerscriptiveAciTuples( OperationContext opContext, Collection<ACITuple> tuples, Dn dn, Entry entry )
- throws LdapException
+ private void addPerscriptiveAciTuples( OperationContext opContext, Collection<ACITuple> tuples, Dn dn, Entry entry ) throws LdapException
{
Entry originalEntry = null;
@@ -367,7 +366,7 @@ public class AciAuthorizationInterceptor
CoreSession session = opContext.getSession();
LookupOperationContext lookupContext = new LookupOperationContext( session, parentDn );
lookupContext.setAttrsId( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
-
+
originalEntry = directoryService.getPartitionNexus().lookup( lookupContext );
}
@@ -436,7 +435,7 @@ public class AciAuthorizationInterceptor
*/
private void addSubentryAciTuples( OperationContext opContext, Collection<ACITuple> tuples, Dn dn, Entry entry )
throws LdapException
- {
+ {
// only perform this for subentries
if ( !entry.contains( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
{
@@ -446,10 +445,10 @@ public class AciAuthorizationInterceptor
// get the parent or administrative entry for this subentry since it
// will contain the subentryACI attributes that effect subentries
Dn parentDn = dn.getParent();
-
+
CoreSession session = opContext.getSession();
LookupOperationContext lookupContext = new LookupOperationContext( session, parentDn, SchemaConstants.ALL_ATTRIBUTES_ARRAY );
-
+
Entry administrativeEntry = (( ClonedServerEntry ) directoryService.getPartitionNexus().lookup( lookupContext ) )
.getOriginalEntry();
@@ -478,7 +477,7 @@ public class AciAuthorizationInterceptor
tuples.addAll( item.toTuples() );
}
- }
+ }
/* -------------------------------------------------------------------------------
@@ -686,7 +685,7 @@ public class AciAuthorizationInterceptor
Entry modifiedEntry = directoryService.getPartitionNexus().lookup( lookupContext );
tupleCache.subentryModified( dn, mods, modifiedEntry );
groupCache.groupModified( dn, mods, entry, schemaManager );
-
+
return;
}
@@ -836,7 +835,7 @@ public class AciAuthorizationInterceptor
// It's the rootDSE, and it exists !
return answer;
}
-
+
CoreSession session = hasEntryContext.getSession();
// TODO - eventually replace this with a check on session.isAnAdministrator()
@@ -850,7 +849,7 @@ public class AciAuthorizationInterceptor
LookupOperationContext lookupContext = new LookupOperationContext( session, dn, SchemaConstants.ALL_ATTRIBUTES_ARRAY );
Entry entry = directoryService.getPartitionNexus().lookup( lookupContext );
-
+
Set<Dn> userGroups = groupCache.getGroups( principalDn.getNormName() );
Collection<ACITuple> tuples = new HashSet<ACITuple>();
addPerscriptiveAciTuples( hasEntryContext, tuples, dn, entry );
@@ -1030,7 +1029,7 @@ public class AciAuthorizationInterceptor
public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext )
throws LdapException
- {
+ {
Dn oldDn = moveAndRenameContext.getDn();
CoreSession session = moveAndRenameContext.getSession();
@@ -1055,7 +1054,7 @@ public class AciAuthorizationInterceptor
next.moveAndRename( moveAndRenameContext );
tupleCache.subentryRenamed( oldDn, newDn );
groupCache.groupRenamed( oldDn, newDn );
-
+
return;
}
@@ -1117,7 +1116,7 @@ public class AciAuthorizationInterceptor
next.moveAndRename( moveAndRenameContext );
tupleCache.subentryRenamed( oldDn, newDn );
groupCache.groupRenamed( oldDn, newDn );
- }
+ }
/**
@@ -1263,7 +1262,7 @@ public class AciAuthorizationInterceptor
/**
* {@inheritDoc}
*/
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
CoreSession session = compareContext.getSession();
Dn dn = compareContext.getDn();
@@ -1276,7 +1275,7 @@ public class AciAuthorizationInterceptor
if ( isPrincipalAnAdministrator( principalDn ) || !directoryService.isAccessControlEnabled() )
{
- return next.compare( compareContext );
+ return next( compareContext );
}
Set<Dn> userGroups = groupCache.getGroups( principalDn.getNormName() );
@@ -1310,7 +1309,7 @@ public class AciAuthorizationInterceptor
engine.checkPermission( aciContext );
- return next.compare( compareContext );
+ return next( compareContext );
}
@@ -1423,7 +1422,7 @@ public class AciAuthorizationInterceptor
return true;
}
-
+
/**
* WARNING: create one of these filters fresh every time for each new search.
*/
@@ -1432,7 +1431,7 @@ public class AciAuthorizationInterceptor
public boolean accept( SearchingOperationContext searchContext, Entry entry ) throws Exception
{
Dn normName = entry.getDn().apply( schemaManager );
-
+
return filter( searchContext, normName, entry );
}
}
Modified: directory/apacheds/trunk/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java Wed Nov 9 23:03:58 2011
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.core.logger;
@@ -48,8 +48,8 @@ import org.slf4j.LoggerFactory;
/**
* An interceptor used to log times to process each operation.
*
- * The way it works is that it gathers the time to process an operation
- * into a global counter, which is logged every 1000 operations (when
+ * The way it works is that it gathers the time to process an operation
+ * into a global counter, which is logged every 1000 operations (when
* using the OPERATION_STATS logger). It's also possible to get the time for
* each single operation if activating the OPERATION_TIME logger.
*
@@ -71,7 +71,7 @@ public class TimerInterceptor extends Ba
/** 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 );
@@ -87,11 +87,11 @@ public class TimerInterceptor extends Ba
/** Stats for the delete operation */
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 HasEntry operation */
private static AtomicLong totalHasEntry = new AtomicLong( 0 );
private static AtomicInteger nbHasEntryCalls = new AtomicInteger( 0 );
@@ -99,35 +99,35 @@ public class TimerInterceptor extends Ba
/** Stats for the list operation */
private static AtomicLong totalList = new AtomicLong( 0 );
private static AtomicInteger nbListCalls = new AtomicInteger( 0 );
-
+
/** Stats for the lookup operation */
private static AtomicLong totalLookup = new AtomicLong( 0 );
private static AtomicInteger nbLookupCalls = new AtomicInteger( 0 );
-
+
/** Stats for the modify operation */
private static AtomicLong totalModify = new AtomicLong( 0 );
private static AtomicInteger nbModifyCalls = new AtomicInteger( 0 );
-
+
/** Stats for the move operation */
private static AtomicLong totalMove = new AtomicLong( 0 );
private static AtomicInteger nbMoveCalls = new AtomicInteger( 0 );
-
+
/** Stats for the moveAndRename operation */
private static AtomicLong totalMoveAndRename = new AtomicLong( 0 );
private static AtomicInteger nbMoveAndRenameCalls = new AtomicInteger( 0 );
-
+
/** Stats for the rename operation */
private static AtomicLong totalRename = new AtomicLong( 0 );
private static AtomicInteger nbRenameCalls = new AtomicInteger( 0 );
-
+
/** Stats for the search operation */
private static AtomicLong totalSearch = new AtomicLong( 0 );
private static AtomicInteger nbSearchCalls = new AtomicInteger( 0 );
-
+
/** Stats for the unbind operation */
private static AtomicLong totalUnbind = new AtomicLong( 0 );
private static AtomicInteger nbUnbindCalls = new AtomicInteger( 0 );
-
+
/**
*
* Creates a new instance of TimerInterceptor.
@@ -138,8 +138,8 @@ public class TimerInterceptor extends Ba
{
this.name = name;
}
-
-
+
+
/**
* {@inheritDoc}
*/
@@ -153,7 +153,7 @@ public class TimerInterceptor extends Ba
{
nbAddCalls.incrementAndGet();
totalAdd.getAndAdd( delta );
-
+
if ( nbAddCalls.get() % 1000 == 0 )
{
long average = totalAdd.get()/(nbAddCalls.get() * 1000);
@@ -176,12 +176,12 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
next( bindContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbBindCalls.incrementAndGet();
totalBind.getAndAdd( delta );
-
+
if ( nbBindCalls.get() % 1000 == 0 )
{
long average = totalBind.get()/(nbBindCalls.get() * 1000);
@@ -199,17 +199,17 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
long t0 = System.nanoTime();
- boolean compare = next.compare( compareContext );
+ boolean compare = next( compareContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbCompareCalls.incrementAndGet();
totalCompare.getAndAdd( delta );
-
+
if ( nbCompareCalls.get() % 1000 == 0 )
{
long average = totalCompare.get()/(nbCompareCalls.get() * 1000);
@@ -221,7 +221,7 @@ public class TimerInterceptor extends Ba
{
OPERATION_TIME.debug( "{} : Delta compare = {}", name, delta );
}
-
+
return compare;
}
@@ -234,12 +234,12 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
next( deleteContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbDeleteCalls.incrementAndGet();
totalDelete.getAndAdd( delta );
-
+
if ( nbDeleteCalls.get() % 1000 == 0 )
{
long average = totalDelete.get()/(nbDeleteCalls.get() * 1000);
@@ -261,7 +261,7 @@ public class TimerInterceptor extends Ba
{
}
-
+
/**
* {@inheritDoc}
*/
@@ -276,16 +276,16 @@ public class TimerInterceptor extends Ba
*/
public Entry getRootDSE( GetRootDSEOperationContext getRootDseContext )
throws LdapException
- {
+ {
long t0 = System.nanoTime();
Entry rootDSE = next( getRootDseContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbGetRootDSECalls.incrementAndGet();
totalGetRootDSE.getAndAdd( delta );
-
+
if ( nbGetRootDSECalls.get() % 1000 == 0 )
{
long average = totalGetRootDSE.get()/(nbGetRootDSECalls.get() * 1000);
@@ -297,9 +297,9 @@ public class TimerInterceptor extends Ba
{
OPERATION_TIME.debug( "{} : Delta getRootDSE = {}", name, delta );
}
-
+
return rootDSE;
- }
+ }
/**
@@ -310,12 +310,12 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
boolean hasEntry = next( hasEntryContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbHasEntryCalls.incrementAndGet();
totalHasEntry.getAndAdd( delta );
-
+
if ( nbHasEntryCalls.get() % 1000 == 0 )
{
long average = totalHasEntry.get()/(nbHasEntryCalls.get() * 1000);
@@ -327,11 +327,11 @@ public class TimerInterceptor extends Ba
{
OPERATION_TIME.debug( "{} : Delta hasEntry = {}", name, delta );
}
-
+
return hasEntry;
}
-
+
/**
* {@inheritDoc}
*/
@@ -348,12 +348,12 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
EntryFilteringCursor cursor = next.list( listContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbListCalls.incrementAndGet();
totalList.getAndAdd( delta );
-
+
if ( nbListCalls.get() % 1000 == 0 )
{
long average = totalList.get()/(nbListCalls.get() * 1000);
@@ -365,7 +365,7 @@ public class TimerInterceptor extends Ba
{
OPERATION_TIME.debug( "{} : Delta list = {}", name, delta );
}
-
+
return cursor;
}
@@ -378,19 +378,19 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
Entry entry = next.lookup( lookupContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbLookupCalls.incrementAndGet();
totalLookup.getAndAdd( delta );
-
+
if ( nbLookupCalls.get() % 1000 == 0 )
{
long average = totalLookup.get()/(nbLookupCalls.get() * 1000);
OPERATION_STATS.debug( name + " : Average lookup = {} microseconds, nb lookups = {}", average, nbLookupCalls.get() );
}
}
-
+
if ( IS_DEBUG_TIME )
{
OPERATION_TIME.debug( "{} : Delta lookup = {}", name, delta );
@@ -408,12 +408,12 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
next.modify( modifyContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbModifyCalls.incrementAndGet();
totalModify.getAndAdd( delta );
-
+
if ( nbModifyCalls.get() % 1000 == 0 )
{
long average = totalModify.get()/(nbModifyCalls.get() * 1000);
@@ -436,12 +436,12 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
next.move( moveContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbMoveCalls.incrementAndGet();
totalMove.getAndAdd( delta );
-
+
if ( nbMoveCalls.get() % 1000 == 0 )
{
long average = totalMove.get()/(nbMoveCalls.get() * 1000);
@@ -464,12 +464,12 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
next.moveAndRename( moveAndRenameContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbMoveAndRenameCalls.incrementAndGet();
totalMoveAndRename.getAndAdd( delta );
-
+
if ( nbMoveAndRenameCalls.get() % 1000 == 0 )
{
long average = totalMoveAndRename.get()/(nbMoveAndRenameCalls.get() * 1000);
@@ -492,12 +492,12 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
next.rename( renameContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbRenameCalls.incrementAndGet();
totalRename.getAndAdd( delta );
-
+
if ( nbRenameCalls.get() % 1000 == 0 )
{
long average = totalRename.get()/(nbRenameCalls.get() * 1000);
@@ -520,12 +520,12 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
EntryFilteringCursor cursor = next.search( searchContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbSearchCalls.incrementAndGet();
totalSearch.getAndAdd( delta );
-
+
if ( nbSearchCalls.get() % 1000 == 0 )
{
long average = totalSearch.get()/(nbSearchCalls.get() * 1000);
@@ -537,7 +537,7 @@ public class TimerInterceptor extends Ba
{
OPERATION_TIME.debug( "{} : Delta search = {}", name, delta );
}
-
+
return cursor;
}
@@ -550,12 +550,12 @@ public class TimerInterceptor extends Ba
long t0 = System.nanoTime();
next( unbindContext );
long delta = System.nanoTime() - t0;
-
+
if ( IS_DEBUG_STATS )
{
nbUnbindCalls.incrementAndGet();
totalUnbind.getAndAdd( delta );
-
+
if ( nbUnbindCalls.get() % 1000 == 0 )
{
long average = totalUnbind.get()/(nbUnbindCalls.get() * 1000);
Modified: directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Wed Nov 9 23:03:58 2011
@@ -150,7 +150,7 @@ public class NormalizationInterceptor ex
modification.apply( attributeType );
}
}
-
+
nextInterceptor.modify( modifyContext );
}
@@ -218,7 +218,7 @@ public class NormalizationInterceptor ex
*/
public void moveAndRename( NextInterceptor nextInterceptor, MoveAndRenameOperationContext moveAndRenameContext )
throws LdapException
- {
+ {
if ( !moveAndRenameContext.getNewRdn().isSchemaAware() )
{
@@ -241,7 +241,7 @@ public class NormalizationInterceptor ex
}
nextInterceptor.moveAndRename( moveAndRenameContext );
- }
+ }
/**
@@ -249,7 +249,7 @@ public class NormalizationInterceptor ex
*/
public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext )
throws LdapException
- {
+ {
Dn dn = searchContext.getDn();
if ( !dn.isSchemaAware() )
@@ -280,7 +280,7 @@ public class NormalizationInterceptor ex
// TODO Normalize the returned Attributes, storing the UP attributes to format the returned values.
return nextInterceptor.search( searchContext );
}
- }
+ }
/**
@@ -289,7 +289,7 @@ public class NormalizationInterceptor ex
public boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException
{
hasEntryContext.getDn().apply( schemaManager );
-
+
return next( hasEntryContext );
}
@@ -299,10 +299,10 @@ public class NormalizationInterceptor ex
*/
public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext listContext )
throws LdapException
- {
+ {
listContext.getDn().apply( schemaManager );
return nextInterceptor.list( listContext );
- }
+ }
/**
@@ -353,7 +353,7 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
if ( !compareContext.getDn().isSchemaAware() )
{
@@ -379,7 +379,7 @@ public class NormalizationInterceptor ex
throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
}
- return next.compare( compareContext );
+ return next( compareContext );
}
Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1200023&r1=1200022&r2=1200023&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Wed Nov 9 23:03:58 2011
@@ -300,8 +300,7 @@ public class SchemaInterceptor extends B
* As a result, we will gather all of these three ObjectClasses in 'inetOrgPerson' ObjectClasse
* superiors.
*/
- private void computeOCSuperiors( ObjectClass objectClass, List<ObjectClass> superiors, Set<String> ocSeen )
- throws LdapException
+ private void computeOCSuperiors( ObjectClass objectClass, List<ObjectClass> superiors, Set<String> ocSeen ) throws LdapException
{
List<ObjectClass> parents = objectClass.getSuperiors();
@@ -371,8 +370,7 @@ public class SchemaInterceptor extends B
}
- public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext listContext )
- throws LdapException
+ public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext listContext ) throws LdapException
{
EntryFilteringCursor cursor = nextInterceptor.list( listContext );
cursor.addEntryFilter( binaryAttributeFilter );
@@ -383,7 +381,7 @@ public class SchemaInterceptor extends B
/**
* {@inheritDoc}
*/
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
if ( IS_DEBUG )
{
@@ -397,7 +395,7 @@ public class SchemaInterceptor extends B
throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
}
- boolean result = next.compare( compareContext );
+ boolean result = next( compareContext );
return result;
}
@@ -572,9 +570,9 @@ public class SchemaInterceptor extends B
}
}
else if ( ( filter instanceof SubstringNode ) ||
- ( filter instanceof PresenceNode ) ||
- ( filter instanceof AssertionNode ) ||
- ( filter instanceof ScopeNode ) )
+ ( filter instanceof PresenceNode ) ||
+ ( filter instanceof AssertionNode ) ||
+ ( filter instanceof ScopeNode ) )
{
// Nothing to do
}
@@ -631,8 +629,7 @@ public class SchemaInterceptor extends B
}
- public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext )
- throws LdapException
+ public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext ) throws LdapException
{
Dn base = searchContext.getDn();
SearchControls searchCtls = searchContext.getSearchControls();
@@ -1026,7 +1023,7 @@ public class SchemaInterceptor extends B
&& ( !attributeType.equals( MODIFIERS_NAME_AT )
&& ( !attributeType.equals( MODIFY_TIMESTAMP_AT ) )
&& ( !attributeType.equals( ENTRY_CSN_AT ) )
- && ( !PWD_POLICY_STATE_ATTRIBUTE_TYPES.contains( attributeType ) ) ) )
+ && ( !PWD_POLICY_STATE_ATTRIBUTE_TYPES.contains( attributeType ) ) ) )
{
String msg = I18n.err( I18n.ERR_52, attributeType );
LOG.error( msg );
@@ -1065,7 +1062,7 @@ public class SchemaInterceptor extends B
// point, as one of the following modification can change the
// ObjectClasses.
Attribute newAttribute = attribute.clone();
-
+
// Check that the attribute allows null values if we don'y have any value
if ( ( newAttribute.size() == 0 ) && !newAttribute.isValid( attributeType ) )
{
@@ -1325,7 +1322,7 @@ public class SchemaInterceptor extends B
public boolean accept( SearchingOperationContext operation, Entry entry ) throws Exception
{
filterBinaryAttributes( entry );
-
+
return true;
}
}
@@ -1339,7 +1336,7 @@ public class SchemaInterceptor extends B
public boolean accept( SearchingOperationContext operation, Entry entry ) throws Exception
{
filterAttributeTypes( operation, entry );
-
+
return true;
}
}
@@ -1516,9 +1513,9 @@ public class SchemaInterceptor extends B
if ( ( schema != null ) && schema.isEnabled() )
{
- Attribute oidAT = entry.get( MetaSchemaConstants.M_OID_AT );
+ Attribute oidAT = entry.get( MetaSchemaConstants.M_OID_AT );
String ocOid = oidAT.getString();
-
+
ObjectClass addedOC = schemaManager.lookupObjectClassRegistry( ocOid );
computeSuperior( addedOC );
}
@@ -1544,14 +1541,14 @@ public class SchemaInterceptor extends B
private String getSchemaName( Dn dn ) throws LdapException
{
int size = dn.size();
-
+
if ( size < 2 )
{
throw new LdapException( I18n.err( I18n.ERR_276 ) );
}
Rdn rdn = dn.getRdn( size - 2 );
-
+
return rdn.getNormValue().getString();
}
@@ -1605,8 +1602,7 @@ public class SchemaInterceptor extends B
/**
* Checks to see numbers of values of attributes conforms to the schema
*/
- private void assertNumberOfAttributeValuesValid( Attribute attribute )
- throws LdapInvalidAttributeValueException
+ private void assertNumberOfAttributeValuesValid( Attribute attribute ) throws LdapInvalidAttributeValueException
{
if ( attribute.size() > 1 && attribute.getAttributeType().isSingleValued() )
{
@@ -1631,25 +1627,25 @@ public class SchemaInterceptor extends B
// include AT names for better error reporting
StringBuilder sb = new StringBuilder();
sb.append( '[' );
-
+
for( String oid: must )
{
String name = schemaManager.getAttributeType( oid ).getName();
sb.append( name )
- .append( '(' )
- .append( oid )
- .append( "), " );
+ .append( '(' )
+ .append( oid )
+ .append( "), " );
}
-
+
int end = sb.length();
sb.replace( end - 2, end, "" ); // remove the trailing ', '
sb.append( ']' );
-
+
throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_279,
sb, dn.getName() ) );
}
}
-
+
/**
* Checck that OC does not conflict :