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/13 01:04:28 UTC
svn commit: r1201365 [1/2] - in
/directory/apacheds/branches/apacheds-osgi/core-api/src:
main/java/org/apache/directory/server/core/api/
main/java/org/apache/directory/server/core/api/interceptor/
main/java/org/apache/directory/server/core/api/intercep...
Author: elecharny
Date: Sun Nov 13 00:04:27 2011
New Revision: 1201365
URL: http://svn.apache.org/viewvc?rev=1201365&view=rev
Log:
Merged trunk into the osgi branch
Added:
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/InterceptorEnum.java
- copied unchanged from r1201343, directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/InterceptorEnum.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/OperationEnum.java
- copied unchanged from r1201343, directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/OperationEnum.java
Removed:
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/invocation/
Modified:
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/OperationManager.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AddOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/BindOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/CompareOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/DeleteOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ListOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/LookupOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ModifyOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/MoveAndRenameOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/MoveOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/OperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/RenameOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/SearchOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/UnbindOperationContext.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/partition/Partition.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/partition/PartitionNexus.java
directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/schema/SchemaPartition.java
directory/apacheds/branches/apacheds-osgi/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java
directory/apacheds/branches/apacheds-osgi/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java
directory/apacheds/branches/apacheds-osgi/core-api/src/test/java/org/apache/directory/server/core/api/MockInterceptor.java
directory/apacheds/branches/apacheds-osgi/core-api/src/test/java/org/apache/directory/server/core/api/MockOperation.java
directory/apacheds/branches/apacheds-osgi/core-api/src/test/java/org/apache/directory/server/core/api/MockOperationManager.java
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java Sun Nov 13 00:04:27 2011
@@ -325,9 +325,24 @@ public interface CoreSession
void delete( Dn dn, LogChange log ) throws LdapException;
+ /**
+ * Deletes an entry in the server.
+ *
+ * @param deleteRequest the delete request containing all the informations
+ * necessary to delete the entry
+ * @throws Exception if there are failures while deleting the entry
+ */
void delete( DeleteRequest deleteRequest ) throws LdapException;
+ /**
+ * Deletes an entry in the server. The operation can be logged if requested
+ *
+ * @param deleteRequest the delete request containing all the informations
+ * necessary to delete the entry
+ * @param log Tells if we should log the deletion in the ChangeLog interceptor
+ * @throws Exception if there are failures while deleting the entry
+ */
void delete( DeleteRequest deleteRequest, LogChange log ) throws LdapException;
@@ -796,8 +811,19 @@ public interface CoreSession
EntryFilteringCursor search( SearchRequest searchRequest ) throws LdapException;
+ /**
+ * Unbind from the current LdapSession.
+ *
+ * @throws LdapException If the operation failed
+ */
void unbind() throws LdapException;
+ /**
+ * Unbind from the current LdapSession.
+ *
+ * @param unbindRequest The Unbind requst, potentially containing some controls
+ * @throws LdapException If the operation failed
+ */
void unbind( UnbindRequest unbindRequest ) throws LdapException;
}
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java Sun Nov 13 00:04:27 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;
@@ -32,7 +32,6 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.api.entry.ServerEntryFactory;
import org.apache.directory.server.core.api.event.EventService;
import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.InterceptorChain;
import org.apache.directory.server.core.api.journal.Journal;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.api.partition.PartitionNexus;
@@ -97,11 +96,8 @@ public interface DirectoryService extend
PartitionNexus getPartitionNexus();
- InterceptorChain getInterceptorChain();
-
-
void addPartition( Partition partition ) throws Exception;
-
+
void removePartition( Partition partition ) throws Exception;
@@ -109,20 +105,20 @@ public interface DirectoryService extend
* @return The Directory Service SchemaManager
*/
SchemaManager getSchemaManager();
-
-
+
+
/**
* @return The LDAP codec service.
*/
LdapApiService getLdapCodecService();
-
+
/**
* @return The referral manager
*/
ReferralManager getReferralManager();
-
+
/**
* Set the referralManager
*
@@ -130,7 +126,7 @@ public interface DirectoryService extend
*/
void setReferralManager( ReferralManager referralManager );
-
+
/**
* @return The schema partition
*/
@@ -145,8 +141,8 @@ public interface DirectoryService extend
EventService getEventService();
-
-
+
+
/**
*/
void setEventService( EventService eventService );
@@ -181,15 +177,15 @@ public interface DirectoryService extend
*/
boolean isStarted();
-
+
/**
* @return The Admin session
*/
CoreSession getAdminSession();
-
-
- /**
- * @return Returns the hash mapping the Dn of a subentry to its SubtreeSpecification/types
+
+
+ /**
+ * @return Returns the hash mapping the Dn of a subentry to its SubtreeSpecification/types
**/
SubentryCache getSubentryCache();
@@ -197,42 +193,42 @@ public interface DirectoryService extend
* @return Returns the subentry evaluator
*/
SubtreeEvaluator getEvaluator();
-
+
/**
* Gets a logical session to perform operations on this DirectoryService
- * as the anonymous user. This bypasses authentication without
+ * as the anonymous user. This bypasses authentication without
* propagating a bind operation into the core.
*
* @return a logical session as the anonymous user
*/
CoreSession getSession() throws Exception;
-
+
/**
* Gets a logical session to perform operations on this DirectoryService
- * as a specific user. This bypasses authentication without propagating
+ * as a specific user. This bypasses authentication without propagating
* a bind operation into the core.
*
* @return a logical session as a specific user
*/
CoreSession getSession( LdapPrincipal principal ) throws Exception;
-
+
/**
* Gets a logical session to perform operations on this DirectoryService
- * as a specific user with a separate authorization principal. This
- * bypasses authentication without propagating a bind operation into the
+ * as a specific user with a separate authorization principal. This
+ * bypasses authentication without propagating a bind operation into the
* core.
*
* @return a logical session as a specific user
*/
CoreSession getSession( Dn principalDn, byte[] credentials ) throws LdapException;
-
+
/**
* Gets a logical session to perform operations on this DirectoryService
- * as a specific user with a separate authorization principal. This
- * bypasses authentication without propagating a bind operation into the
+ * as a specific user with a separate authorization principal. This
+ * bypasses authentication without propagating a bind operation into the
* core.
*
* @return a logical session as a specific user
@@ -240,7 +236,7 @@ public interface DirectoryService extend
CoreSession getSession( Dn principalDn, byte[] credentials, String saslMechanism, String saslAuthId )
throws Exception;
-
+
/**
*/
void setInstanceId( String instanceId );
@@ -319,7 +315,6 @@ public interface DirectoryService extend
void setAllowAnonymousAccess( boolean enableAnonymousAccess );
-
/**
* Returns interceptors in the server.
*
@@ -329,6 +324,14 @@ public interface DirectoryService extend
/**
+ * Returns interceptors in the server.
+ *
+ * @return the interceptors in the server.
+ */
+ List<String> getInterceptors( OperationEnum operation );
+
+
+ /**
* Sets the interceptors in the server.
*
* @param interceptors the interceptors to be used in the server.
@@ -337,13 +340,41 @@ public interface DirectoryService extend
/**
+ * Add an interceptor in the first position in the interceptor list.
+ * @param interceptor The added interceptor
+ */
+ void addFirst( Interceptor interceptor ) throws LdapException;
+
+
+ /**
+ * Add an interceptor in the last position in the interceptor list.
+ * @param interceptor The added interceptor
+ */
+ void addLast( Interceptor interceptor ) throws LdapException;
+
+ /**
+ * Add an interceptor after a given interceptor in the interceptor list.
+ * @param interceptorName The interceptor name to find
+ * @param interceptor The added interceptor
+ */
+ void addAfter( String interceptorName, Interceptor interceptor );
+
+
+ /**
+ * Remove an interceptor from the list of interceptors
+ * @param interceptorName The interceptor to remove
+ */
+ void remove( String interceptorName );
+
+
+ /**
* Sets the journal in the server.
*
* @param journal the journal to be used in the server.
*/
void setJournal( Journal journal );
-
+
/**
* Returns test directory entries({@link org.apache.directory.shared.ldap.model.ldif.LdifEntry}) to be loaded while
* bootstrapping.
@@ -369,7 +400,7 @@ public interface DirectoryService extend
*/
InstanceLayout getInstanceLayout();
-
+
/**
* Sets the InstanceLayout used by the DirectoryService to store the files
* @param instanceLayout The InstanceLayout to set
@@ -442,7 +473,7 @@ public interface DirectoryService extend
* @param changeLog the change log service to set
*/
void setChangeLog( ChangeLog changeLog );
-
+
/**
* Create a new Entry.
@@ -451,8 +482,8 @@ public interface DirectoryService extend
* @param dn the Dn for this new entry
*/
Entry newEntry( String ldif, String dn );
-
-
+
+
/**
* Gets the operation manager.
*/
@@ -466,21 +497,21 @@ public interface DirectoryService extend
/**
- * Set the maximum allowed size for an incoming PDU
+ * Set the maximum allowed size for an incoming PDU
* @param maxPDUSize A positive number of bytes for the PDU. A negative or
* null value will be transformed to {@link Integer#MAX_VALUE}
*/
void setMaxPDUSize( int maxPDUSize );
-
-
+
+
/**
* Get an Interceptor instance from its name
- * @param interceptorName The interceptor's name for which we want the instance
+ * @param interceptorName The interceptor's name for which we want the instance
* @return the interceptor for the given name
*/
Interceptor getInterceptor( String interceptorName );
-
-
+
+
/**
* Get a new CSN
* @return The CSN generated for this directory service
@@ -506,7 +537,7 @@ public interface DirectoryService extend
* @param schemaManager The SchemaManager to associate
*/
void setSchemaManager( SchemaManager schemaManager );
-
+
/**
* the highest committed CSN value
@@ -515,31 +546,31 @@ public interface DirectoryService extend
*/
void setContextCsn( String lastCommittedCsnVal );
-
+
/**
* @return the current highest committed CSN value
*/
String getContextCsn();
-
-
+
+
/**
* the time interval at which the DirectoryService's data is flushed to disk
*
* @param syncPeriodMillis the syncPeriodMillis to set
*/
void setSyncPeriodMillis( long syncPeriodMillis );
-
-
+
+
/**
* @return the syncPeriodMillis
*/
long getSyncPeriodMillis();
-
+
/**
* @return the cache service
*/
CacheService getCacheService();
-
+
/**
* @return The AccessControl AdministrativePoint cache
@@ -563,8 +594,8 @@ public interface DirectoryService extend
* @return The TriggerExecution AdministrativePoint cache
*/
DnNode<TriggerExecutionAdministrativePoint> getTriggerExecutionAPCache();
-
-
+
+
/**
* @return true if the password policy is enabled, false otherwise
*/
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java Sun Nov 13 00:04:27 2011
@@ -934,7 +934,7 @@ public class LdapCoreSessionConnection i
throw new IllegalArgumentException( "The entry Dn must not be null" );
}
- if ( entryDn.isRootDSE() )
+ if ( entryDn.isRootDse() )
{
throw new IllegalArgumentException( "The RootDSE cannot be moved" );
}
@@ -944,7 +944,7 @@ public class LdapCoreSessionConnection i
throw new IllegalArgumentException( "The new Dn must not be null" );
}
- if ( newDn.isRootDSE() )
+ if ( newDn.isRootDse() )
{
throw new IllegalArgumentException( "The RootDSE cannot be the target" );
}
@@ -1183,6 +1183,7 @@ public class LdapCoreSessionConnection i
BindOperationContext bindContext = new BindOperationContext( null );
bindContext.setCredentials( bindRequest.getCredentials() );
bindContext.setDn( bindRequest.getName() );
+ bindContext.setInterceptors( directoryService.getInterceptors( OperationEnum.BIND ) );
OperationManager operationManager = directoryService.getOperationManager();
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/OperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/OperationManager.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/OperationManager.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/OperationManager.java Sun Nov 13 00:04:27 2011
@@ -25,8 +25,8 @@ import org.apache.directory.server.core.
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.HasEntryOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.GetRootDseOperationContext;
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;
@@ -40,7 +40,7 @@ import org.apache.directory.shared.ldap.
/**
- * An interface used by the DirectoryService to isolate operations that can be
+ * An interface used by the DirectoryService to isolate operations that can be
* performed on it.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -48,27 +48,34 @@ import org.apache.directory.shared.ldap.
public interface OperationManager
{
/**
- * TODO document after determining if this method should be here.
+ * Add an entry into the backend, going through the interceptor chain
+ *
+ * @param addContext The context containing the information to process the addition
+ * @throws LdapException If the addition can't be processed successfully
*/
- Entry getRootDSE( GetRootDSEOperationContext getRootDseContext ) throws LdapException;
-
-
+ void add( AddOperationContext addContext ) throws LdapException;
+
+
/**
- * TODO document after determining if this method should be here.
+ * Get the RooDse entry.
+ *
+ * @param getRootDseContext The getRootDse() context
+ * @return The rootDse if found
+ * @throws LdapException If we can't get back the rootDse entry
*/
- boolean compare( CompareOperationContext compareContext) throws LdapException;
+ Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException;
/**
* TODO document after determining if this method should be here.
*/
- void delete( DeleteOperationContext deleteContext ) throws LdapException;
+ boolean compare( CompareOperationContext compareContext) throws LdapException;
/**
* TODO document after determining if this method should be here.
*/
- void add( AddOperationContext addContext ) throws LdapException;
+ void delete( DeleteOperationContext deleteContext ) throws LdapException;
/**
@@ -98,7 +105,7 @@ public interface OperationManager
/**
* TODO document after determining if this method should be here.
*/
- boolean hasEntry( EntryOperationContext hasEntryContext ) throws LdapException;
+ boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException;
/**
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java Sun Nov 13 00:04:27 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;
@@ -23,17 +23,16 @@ package org.apache.directory.server.core
import java.util.HashSet;
import java.util.Set;
-import javax.naming.Context;
-
import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.LdapPrincipal;
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.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.HasEntryOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.GetRootDseOperationContext;
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;
@@ -43,7 +42,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.api.interceptor.context.RenameOperationContext;
import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.api.interceptor.context.UnbindOperationContext;
-import org.apache.directory.server.core.api.invocation.InvocationStack;
+import org.apache.directory.server.core.api.partition.PartitionNexus;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -60,6 +59,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;
+
/** A reference to the DirectoryService instance */
protected DirectoryService directoryService;
@@ -116,19 +118,172 @@ public abstract class BaseInterceptor im
/**
+ * The final interceptor which acts as a proxy in charge to dialog with the nexus partition.
+ */
+ private final Interceptor FINAL_INTERCEPTOR = new Interceptor()
+ {
+ private PartitionNexus nexus;
+
+
+ public String getName()
+ {
+ return "FINAL";
+ }
+
+
+ public void init( DirectoryService directoryService )
+ {
+ this.nexus = directoryService.getPartitionNexus();
+ }
+
+
+ public void destroy()
+ {
+ // unused
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void add( AddOperationContext addContext ) throws LdapException
+ {
+ nexus.add( addContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void bind( BindOperationContext bindContext ) throws LdapException
+ {
+ nexus.bind( bindContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
+ {
+ return nexus.compare( compareContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void delete( DeleteOperationContext deleteContext ) throws LdapException
+ {
+ nexus.delete( deleteContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException
+ {
+ return nexus.getRootDse( getRootDseContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException
+ {
+ return nexus.hasEntry( hasEntryContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
+ {
+ return nexus.list( listContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
+ {
+ return nexus.lookup( lookupContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
+ {
+ nexus.modify( modifyContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void move( MoveOperationContext moveContext ) throws LdapException
+ {
+ nexus.move( moveContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+ {
+ nexus.moveAndRename( moveAndRenameContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void rename( RenameOperationContext renameContext ) throws LdapException
+ {
+ nexus.rename( renameContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
+ {
+ return nexus.search( searchContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void unbind( UnbindOperationContext unbindContext ) throws LdapException
+ {
+ nexus.unbind( unbindContext );
+ }
+ };
+
+
+ /**
* default interceptor name is its class, preventing accidental duplication of interceptors by naming
* instances differently
* @return (default, class name) interceptor name
*/
public String getName()
{
- return getClass().getSimpleName();
+ return name;
}
/**
- * TODO delete this since it uses static access
* Returns {@link LdapPrincipal} of current context.
+ *
* @param opContext TODO
* @return the authenticated principal
*/
@@ -139,16 +294,39 @@ public abstract class BaseInterceptor im
/**
- * Creates a new instance.
+ * Creates a new instance with a default name : the class name itself.
*/
protected BaseInterceptor()
{
+ name = getClass().getSimpleName();
+ }
+
+
+ /**
+ * Creates a new instance with a given name.
+ *
+ * @param name the Interceptor name
+ */
+ protected BaseInterceptor( String name )
+ {
+ this.name = name;
+ }
+
+
+ /**
+ * Creates a new instance with a given name.
+ *
+ * @param name the Interceptor name
+ */
+ protected BaseInterceptor( InterceptorEnum interceptor )
+ {
+ this.name = interceptor.getName();
}
/**
* This method does nothing by default.
- * @throws Exception
+ * @throws Exception
*/
public void init( DirectoryService directoryService ) throws LdapException
{
@@ -173,6 +351,8 @@ 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 );
}
@@ -184,97 +364,352 @@ public abstract class BaseInterceptor im
}
+ /**
+ * 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
+ * @return The next interceptor in the list for this operation
+ */
+ private Interceptor getNextInterceptor( OperationContext operationContext )
+ {
+ String currentInterceptor = operationContext.getNextInterceptor();
+
+ if ( currentInterceptor.equals( "FINAL" ) )
+ {
+ return FINAL_INTERCEPTOR;
+ }
+
+ Interceptor interceptor = directoryService.getInterceptor( currentInterceptor );
+
+ return interceptor;
+ }
+
+
// ------------------------------------------------------------------------
// Interceptor's Invoke Method
// ------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
- public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+ public void add( AddOperationContext addContext ) throws LdapException
+ {
+ // Do nothing
+ }
+
+
+ /**
+ * Calls the next interceptor for the add operation.
+ *
+ * @param addContext The context in which we are executing this operation
+ * @throws LdapException If something went wrong
+ */
+ protected final void next( AddOperationContext addContext ) throws LdapException
{
- next.add( addContext );
+ Interceptor interceptor = getNextInterceptor( addContext );
+
+ interceptor.add( addContext );
}
- public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void bind( BindOperationContext bindContext ) throws LdapException
{
- next.delete( deleteContext );
+ // Do nothing
}
- public Entry getRootDSE( NextInterceptor next, GetRootDSEOperationContext getRootDseContext ) throws LdapException
+ /**
+ * 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
{
- return next.getRootDSE( getRootDseContext );
+ Interceptor interceptor = getNextInterceptor( bindContext );
+
+ interceptor.bind( bindContext );
}
- public boolean hasEntry( NextInterceptor next, EntryOperationContext hasEntryContext ) throws LdapException
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
- return next.hasEntry( hasEntryContext );
+ // Return false in any case
+ return false;
}
- public EntryFilteringCursor list( NextInterceptor next, ListOperationContext listContext ) throws LdapException
+ /**
+ * 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
{
- return next.list( listContext );
+ Interceptor interceptor = getNextInterceptor( compareContext );
+
+ return interceptor.compare( compareContext );
}
- public Entry lookup( NextInterceptor next, LookupOperationContext lookupContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
- return next.lookup( lookupContext );
+ // Do nothing
}
- public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
+ /**
+ * Calls the next interceptor for the delete operation.
+ *
+ * @param deleteContext The context in which we are executing this operation
+ * @throws LdapException If something went wrong
+ */
+ protected final void next( DeleteOperationContext deleteContext ) throws LdapException
{
- next.modify( modifyContext );
+ Interceptor interceptor = getNextInterceptor( deleteContext );
+
+ interceptor.delete( deleteContext );
}
- public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext )
- throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException
{
- next.moveAndRename( moveAndRenameContext );
+ // Nothing to do
+ return null;
}
- public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
+ /**
+ * 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
{
- next.rename( renameContext );
+ Interceptor interceptor = getNextInterceptor( getRootDseContext );
+
+ return interceptor.getRootDse( getRootDseContext );
}
/**
* {@inheritDoc}
*/
- public void move( NextInterceptor next, MoveOperationContext moveContext ) throws LdapException
+ public boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException
+ {
+ // Return false in any case
+ return false;
+ }
+
+
+ /**
+ * Calls the next interceptor for the hasEntry operation.
+ *
+ * @param hasEntryContext The context in which we are executing this operation
+ * @return a boolean indicating if the entry exists on the server
+ * @throws LdapException If something went wrong
+ */
+ protected final boolean next( HasEntryOperationContext hasEntryContext ) throws LdapException
{
- next.move( moveContext );
+ Interceptor interceptor = getNextInterceptor( hasEntryContext );
+
+ return interceptor.hasEntry( hasEntryContext );
}
- public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext )
- throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
{
- return next.search( searchContext );
+ return null;
}
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
+ /**
+ * Calls the next interceptor for the list operation.
+ *
+ * @param listContext The context in which we are executing this operation
+ * @return the cursor containing the listed entries
+ * @throws LdapException If something went wrong
+ */
+ protected final EntryFilteringCursor next( ListOperationContext listContext ) throws LdapException
{
- return next.compare( compareContext );
+ Interceptor interceptor = getNextInterceptor( listContext );
+
+ return interceptor.list( listContext );
}
- public void bind( NextInterceptor next, BindOperationContext bindContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
- next.bind( bindContext );
+ return next( lookupContext );
}
- public void unbind( NextInterceptor next, UnbindOperationContext unbindContext ) throws LdapException
+ /**
+ * Calls the next interceptor for the lookup operation.
+ *
+ * @param lookupContext The context in which we are executing this operation
+ * @return the Entry containing the found entry
+ * @throws LdapException If something went wrong
+ */
+ protected final Entry next( LookupOperationContext lookupContext ) throws LdapException
{
- next.unbind( unbindContext );
+ Interceptor interceptor = getNextInterceptor( lookupContext );
+
+ return interceptor.lookup( lookupContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
+ {
+ // Nothing to do
+ }
+
+
+ /**
+ * Calls the next interceptor for the modify operation.
+ *
+ * @param modifyContext The context in which we are executing this operation
+ * @throws LdapException If something went wrong
+ */
+ protected final void next( ModifyOperationContext modifyContext ) throws LdapException
+ {
+ Interceptor interceptor = getNextInterceptor( modifyContext );
+
+ interceptor.modify( modifyContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void move( MoveOperationContext moveContext ) throws LdapException
+ {
+ // Do nothing
+ }
+
+
+ /**
+ * Calls the next interceptor for the move operation.
+ *
+ * @param moveContext The context in which we are executing this operation
+ * @throws LdapException If something went wrong
+ */
+ protected final void next( MoveOperationContext moveContext ) throws LdapException
+ {
+ Interceptor interceptor = getNextInterceptor( moveContext );
+
+ interceptor.move( moveContext );
+ }
+
+
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+ {
+ // Do nothing
+ }
+
+
+ /**
+ * Calls the next interceptor for the moveAndRename operation.
+ *
+ * @param moveAndRenameContext The context in which we are executing this operation
+ * @throws LdapException If something went wrong
+ */
+ protected final void next( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+ {
+ Interceptor interceptor = getNextInterceptor( moveAndRenameContext );
+
+ interceptor.moveAndRename( moveAndRenameContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void rename( RenameOperationContext renameContext ) throws LdapException
+ {
+ // Nothing to do
+ }
+
+
+ /**
+ * Calls the next interceptor for the rename operation.
+ *
+ * @param renameContext The context in which we are executing this operation
+ * @throws LdapException If something went wrong
+ */
+ protected final void next( RenameOperationContext renameContext ) throws LdapException
+ {
+ Interceptor interceptor = getNextInterceptor( renameContext );
+
+ interceptor.rename( renameContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
+ {
+ return null;
+ }
+
+
+ /**
+ * Calls the next interceptor for the search operation.
+ *
+ * @param searchContext The context in which we are executing this operation
+ * @return the cursor containing the found entries
+ * @throws LdapException If something went wrong
+ */
+ protected final EntryFilteringCursor next( SearchOperationContext searchContext ) throws LdapException
+ {
+ Interceptor interceptor = getNextInterceptor( searchContext );
+
+ return interceptor.search( searchContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void unbind( UnbindOperationContext unbindContext ) throws LdapException
+ {
+ // Nothing to do
+ }
+
+
+ /**
+ * Compute the next interceptor for the unbind operation.
+ *
+ * @param unbindContext The context in which we are executing this operation
+ * @throws LdapException If something went wrong
+ */
+ protected final void next( UnbindOperationContext unbindContext ) throws LdapException
+ {
+ Interceptor interceptor = getNextInterceptor( unbindContext );
+
+ interceptor.unbind( unbindContext );
}
}
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/Interceptor.java Sun Nov 13 00:04:27 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;
@@ -26,8 +26,8 @@ import org.apache.directory.server.core.
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.HasEntryOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.GetRootDseOperationContext;
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;
@@ -50,7 +50,7 @@ import org.apache.directory.shared.ldap.
*
* Interceptors should usually pass the control
* of current invocation to the next interceptor by calling an appropriate method
- * on {@link NextInterceptor}. The flow control is returned when the next
+ * on {@link NextInterceptor}. The flow control is returned when the next
* interceptor's filter method returns. You can therefore implement pre-, post-,
* around- invocation handler by how you place the statement. Otherwise, you
* can transform the invocation into other(s).
@@ -114,7 +114,7 @@ public interface Interceptor
/**
* Intializes this interceptor. This is invoked by {@link InterceptorChain}
* when this intercepter is loaded into interceptor chain.
- * @throws Exception
+ * @throws Exception
*/
void init( DirectoryService directoryService ) throws LdapException;
@@ -127,89 +127,92 @@ public interface Interceptor
/**
- * Filters {@link DefaultPartitionNexus#getRootDSE( GetRootDSEOperationContext )} call.
+ * Filters {@link Partition#add( AddOperationContext )} call.
+ * @param addContext The {@link AddOperationContext} instance
+ *
+ * @throws LdapException If we had some error while processing the Add operation
*/
- Entry getRootDSE( NextInterceptor next, GetRootDSEOperationContext getRootDseContext ) throws LdapException;
+ void add( AddOperationContext addContext ) throws LdapException;
/**
- * Filters {@link DefaultPartitionNexus#compare( CompareOperationContext )} call.
+ * Filters {@link Partition#bind( BindOperationContext )} call.
*/
- boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException;
+ void bind( BindOperationContext bindContext ) throws LdapException;
/**
- * Filters {@link Partition#delete( DeleteOperationContext )} call.
+ * Filters {@link DefaultPartitionNexus#compare( CompareOperationContext )} call.
*/
- void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws LdapException;
+ boolean compare( CompareOperationContext compareContext ) throws LdapException;
/**
- * Filters {@link Partition#add( AddOperationContext )} call.
- *
- * @param next The next {@link Interceptor} in the chain
- * @param addContext The {@link AddOperationContext} instance
- * @throws LdapException If we had some error while processing the Add operation
+ * Filters {@link Partition#delete( DeleteOperationContext )} call.
*/
- void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException;
+ void delete( DeleteOperationContext deleteContext ) throws LdapException;
/**
- * Filters {@link Partition#modify( ModifyOperationContext )} call.
+ * Filters {@link DefaultPartitionNexus#getRootDse( GetRootDseOperationContext )} call.
+ *
+ * @param getRootDseContext The getRoot() operation context
+ * @return The RootDSE entry, if found
+ * @throws LdapException If we can't get back the RootDSE entry
*/
- void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException;
+ Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException;
/**
- * Filters {@link Partition#list( ListOperationContext )} call.
+ * Filters {@link Partition#hasEntry( HasEntryOperationContext )} call.
*/
- EntryFilteringCursor list( NextInterceptor next, ListOperationContext listContext ) throws LdapException;
+ boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException;
/**
- * Filters {@link Partition#search( SearchOperationContext )} call.
+ * Filters {@link Partition#list( ListOperationContext )} call.
*/
- EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext ) throws LdapException;
+ EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException;
/**
* Filters {@link Partition#lookup( LookupOperationContext )} call.
*/
- Entry lookup( NextInterceptor next, LookupOperationContext lookupContext ) throws LdapException;
+ Entry lookup( LookupOperationContext lookupContext ) throws LdapException;
/**
- * Filters {@link Partition#hasEntry( EntryOperationContext )} call.
+ * Filters {@link Partition#modify( ModifyOperationContext )} call.
*/
- boolean hasEntry( NextInterceptor next, EntryOperationContext hasEntryContext ) throws LdapException;
+ void modify( ModifyOperationContext modifyContext ) throws LdapException;
/**
- * Filters {@link Partition#rename( RenameOperationContext )} call.
+ * Filters {@link Partition#move( MoveOperationContext )} call.
*/
- void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException;
+ void move( MoveOperationContext moveContext ) throws LdapException;
/**
- * Filters {@link Partition#move( MoveOperationContext )} call.
+ * Filters {@link Partition#moveAndRename( MoveAndRenameOperationContext) } call.
*/
- void move( NextInterceptor next, MoveOperationContext moveContext ) throws LdapException;
+ void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException;
/**
- * Filters {@link Partition#moveAndRename( MoveAndRenameOperationContext) } call.
+ * Filters {@link Partition#rename( RenameOperationContext )} call.
*/
- void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException;
+ void rename( RenameOperationContext renameContext ) throws LdapException;
/**
- * Filters {@link Partition#bind( BindOperationContext )} call.
+ * Filters {@link Partition#search( SearchOperationContext )} call.
*/
- void bind( NextInterceptor next, BindOperationContext bindContext ) throws LdapException;
+ EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException;
/**
* Filters {@link Partition#unbind( UnbindOperationContext )} call.
*/
- void unbind( NextInterceptor next, UnbindOperationContext unbindContext ) throws LdapException;
+ void unbind( UnbindOperationContext unbindContext ) throws LdapException;
}
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AbstractOperationContext.java Sun Nov 13 00:04:27 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.context;
@@ -28,6 +28,7 @@ import java.util.Map;
import org.apache.directory.server.core.api.CoreSession;
import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.OperationEnum;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.entry.Modification;
@@ -48,13 +49,13 @@ public abstract class AbstractOperationC
/** The Dn associated with the context */
protected Dn dn;
-
+
/** The entry associated with the target entry of this OperationContext */
protected Entry entry;
/** The original Entry */
protected Entry originalEntry;
-
+
/** The associated request's controls */
protected Map<String, Control> requestControls = new HashMap<String, Control>(4);
@@ -63,29 +64,36 @@ public abstract class AbstractOperationC
/** the Interceptors bypassed by this operation */
protected Collection<String> byPassed;
-
+
+ /** The interceptors to call for this operation */
+ protected List<String> interceptors;
+
+ /** The current interceptor position */
+ protected int currentInterceptor;
+
protected LdapPrincipal authorizedPrincipal;
-
+
/** The core session */
protected CoreSession session;
-
+
protected OperationContext next;
-
+
protected OperationContext previous;
/** A flag used to tell if we should consider referrals as standard entries */
protected boolean throwReferral;
-
-
+
+
/**
* Creates a new instance of AbstractOperationContext.
*/
public AbstractOperationContext( CoreSession session )
{
this.session = session;
+ currentInterceptor = 0;
}
-
-
+
+
/**
* Creates a new instance of AbstractOperationContext.
*
@@ -95,8 +103,8 @@ public abstract class AbstractOperationC
{
this.dn = dn;
this.session = session;
-
- // The flag is set to ignore, so that the revert operation can act on
+
+ // The flag is set to ignore, so that the revert operation can act on
// the entries, even if they are referrals.
ignoreReferral();
}
@@ -106,14 +114,14 @@ public abstract class AbstractOperationC
{
return session;
}
-
-
+
+
public void setSession( CoreSession session )
{
this.session = session;
}
-
-
+
+
protected void setAuthorizedPrincipal( LdapPrincipal authorizedPrincipal )
{
this.authorizedPrincipal = authorizedPrincipal;
@@ -128,7 +136,7 @@ public abstract class AbstractOperationC
return dn;
}
-
+
/**
* Set the context Dn
*
@@ -139,25 +147,25 @@ public abstract class AbstractOperationC
this.dn = dn;
}
-
+
public void addRequestControl( Control requestControl )
{
requestControls.put( requestControl.getOid(), requestControl );
}
-
+
public Control getRequestControl( String numericOid )
{
return requestControls.get( numericOid );
}
-
+
public boolean hasRequestControl( String numericOid )
{
return requestControls.containsKey( numericOid );
}
-
+
public boolean hasRequestControls()
{
return ! requestControls.isEmpty();
@@ -188,7 +196,7 @@ public abstract class AbstractOperationC
{
return EMPTY_CONTROLS;
}
-
+
return responseControls.values().toArray( EMPTY_CONTROLS );
}
@@ -213,13 +221,13 @@ public abstract class AbstractOperationC
}
}
-
+
public void setRequestControls( Map<String, Control> requestControls )
{
this.requestControls = requestControls;
}
-
+
/**
* @return the operation name
*/
@@ -255,11 +263,37 @@ public abstract class AbstractOperationC
{
return Collections.emptyList();
}
-
+
return Collections.unmodifiableCollection( byPassed );
}
-
-
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public final void setInterceptors( List<String> interceptors )
+ {
+ this.interceptors = interceptors;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public final String getNextInterceptor()
+ {
+ if ( currentInterceptor == interceptors.size() )
+ {
+ return "FINAL";
+ }
+
+ String interceptor = interceptors.get( currentInterceptor );
+ currentInterceptor++;
+
+ return interceptor;
+ }
+
+
/**
* Sets the set of bypassed Interceptors.
*
@@ -270,7 +304,7 @@ public abstract class AbstractOperationC
this.byPassed = byPassed;
}
-
+
/**
* Checks to see if an Interceptor is bypassed for this operation.
*
@@ -293,25 +327,18 @@ public abstract class AbstractOperationC
return byPassed != null && !byPassed.isEmpty();
}
-
+
private void setup( AbstractOperationContext opContext )
{
opContext.setPreviousOperation( this );
next = opContext;
- opContext.setByPassed( byPassed );
opContext.setAuthorizedPrincipal( authorizedPrincipal );
}
-
-
- public boolean hasEntry( Dn dn, Collection<String> byPassed ) throws LdapException
- {
- EntryOperationContext hasEntryContext = new EntryOperationContext( session, dn );
- setup( hasEntryContext );
- hasEntryContext.setByPassed( byPassed );
- return session.getDirectoryService().getOperationManager().hasEntry( hasEntryContext );
- }
-
-
+
+
+ /**
+ * {@inheritDoc}
+ */
public void add( Entry entry, Collection<String> byPassed ) throws LdapException
{
AddOperationContext addContext = new AddOperationContext( session, entry );
@@ -319,32 +346,29 @@ public abstract class AbstractOperationC
addContext.setByPassed( byPassed );
session.getDirectoryService().getOperationManager().add( addContext );
}
-
-
- public void delete( Dn dn, Collection<String> byPassed ) throws LdapException
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void delete( Dn dn ) throws LdapException
{
DeleteOperationContext deleteContext = new DeleteOperationContext( session, dn );
setup( deleteContext );
- deleteContext.setByPassed( byPassed );
session.getDirectoryService().getOperationManager().delete( deleteContext );
}
-
-
- public void modify( Dn dn, List<Modification> mods, Collection<String> byPassed ) throws LdapException
- {
- ModifyOperationContext modifyContext = new ModifyOperationContext( session, dn, mods );
- setup( modifyContext );
- modifyContext.setByPassed( byPassed );
- session.getDirectoryService().getOperationManager().modify( modifyContext );
- }
-
-
- // TODO - need synchronization here and where we update links
- public LookupOperationContext newLookupContext( Dn dn )
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasEntry( Dn dn, Collection<String> byPassed ) throws LdapException
{
- LookupOperationContext lookupContext = new LookupOperationContext( session, dn );
- setup( lookupContext );
- return lookupContext;
+ HasEntryOperationContext hasEntryContext = new HasEntryOperationContext( session, dn );
+ setup( hasEntryContext );
+ hasEntryContext.setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.HAS_ENTRY ) );
+
+ return session.getDirectoryService().getOperationManager().hasEntry( hasEntryContext );
}
@@ -354,7 +378,7 @@ public abstract class AbstractOperationC
{
throw new IllegalStateException( I18n.err( I18n.ERR_319 ) );
}
-
+
return session.getDirectoryService().getOperationManager().lookup( lookupContext );
}
@@ -374,70 +398,86 @@ public abstract class AbstractOperationC
lookupContext.setAttrsId( attrIds );
return session.getDirectoryService().getOperationManager().lookup( lookupContext );
}
-
+
+ public void modify( Dn dn, List<Modification> mods, Collection<String> byPassed ) throws LdapException
+ {
+ ModifyOperationContext modifyContext = new ModifyOperationContext( session, dn, mods );
+ setup( modifyContext );
+ modifyContext.setByPassed( byPassed );
+ session.getDirectoryService().getOperationManager().modify( modifyContext );
+ }
+
+
+ // TODO - need synchronization here and where we update links
+ public LookupOperationContext newLookupContext( Dn dn )
+ {
+ LookupOperationContext lookupContext = new LookupOperationContext( session, dn );
+ setup( lookupContext );
+ return lookupContext;
+ }
public LdapPrincipal getEffectivePrincipal()
{
if ( authorizedPrincipal != null )
{
return authorizedPrincipal;
}
-
+
return session.getEffectivePrincipal();
}
-
-
+
+
// -----------------------------------------------------------------------
// OperationContext Linked List Methods
// -----------------------------------------------------------------------
-
-
+
+
public boolean isFirstOperation()
{
return previous == null;
}
-
-
+
+
public OperationContext getFirstOperation()
{
if ( previous == null )
{
return this;
}
-
+
return previous.getFirstOperation();
}
-
-
+
+
public OperationContext getLastOperation()
{
if ( next == null )
{
return this;
}
-
+
return next.getLastOperation();
}
-
-
+
+
public OperationContext getNextOperation()
{
return next;
}
-
-
+
+
protected void setNextOperation( OperationContext next )
{
this.next = next;
}
-
-
+
+
public OperationContext getPreviousOperation()
{
return previous;
}
-
-
+
+
protected void setPreviousOperation( OperationContext previous )
{
this.previous = previous;
@@ -460,8 +500,8 @@ public abstract class AbstractOperationC
{
return entry;
}
-
-
+
+
/**
* Set the throwReferral flag to true
*/
@@ -469,8 +509,8 @@ public abstract class AbstractOperationC
{
throwReferral = true;
}
-
-
+
+
/**
* @return <code>true</code> if the referrals are thrown
*/
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AddOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AddOperationContext.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AddOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/AddOperationContext.java Sun Nov 13 00:04:27 2011
@@ -6,21 +6,22 @@
* 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.context;
import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.OperationEnum;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
@@ -42,49 +43,69 @@ public class AddOperationContext extends
/**
* Creates a new instance of AddOperationContext.
*
- * @param session the current Session
+ * @param session the current Session
*/
public AddOperationContext( CoreSession session )
{
super( session );
+
+ if ( session != null )
+ {
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.ADD ) );
+ }
}
/**
* Creates a new instance of AddOperationContext.
*
- * @param session the current Session
+ * @param session the current Session
* @param dn the name of the entry being added
*/
public AddOperationContext( CoreSession session, Dn dn )
{
super( session, dn );
+
+ if ( session != null )
+ {
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.ADD ) );
+ }
}
/**
* Creates a new instance of AddOperationContext.
*
- * @param session the current Session
+ * @param session the current Session
* @param entry the entry being added
*/
public AddOperationContext( CoreSession session, Entry entry )
{
super( session, entry.getDn() );
this.entry = new ClonedServerEntry( entry );
+ if ( session != null )
+ {
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.ADD ) );
+ }
}
/**
* Creates a new instance of ModifyOperationContext.
*
- * @param session the current Session
+ * @param session the current Session
* @param dn the name of the entry being added
* @param entry the entry being added
*/
public AddOperationContext( CoreSession session, Dn dn, Entry entry )
{
super( session, dn );
+
+ if ( session != null )
+ {
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.ADD ) );
+ }
+
this.entry = new ClonedServerEntry( entry );
}
@@ -92,11 +113,17 @@ public class AddOperationContext extends
public AddOperationContext( CoreSession session, AddRequest addRequest ) throws LdapException
{
super( session );
- entry = new ClonedServerEntry(
+
+ if ( session != null )
+ {
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.ADD ) );
+ }
+
+ entry = new ClonedServerEntry(
new DefaultEntry( session.getDirectoryService().getSchemaManager(), addRequest.getEntry() ) );
dn = addRequest.getEntry().getDn();
requestControls = addRequest.getControls();
-
+
if ( requestControls.containsKey( ManageDsaIT.OID ) )
{
ignoreReferral();
@@ -116,7 +143,7 @@ public class AddOperationContext extends
return MessageTypeEnum.ADD_REQUEST.name();
}
-
+
/**
* @see Object#toString()
*/
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/BindOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/BindOperationContext.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/BindOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/BindOperationContext.java Sun Nov 13 00:04:27 2011
@@ -6,22 +6,23 @@
* 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.context;
-
+
import org.apache.commons.lang.NotImplementedException;
import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.OperationEnum;
import org.apache.directory.server.core.api.ReferralHandlingMode;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
@@ -49,28 +50,33 @@ public class BindOperationContext extend
/** The SASL mechanism */
private String saslMechanism;
-
+
/** The SASL identifier */
private String saslAuthId;
-
+
/** A flag to tell that this is a collateral operation */
private boolean collateralOperation;
-
+
private ReferralHandlingMode referralHandlingMode;
-
+
/** The IoSession if any */
private IoSession ioSession;
-
+
/**
* Creates a new instance of BindOperationContext.
*/
public BindOperationContext( CoreSession session )
{
super( session );
+
+ if ( session != null )
+ {
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.BIND ) );
+ }
}
-
+
/**
* @return The authentication level. One of :
* <li>ANONYMOUS</li>
@@ -85,7 +91,7 @@ public class BindOperationContext extend
if ( ( saslMechanism == null ) )
{
// No, it's either a SIMPLE, ANONYMOUS, UNAUTHENT or an error
- //
+ //
if ( dn.isEmpty() )
{
if ( Strings.isEmpty(credentials) )
@@ -114,8 +120,8 @@ public class BindOperationContext extend
return AuthenticationLevel.STRONG;
}
}
-
-
+
+
/**
* @return the SASL mechanisms
*/
@@ -124,13 +130,13 @@ public class BindOperationContext extend
return saslMechanism;
}
-
+
public void setSaslMechanism( String saslMechanism )
{
this.saslMechanism = saslMechanism;
}
-
+
/**
* @return The principal password
*/
@@ -139,13 +145,13 @@ public class BindOperationContext extend
return credentials;
}
-
+
public void setCredentials( byte[] credentials )
{
this.credentials = credentials;
}
-
+
/**
* @return The SASL authentication ID
*/
@@ -159,14 +165,14 @@ public class BindOperationContext extend
{
this.saslAuthId = saslAuthId;
}
-
-
+
+
public boolean isSaslBind()
{
return saslMechanism != null;
}
-
-
+
+
/**
* @return the operation name
*/
@@ -223,8 +229,8 @@ public class BindOperationContext extend
{
throw new NotImplementedException( I18n.err( I18n.ERR_320 ) );
}
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/CompareOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/CompareOperationContext.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/CompareOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/CompareOperationContext.java Sun Nov 13 00:04:27 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/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/DeleteOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/DeleteOperationContext.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/DeleteOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/DeleteOperationContext.java Sun Nov 13 00:04:27 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.Entry;
import org.apache.directory.shared.ldap.model.message.DeleteRequest;
import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
@@ -42,6 +43,7 @@ public class DeleteOperationContext exte
public DeleteOperationContext( CoreSession session )
{
super( session );
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.DELETE ) );
}
@@ -53,12 +55,14 @@ public class DeleteOperationContext exte
public DeleteOperationContext( CoreSession session, Dn deleteDn )
{
super( session, deleteDn );
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.DELETE ) );
}
public DeleteOperationContext( CoreSession session, DeleteRequest deleteRequest )
{
super( session, deleteRequest.getName() );
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.DELETE ) );
requestControls = deleteRequest.getControls();
if ( requestControls.containsKey( ManageDsaIT.OID ) )
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ListOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ListOperationContext.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ListOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/ListOperationContext.java Sun Nov 13 00:04:27 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.context;
@@ -23,6 +23,7 @@ package org.apache.directory.server.core
import java.util.Set;
import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.OperationEnum;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
@@ -41,6 +42,7 @@ public class ListOperationContext extend
public ListOperationContext( CoreSession session )
{
super( session );
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LIST ) );
}
@@ -52,6 +54,7 @@ public class ListOperationContext extend
public ListOperationContext( CoreSession session, Dn dn )
{
super( session, dn );
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LIST ) );
}
@@ -66,6 +69,7 @@ public class ListOperationContext extend
public ListOperationContext( CoreSession session, Dn dn, Set<AttributeTypeOptions> returningAttributes )
{
super( session, dn, returningAttributes );
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LIST ) );
}
@@ -77,7 +81,7 @@ public class ListOperationContext extend
return "List";
}
-
+
/**
* @see Object#toString()
*/
Modified: directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/LookupOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/LookupOperationContext.java?rev=1201365&r1=1201364&r2=1201365&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/LookupOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-osgi/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/context/LookupOperationContext.java Sun Nov 13 00:04:27 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.context;
@@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.List;
import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.OperationEnum;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.util.Strings;
@@ -62,6 +63,11 @@ public class LookupOperationContext exte
public LookupOperationContext( CoreSession session )
{
super( session );
+
+ if ( session != null )
+ {
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LOOKUP ) );
+ }
}
@@ -73,6 +79,11 @@ public class LookupOperationContext exte
public LookupOperationContext( CoreSession session, Dn dn )
{
super( session, dn );
+
+ if ( session != null )
+ {
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LOOKUP ) );
+ }
}
@@ -85,6 +96,11 @@ public class LookupOperationContext exte
{
super( session );
setAttrsId( attrsId );
+
+ if ( session != null )
+ {
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LOOKUP ) );
+ }
}
@@ -97,6 +113,11 @@ public class LookupOperationContext exte
{
super( session, dn );
setAttrsId( attrsId );
+
+ if ( session != null )
+ {
+ setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.LOOKUP ) );
+ }
}
@@ -128,7 +149,7 @@ public class LookupOperationContext exte
{
this.attrsId = new ArrayList<String>( Arrays.asList( attrsId ) );
- // filter out the '+' and '*' and set boolean parameters
+ // filter out the '+' and '*' and set boolean parameters
for ( String id : this.attrsId )
{
if ( id.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )