removing core-interceptor project because it was pointless trying to make the separation from core-api which we could not delete the packages from
git-svn-id: https://svn.apache.org/repos/asf/directory/apacheds/branches/ldif-partition@764362 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/avl-partition/pom.xml b/avl-partition/pom.xml
index f5ec818..9dbef65 100644
--- a/avl-partition/pom.xml
+++ b/avl-partition/pom.xml
@@ -49,12 +49,6 @@
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-core-interceptor</artifactId>
- <version>${pom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-api</artifactId>
<version>${pom.version}</version>
</dependency>
diff --git a/core-interceptor/pom.xml b/core-interceptor/pom.xml
deleted file mode 100644
index 4ffb31e..0000000
--- a/core-interceptor/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-parent</artifactId>
- <version>1.5.5-SNAPSHOT</version>
- </parent>
- <artifactId>apacheds-core-interceptor</artifactId>
- <name>ApacheDS Core Interceptor</name>
- <packaging>jar</packaging>
-
- <description>
- Contains Interceptor interface for creating interceptors.
- </description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-core-api</artifactId>
- <version>${pom.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>verify</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
-
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
deleted file mode 100644
index d69bdee..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor;
-
-
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.LdapPrincipal;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.filtering.EntryFilteringCursor;
-import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.OperationContext;
-import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
-import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
-import org.apache.directory.server.core.invocation.InvocationStack;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-import javax.naming.Context;
-import java.util.Set;
-
-
-/**
- * A easy-to-use implementation of {@link Interceptor}. All methods are
- * implemented to pass the flow of control to next interceptor by defaults.
- * Please override the methods you have concern in.
- *
- * @org.apache.xbean.XBean
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public abstract class BaseInterceptor implements Interceptor
-{
- /**
- * 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().getName();
- }
-
- /**
- * TODO delete this since it uses static access
- * Returns {@link LdapPrincipal} of current context.
- * @return the authenticated principal
- */
- public static LdapPrincipal getPrincipal()
- {
- return getContext().getSession().getEffectivePrincipal();
- }
-
-
- /**
- * TODO delete this since it uses static access
- * Returns the current JNDI {@link Context}.
- * @return the context on the invocation stack
- */
- public static OperationContext getContext()
- {
- return InvocationStack.getInstance().peek();
- }
-
-
- /**
- * Creates a new instance.
- */
- protected BaseInterceptor()
- {
- }
-
-
- /**
- * This method does nothing by default.
- * @throws Exception
- */
- public void init( DirectoryService directoryService ) throws Exception
- {
- }
-
-
- /**
- * This method does nothing by default.
- */
- public void destroy()
- {
- }
-
-
- // ------------------------------------------------------------------------
- // Interceptor's Invoke Method
- // ------------------------------------------------------------------------
-
- public void add( NextInterceptor next, AddOperationContext opContext ) throws Exception
- {
- next.add( opContext );
- }
-
-
- public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
- {
- next.delete( opContext );
- }
-
-
- public LdapDN getMatchedName ( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws Exception
- {
- return next.getMatchedName( opContext );
- }
-
-
- public ClonedServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext opContext ) throws Exception
- {
- return next.getRootDSE( opContext );
- }
-
-
- public LdapDN getSuffix( NextInterceptor next, GetSuffixOperationContext opContext ) throws Exception
- {
- return next.getSuffix( opContext );
- }
-
-
- public boolean hasEntry( NextInterceptor next, EntryOperationContext opContext ) throws Exception
- {
- return next.hasEntry( opContext );
- }
-
-
- public EntryFilteringCursor list( NextInterceptor next, ListOperationContext opContext ) throws Exception
- {
- return next.list( opContext );
- }
-
-
- public Set<String> listSuffixes ( NextInterceptor next, ListSuffixOperationContext opContext )
- throws Exception
- {
- return next.listSuffixes( opContext );
- }
-
-
- public ClonedServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws Exception
- {
- return next.lookup( opContext );
- }
-
-
- public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
- {
- next.modify( opContext );
- }
-
-
- public void rename( NextInterceptor next, RenameOperationContext opContext ) throws Exception
- {
- next.rename( opContext );
- }
-
-
- public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext )
- throws Exception
- {
- next.moveAndRename( opContext );
- }
-
-
- public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
- {
- next.move( opContext );
- }
-
-
- public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext ) throws Exception
- {
- return next.search( opContext );
- }
-
-
- public void addContextPartition( NextInterceptor next, AddContextPartitionOperationContext opContext ) throws Exception
- {
- next.addContextPartition( opContext );
- }
-
-
- public void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext ) throws Exception
- {
- next.removeContextPartition( opContext );
- }
-
-
- public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws Exception
- {
- return next.compare( opContext );
- }
-
-
- public void bind( NextInterceptor next, BindOperationContext opContext ) throws Exception
- {
- next.bind( opContext );
- }
-
-
- public void unbind( NextInterceptor next, UnbindOperationContext opContext ) throws Exception
- {
- next.unbind( opContext );
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
deleted file mode 100644
index d0071bb..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor;
-
-
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.filtering.EntryFilteringCursor;
-import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
-import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
-import org.apache.directory.server.core.partition.Partition;
-import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-import java.util.Set;
-
-
-/**
- * Filters invocations on {@link PartitionNexus}. {@link Interceptor}
- * filters most method calls performed on {@link PartitionNexus} just
- * like Servlet filters do.
- * <p/>
- * <h2>Interceptor Chaining</h2>
- *
- * 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
- * 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).
- * <p/>
- * <h3>Pre-invocation Filtering</h3>
- * <pre>
- * public void delete( NextInterceptor nextInterceptor, Name name )
- * {
- * System.out.println( "Starting invocation." );
- * nextInterceptor.delete( name );
- * }
- * </pre>
- * <p/>
- * <h3>Post-invocation Filtering</h3>
- * <pre>
- * public void delete( NextInterceptor nextInterceptor, Name name )
- * {
- * nextInterceptor.delete( name );
- * System.out.println( "Invocation ended." );
- * }
- * </pre>
- * <p/>
- * <h3>Around-invocation Filtering</h3>
- * <pre>
- * public void delete( NextInterceptor nextInterceptor, Name name )
- * {
- * long startTime = System.currentTimeMillis();
- * try
- * {
- * nextInterceptor.delete( name );
- * }
- * finally
- * {
- * long endTime = System.currentTimeMillis();
- * System.out.println( ( endTime - startTime ) + "ms elapsed." );
- * }
- * }
- * </pre>
- * <p/>
- * <h3>Transforming invocations</h3>
- * <pre>
- * public void delete( NextInterceptor nextInterceptor, Name name )
- * {
- * // transform deletion into modification.
- * Attribute mark = new AttributeImpl( "entryDeleted", "true" );
- * nextInterceptor.modify( name, DirIteratorContext.REPLACE_ATTRIBUTE, mark );
- * }
- * </pre>
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- * @see NextInterceptor
- */
-public interface Interceptor
-{
- /**
- * Name that must be unique in an interceptor chain
- * @return name of this interceptor, must be unique in an interceptor chain.
- */
- String getName();
-
- /**
- * Intializes this interceptor. This is invoked by {@link InterceptorChain}
- * when this intercepter is loaded into interceptor chain.
- * @throws Exception
- */
- void init( DirectoryService directoryService ) throws Exception;
-
-
- /**
- * Deinitializes this interceptor. This is invoked by {@link InterceptorChain}
- * when this intercepter is unloaded from interceptor chain.
- */
- void destroy();
-
-
- /**
- * Filters {@link PartitionNexus#getRootDSE( GetRootDSEOperationContext )} call.
- */
- ClonedServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link PartitionNexus#getMatchedName( GetMatchedNameOperationContext )} call.
- */
- LdapDN getMatchedName( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link PartitionNexus#getSuffix( GetSuffixOperationContext )} call.
- */
- LdapDN getSuffix ( NextInterceptor next, GetSuffixOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link PartitionNexus#listSuffixes( ListSuffixOperationContext )} call.
- */
- Set<String> listSuffixes( NextInterceptor next, ListSuffixOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link PartitionNexus#addContextPartition( AddContextPartitionOperationContext )} call.
- */
- void addContextPartition( NextInterceptor next, AddContextPartitionOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link PartitionNexus#removeContextPartition( RemoveContextPartitionOperationContext )} call.
- */
- void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link PartitionNexus#compare( CompareOperationContext )} call.
- */
- boolean compare( NextInterceptor next, CompareOperationContext opContext) throws Exception;
-
-
- /**
- * Filters {@link Partition#delete( DeleteOperationContext )} call.
- */
- void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link Partition#add( AddOperationContext )} call.
- */
- void add( NextInterceptor next, AddOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link Partition#modify( ModifyOperationContext )} call.
- */
- void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link Partition#list( ListOperationContext )} call.
- */
- EntryFilteringCursor list( NextInterceptor next, ListOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link Partition#search( SearchOperationContext )} call.
- */
- EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link Partition#lookup( LookupOperationContext )} call.
- */
- ClonedServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link Partition#hasEntry( EntryOperationContext )} call.
- */
- boolean hasEntry( NextInterceptor next, EntryOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link Partition#rename( RenameOperationContext )} call.
- */
- void rename( NextInterceptor next, RenameOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link Partition#move( MoveOperationContext )} call.
- */
- void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception;
-
-
- /**
- * Filters {@link Partition#moveAndRename( MoveAndRenameOperationContext) } call.
- */
- void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext )
- throws Exception;
-
- /**
- * Filters {@link Partition#bind( BindOperationContext )} call.
- */
- void bind( NextInterceptor next, BindOperationContext opContext )
- throws Exception;
-
- /**
- * Filters {@link Partition#unbind( UnbindOperationContext )} call.
- */
- void unbind( NextInterceptor next, UnbindOperationContext opContext ) throws Exception;
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
deleted file mode 100644
index fd3e980..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
+++ /dev/null
@@ -1,1464 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.filtering.EntryFilteringCursor;
-import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.OperationContext;
-import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
-import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
-import org.apache.directory.server.core.invocation.InvocationStack;
-import org.apache.directory.server.core.partition.ByPassConstants;
-import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Manages the chain of {@link Interceptor}s.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class InterceptorChain
-{
- private static final Logger LOG = LoggerFactory.getLogger( InterceptorChain.class );
-
- /** Speedup for logs */
- private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
- 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
- }
-
-
- public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws Exception
- {
- return nexus.compare( opContext );
- }
-
-
- public ClonedServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext opContext ) throws Exception
- {
- return nexus.getRootDSE( opContext );
- }
-
-
- public LdapDN getMatchedName( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws Exception
- {
- return ( LdapDN ) nexus.getMatchedName( opContext ).clone();
- }
-
-
- public LdapDN getSuffix( NextInterceptor next, GetSuffixOperationContext opContext ) throws Exception
- {
- return ( LdapDN ) nexus.getSuffix( opContext ).clone();
- }
-
-
- public Set<String> listSuffixes( NextInterceptor next, ListSuffixOperationContext opContext ) throws Exception
- {
- return nexus.listSuffixes( opContext );
- }
-
-
- public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
- {
- nexus.delete( opContext );
- }
-
-
- public void add( NextInterceptor next, AddOperationContext opContext ) throws Exception
- {
- nexus.add( opContext );
- }
-
-
- public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
- {
- nexus.modify( opContext );
- }
-
-
- public EntryFilteringCursor list( NextInterceptor next, ListOperationContext opContext ) throws Exception
- {
- return nexus.list( opContext );
- }
-
-
- public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext ) throws Exception
- {
- return nexus.search( opContext );
- }
-
-
- public ClonedServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws Exception
- {
- return nexus.lookup( opContext );
- }
-
-
- public boolean hasEntry( NextInterceptor next, EntryOperationContext opContext ) throws Exception
- {
- return nexus.hasEntry( opContext );
- }
-
-
- public void rename( NextInterceptor next, RenameOperationContext opContext )
- throws Exception
- {
- nexus.rename( opContext );
- }
-
-
- public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
- {
- nexus.move( opContext );
- }
-
-
- public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext )
- throws Exception
- {
- nexus.moveAndRename( opContext );
- }
-
-
- public void addContextPartition( NextInterceptor next, AddContextPartitionOperationContext opContext )
- throws Exception
- {
- nexus.addContextPartition( opContext );
- }
-
-
- public void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext ) throws Exception
- {
- nexus.removeContextPartition( opContext );
- }
-
-
- public void bind( NextInterceptor next, BindOperationContext opContext ) throws Exception
- {
- nexus.bind( opContext );
- }
-
-
- public void unbind( NextInterceptor next, UnbindOperationContext opContext ) throws Exception
- {
- nexus.unbind( opContext );
- }
- };
-
- private final Map<String, Entry> name2entry = new HashMap<String, Entry>();
-
- private final Entry tail;
-
- private Entry head;
-
- private DirectoryService directoryService;
-
-
- /**
- * Create a new interceptor chain.
- */
- public InterceptorChain()
- {
- tail = new Entry( "tail", null, null, FINAL_INTERCEPTOR );
- head = tail;
- }
-
-
- /**
- * Initializes and registers all interceptors according to the specified
- * {@link DirectoryService}.
- * @throws javax.naming.Exception if an interceptor cannot be initialized.
- * @param directoryService the directory core
- */
- public synchronized void init( DirectoryService directoryService ) throws Exception
- {
- // Initialize tail first.
- this.directoryService = directoryService;
- FINAL_INTERCEPTOR.init( directoryService );
-
- // And register and initialize all interceptors
- try
- {
- for ( Interceptor interceptor: directoryService.getInterceptors() )
- {
- if ( IS_DEBUG )
- {
- LOG.debug( "Adding interceptor " + interceptor.getName() );
- }
-
- register( interceptor );
- }
- }
- catch ( Throwable t )
- {
- // destroy if failed to initialize all interceptors.
- destroy();
-
- if ( t instanceof Exception )
- {
- throw ( Exception ) t;
- }
- else
- {
- throw new InterceptorException( null, "Failed to initialize interceptor chain.", t );
- }
- }
- }
-
-
- /**
- * Deinitializes and deregisters all interceptors this chain contains.
- */
- public synchronized void destroy()
- {
- List<Entry> entries = new ArrayList<Entry>();
- Entry e = tail;
-
- do
- {
- entries.add( e );
- e = e.prevEntry;
- }
- while ( e != null );
-
- for ( Entry entry:entries )
- {
- if ( entry != tail )
- {
- try
- {
- deregister( entry.getName() );
- }
- catch ( Throwable t )
- {
- LOG.warn( "Failed to deregister an interceptor: " + entry.getName(), t );
- }
- }
- }
- }
-
-
- /**
- * Returns the registered interceptor with the specified name.
- * @param interceptorName name of the interceptor to look for
- * @return <tt>null</tt> if the specified name doesn't exist.
- */
- public Interceptor get( String interceptorName )
- {
- Entry e = name2entry.get( interceptorName );
- if ( e == null )
- {
- return null;
- }
-
- return e.interceptor;
- }
-
-
- /**
- * Returns the list of all registered interceptors.
- * @return a list of all the registered interceptors.
- */
- public synchronized List<Interceptor> getAll()
- {
- List<Interceptor> result = new ArrayList<Interceptor>();
- Entry e = head;
-
- do
- {
- result.add( e.interceptor );
- e = e.nextEntry;
- }
- while ( e != tail );
-
- return result;
- }
-
-
- public synchronized void addFirst( Interceptor interceptor ) throws Exception
- {
- register0( interceptor, head );
- }
-
-
- public synchronized void addLast( Interceptor interceptor ) throws Exception
- {
- register0( interceptor, tail );
- }
-
-
- public synchronized void addBefore( String nextInterceptorName, Interceptor interceptor )
- throws Exception
- {
- Entry e = name2entry.get( nextInterceptorName );
- if ( e == null )
- {
- throw new ConfigurationException( "Interceptor not found: " + nextInterceptorName );
- }
- register0( interceptor, e );
- }
-
-
- public synchronized String remove( String interceptorName ) throws Exception
- {
- return deregister( interceptorName );
- }
-
-
- public synchronized void addAfter( String prevInterceptorName, Interceptor interceptor )
- throws Exception
- {
- Entry e = name2entry.get( prevInterceptorName );
- if ( e == null )
- {
- throw new ConfigurationException( "Interceptor not found: " + prevInterceptorName );
- }
- register0( interceptor, e.nextEntry );
- }
-
-
- /**
- * Adds and initializes an interceptor with the specified configuration.
- * @param interceptor interceptor to add to end of chain
- * @throws javax.naming.Exception if there is already an interceptor of this name or the interceptor
- * cannot be initialized.
- */
- private void register( Interceptor interceptor ) throws Exception
- {
- checkAddable( interceptor );
- register0( interceptor, tail );
- }
-
-
- /**
- * Removes and deinitializes the interceptor with the specified name.
- * @param name name of interceptor to remove
- * @return name of interceptor removed, if any
- * @throws javax.naming.ConfigurationException if no interceptor registered under that name
- */
- private String deregister( String name ) throws ConfigurationException
- {
- Entry entry = checkOldName( name );
- Entry prevEntry = entry.prevEntry;
- Entry nextEntry = entry.nextEntry;
-
- if ( nextEntry == null )
- {
- // Don't deregister tail
- return null;
- }
-
- if ( prevEntry == null )
- {
- nextEntry.prevEntry = null;
- head = nextEntry;
- }
- else
- {
- prevEntry.nextEntry = nextEntry;
- nextEntry.prevEntry = prevEntry;
- }
-
- name2entry.remove( name );
- entry.interceptor.destroy();
-
- return entry.getName();
- }
-
-
- private void register0( Interceptor interceptor, Entry nextEntry ) throws Exception
- {
- String name = interceptor.getName();
-
- interceptor.init( directoryService );
- Entry newEntry;
- if ( nextEntry == head )
- {
- newEntry = new Entry( interceptor.getName(), null, head, interceptor );
- head.prevEntry = newEntry;
- head = newEntry;
- }
- else if ( head == tail )
- {
- newEntry = new Entry( interceptor.getName(), null, tail, interceptor );
- tail.prevEntry = newEntry;
- head = newEntry;
- }
- else
- {
- newEntry = new Entry( interceptor.getName(), nextEntry.prevEntry, nextEntry, interceptor );
- nextEntry.prevEntry.nextEntry = newEntry;
- nextEntry.prevEntry = newEntry;
- }
-
- name2entry.put( name, newEntry );
- }
-
-
- /**
- * Throws an exception when the specified interceptor name is not registered in this chain.
- *
- * @param name name of interceptor to look for
- * @return An interceptor entry with the specified name.
- * @throws javax.naming.ConfigurationException if no interceptor has that name
- */
- private Entry checkOldName( String name ) throws ConfigurationException
- {
- Entry e = name2entry.get( name );
-
- if ( e == null )
- {
- throw new ConfigurationException( "Unknown interceptor name:" + name );
- }
-
- return e;
- }
-
-
- /**
- * Checks the specified interceptor name is already taken and throws an exception if already taken.
- * @param interceptor interceptor to check
- * @throws javax.naming.ConfigurationException if interceptor name is already registered
- */
- private void checkAddable( Interceptor interceptor ) throws ConfigurationException
- {
- if ( name2entry.containsKey( interceptor.getName() ) )
- {
- throw new ConfigurationException( "Other interceptor is using name '" + interceptor.getName() + "'" );
- }
- }
-
-
- /**
- * Gets the InterceptorEntry to use first with bypass information considered.
- *
- * @return the first entry to use.
- */
- private Entry getStartingEntry()
- {
- if ( InvocationStack.getInstance().isEmpty() )
- {
- return head;
- }
-
- OperationContext opContext = InvocationStack.getInstance().peek();
-
- if ( !opContext.hasBypass() )
- {
- return head;
- }
-
- if ( opContext.isBypassed( ByPassConstants.BYPASS_ALL ) )
- {
- return tail;
- }
-
- Entry next = head;
-
- while ( next != tail )
- {
- if ( opContext.isBypassed( next.getName() ) )
- {
- next = next.nextEntry;
- }
- else
- {
- return next;
- }
- }
-
- return tail;
- }
-
-
- public ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
-
- try
- {
- return head.getRootDSE( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public LdapDN getMatchedName( GetMatchedNameOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
-
- try
- {
- return head.getMatchedName( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public LdapDN getSuffix( GetSuffixOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
-
- try
- {
- return head.getSuffix( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public boolean compare( CompareOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
-
- try
- {
- return head.compare( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public Set<String> listSuffixes( ListSuffixOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
-
- try
- {
- return head.listSuffixes( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public void addContextPartition( AddContextPartitionOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
-
- try
- {
- head.addContextPartition( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public void removeContextPartition( RemoveContextPartitionOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
-
- try
- {
- head.removeContextPartition( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- 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
- * redundant lookup operation.
- *
- * @param opContext the operation context to populate with cached fields
- */
- private void eagerlyPopulateFields( OperationContext opContext )
- {
- // If the entry field is not set for ops other than add for example
- // then we set the entry but don't freak if we fail to do so since it
- // may not exist in the first place
-
- if ( opContext.getEntry() == null )
- {
- try
- {
- // 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();
- opContext.setEntry( adminSession.lookup( opContext.getDn(), SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES_ARRAY ) );
- }
- catch ( Exception e )
- {
- // might not exist
- }
- }
- }
-
-
- public void delete( DeleteOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
- eagerlyPopulateFields( opContext );
-
- try
- {
- head.delete( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- }
- }
-
-
- public void add( AddOperationContext opContext ) throws Exception
- {
- Entry node = getStartingEntry();
- Interceptor head = node.interceptor;
- NextInterceptor next = node.nextInterceptor;
-
- try
- {
- head.add( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- }
- }
-
-
- public void bind( BindOperationContext opContext ) throws Exception
- {
- Entry node = getStartingEntry();
- Interceptor head = node.interceptor;
- NextInterceptor next = node.nextInterceptor;
- eagerlyPopulateFields( opContext );
-
- try
- {
- head.bind( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- }
- }
-
-
- public void unbind( UnbindOperationContext opContext ) throws Exception
- {
- Entry node = getStartingEntry();
- Interceptor head = node.interceptor;
- NextInterceptor next = node.nextInterceptor;
-
- try
- {
- head.unbind( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- }
- }
-
-
- public void modify( ModifyOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
- eagerlyPopulateFields( opContext );
-
- try
- {
- head.modify( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- }
- }
-
-
- public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
- eagerlyPopulateFields( opContext );
-
- try
- {
- return head.list( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public EntryFilteringCursor search( SearchOperationContext opContext )
- throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
- eagerlyPopulateFields( opContext );
-
- try
- {
- return head.search( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
-
- try
- {
- return head.lookup( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public boolean hasEntry( EntryOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
-
- try
- {
- return head.hasEntry( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public void rename( RenameOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
- eagerlyPopulateFields( opContext );
-
- try
- {
- head.rename( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- }
- }
-
-
- public void move( MoveOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
- eagerlyPopulateFields( opContext );
-
- try
- {
- head.move( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- }
- }
-
-
- public void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception
- {
- Entry entry = getStartingEntry();
- Interceptor head = entry.interceptor;
- NextInterceptor next = entry.nextInterceptor;
- eagerlyPopulateFields( opContext );
-
- try
- {
- head.moveAndRename( next, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( head, e );
- }
- }
-
- /**
- * Represents an internal entry of this chain.
- */
- private class Entry
- {
- private volatile Entry prevEntry;
-
- private volatile Entry nextEntry;
-
- private final String name;
-
- private final Interceptor interceptor;
-
- private final NextInterceptor nextInterceptor;
-
-
- private String getName()
- {
- return name;
- }
-
-
- private Entry( String name, Entry prevEntry, Entry nextEntry, Interceptor interceptor )
- {
- this.name = name;
-
- if ( interceptor == null )
- {
- throw new NullPointerException( "interceptor" );
- }
-
- this.prevEntry = prevEntry;
- this.nextEntry = nextEntry;
- this.interceptor = interceptor;
- this.nextInterceptor = new NextInterceptor()
- {
- private Entry getNextEntry()
- {
- if ( InvocationStack.getInstance().isEmpty() )
- {
- return Entry.this.nextEntry;
- }
-
- OperationContext opContext = InvocationStack.getInstance().peek();
- if ( !opContext.hasBypass() )
- {
- return Entry.this.nextEntry;
- }
-
- // I don't think we really need this since this check is performed by the chain when
- // getting the interceptor head to use.
- //
- // if ( invocation.isBypassed( DirectoryPartitionNexusProxy.BYPASS_ALL ) )
- // {
- // return tail;
- // }
-
- Entry next = Entry.this.nextEntry;
- while ( next != tail )
- {
- if ( opContext.isBypassed( next.getName() ) )
- {
- next = next.nextEntry;
- }
- else
- {
- return next;
- }
- }
-
- return next;
- }
-
-
- public boolean compare( CompareOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- return interceptor.compare( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- return interceptor.getRootDSE( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public LdapDN getMatchedName( GetMatchedNameOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- return interceptor.getMatchedName( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public LdapDN getSuffix( GetSuffixOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- return interceptor.getSuffix( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public Set<String> listSuffixes( ListSuffixOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- return interceptor.listSuffixes( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public void delete( DeleteOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- interceptor.delete( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- }
- }
-
-
- public void add( AddOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- interceptor.add( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- }
- }
-
-
- public void modify( ModifyOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- interceptor.modify( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- }
- }
-
-
- public EntryFilteringCursor list( ListOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- return interceptor.list( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public EntryFilteringCursor search( SearchOperationContext opContext )
- throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- return interceptor.search( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- return interceptor.lookup( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public boolean hasEntry( EntryOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- return interceptor.hasEntry( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public void rename( RenameOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- interceptor.rename( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- }
- }
-
-
- public void move( MoveOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- interceptor.move( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- }
- }
-
-
- public void moveAndRename( MoveAndRenameOperationContext opContext )
- throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- interceptor.moveAndRename( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- }
- }
-
-
- public void bind( BindOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- interceptor.bind( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- }
- }
-
-
- public void unbind( UnbindOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- interceptor.unbind( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- }
- }
-
-
- public void addContextPartition( AddContextPartitionOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- interceptor.addContextPartition( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
-
-
- public void removeContextPartition( RemoveContextPartitionOperationContext opContext ) throws Exception
- {
- Entry next = getNextEntry();
- Interceptor interceptor = next.interceptor;
-
- try
- {
- interceptor.removeContextPartition( next.nextInterceptor, opContext );
- }
- catch ( Exception ne )
- {
- throw ne;
- }
- catch ( Throwable e )
- {
- throwInterceptorException( interceptor, e );
- throw new InternalError(); // Should be unreachable
- }
- }
- };
- }
- }
-
-
- private static void throwInterceptorException( Interceptor interceptor, Throwable e ) throws InterceptorException
- {
- throw new InterceptorException( interceptor, "Unexpected exception.", e );
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/InterceptorException.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/InterceptorException.java
deleted file mode 100644
index 6dd2910..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/InterceptorException.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor;
-
-
-import javax.naming.NamingException;
-
-
-/**
- * A {@link NamingException} that wraps uncaught runtime exceptions thrown
- * from {@link Interceptor}s.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class InterceptorException extends NamingException
-{
- private static final long serialVersionUID = 3258690996517746233L;
-
- /**
- * The Interceptor causing the failure
- */
- private final Interceptor interceptor;
-
-
- /**
- * Creates an InterceptorException without a message.
- *
- * @param interceptor the Interceptor causing the failure
- */
- public InterceptorException(Interceptor interceptor)
- {
- this.interceptor = interceptor;
- }
-
-
- /**
- * Creates an InterceptorException with a custom message.
- *
- * @param interceptor the Interceptor causing the failure
- * @param explanation String explanation of why the Interceptor failed
- */
- public InterceptorException(Interceptor interceptor, String explanation)
- {
- super( explanation );
- this.interceptor = interceptor;
- }
-
-
- /**
- * Creates an InterceptorException without a message.
- *
- * @param interceptor the Interceptor causing the failure
- * @param rootCause the root cause of this exception
- */
- public InterceptorException(Interceptor interceptor, Throwable rootCause)
- {
- this( interceptor );
- super.setRootCause( rootCause );
- }
-
-
- /**
- * Creates an InterceptorException without a message.
- *
- * @param interceptor the Interceptor causing the failure
- * @param explanation String explanation of why the Interceptor failed
- * @param rootCause the root cause of this exception
- */
- public InterceptorException(Interceptor interceptor, String explanation, Throwable rootCause)
- {
- this( interceptor, explanation );
- super.setRootCause( rootCause );
- }
-
-
- /**
- * Gets the interceptor this exception is associated with.
- *
- * @return the interceptor this exception is associated with
- */
- public Interceptor getInterceptor()
- {
- return interceptor;
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
deleted file mode 100644
index aa25b42..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor;
-
-
-import java.util.Set;
-
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.filtering.EntryFilteringCursor;
-import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
-import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
-import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * Represents the next {@link Interceptor} in the interceptor chain.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- * @see Interceptor
- * @see InterceptorChain
- */
-public interface NextInterceptor
-{
- /**
- * Calls the next interceptor's {@link Interceptor#compare( NextInterceptor, CompareOperationContext )}.
- */
- boolean compare( CompareOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#getRootDSE( NextInterceptor, GetRootDSEOperationContext )}.
- */
- ClonedServerEntry getRootDSE( GetRootDSEOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#getMatchedName( NextInterceptor, GetMatchedNameOperationContext )}.
- */
- LdapDN getMatchedName( GetMatchedNameOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#getSuffix( NextInterceptor, GetSuffixOperationContext )}.
- */
- LdapDN getSuffix( GetSuffixOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#listSuffixes( NextInterceptor, ListSuffixOperationContext )}.
- */
- Set<String> listSuffixes( ListSuffixOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link PartitionNexus#addContextPartition( AddContextPartitionOperationContext )}.
- */
- void addContextPartition( AddContextPartitionOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link PartitionNexus#removeContextPartition( RemoveContextPartitionOperationContext )}.
- */
- void removeContextPartition( RemoveContextPartitionOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#delete(NextInterceptor, DeleteOperationContext )}.
- */
- void delete( DeleteOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#add( NextInterceptor, AddOperationContext )}.
- */
- void add( AddOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#modify( NextInterceptor, ModifyOperationContext )}.
- */
- void modify( ModifyOperationContext opContext ) throws Exception;
-
- /**
- * Calls the next interceptor's {@link Interceptor#list( NextInterceptor, ListOperationContext )}.
- */
- EntryFilteringCursor list( ListOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#search( NextInterceptor, SearchOperationContext opContext )}.
- */
- EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#lookup( NextInterceptor, LookupOperationContext )}.
- */
- ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#hasEntry( NextInterceptor, EntryOperationContext )}.
- */
- boolean hasEntry( EntryOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#rename( NextInterceptor, RenameOperationContext )}.
- */
- void rename( RenameOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#move( NextInterceptor, MoveOperationContext )}.
- */
- void move( MoveOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#moveAndRename( NextInterceptor, MoveAndRenameOperationContext )}.
- */
- void moveAndRename( MoveAndRenameOperationContext opContext ) throws Exception;
-
-
- /**
- * Calls the next interceptor's {@link Interceptor#bind( NextInterceptor, BindOperationContext )}
- */
- void bind( BindOperationContext opContext ) throws Exception;
-
- /**
- * Calls the next interceptor's {@link Interceptor#unbind( NextInterceptor, UnbindOperationContext )}
- */
- void unbind( UnbindOperationContext opContext ) throws Exception;
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractChangeOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractChangeOperationContext.java
deleted file mode 100644
index f2db8e6..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractChangeOperationContext.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.changelog.ChangeLogEvent;
-import org.apache.directory.server.core.CoreSession.LogChange;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * An abstract base class used by all change inducing operations.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public abstract class AbstractChangeOperationContext extends AbstractOperationContext implements ChangeOperationContext
-{
- private ChangeLogEvent changeLogEvent;
-
- /** The flag used to tell the server to store the change sinto the changeLog */
- protected LogChange logChange;
-
-
- public AbstractChangeOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- public AbstractChangeOperationContext( CoreSession session, LdapDN dn )
- {
- super( session, dn );
- }
-
-
- /**
- * @see org.apache.directory.server.core.interceptor.context.ChangeOperationContext#getChangeLogEvent()
- */
- public ChangeLogEvent getChangeLogEvent()
- {
- return changeLogEvent;
- }
-
-
- public void setChangeLogEvent( ChangeLogEvent changeLogEvent )
- {
- this.changeLogEvent = changeLogEvent;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void setLogChange( LogChange logChange )
- {
- this.logChange = logChange;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isLogChange()
- {
- return logChange != LogChange.FALSE;
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java
deleted file mode 100644
index e5b8866..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.ldap.Control;
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.LdapPrincipal;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * This abstract class stores common context elements, like the DN, which is used
- * in all the contexts.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public abstract class AbstractOperationContext implements OperationContext
-{
- protected static final Control[] EMPTY_CONTROLS = new Control[0];
-
- /** The DN associated with the context */
- protected LdapDN dn;
-
- /** The entry associated with the target entry of this OperationContext */
- protected ClonedServerEntry entry;
-
- /** The associated request's controls */
- protected Map<String, Control> requestControls = new HashMap<String, Control>(4);
-
- /** The associated response's controls */
- protected Map<String, Control> responseControls = new HashMap<String, Control>(4);
-
- /** the Interceptors bypassed by this operation */
- protected Collection<String> byPassed;
-
- 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;
- }
-
-
- /**
- * Creates a new instance of AbstractOperationContext.
- *
- * @param dn The associated DN
- */
- public AbstractOperationContext( CoreSession session, LdapDN dn )
- {
- this.dn = dn;
- this.session = session;
-
- // The flag is set to ignore, so that the revert operation can act on
- // the entries, even if they are referrals.
- ignoreReferral();
- }
-
-
- public CoreSession getSession()
- {
- return session;
- }
-
-
- protected void setSession( CoreSession session )
- {
- this.session = session;
- }
-
-
- protected void setAuthorizedPrincipal( LdapPrincipal authorizedPrincipal )
- {
- this.authorizedPrincipal = authorizedPrincipal;
- }
-
-
- /**
- * @return The associated DN
- */
- public LdapDN getDn()
- {
- return dn;
- }
-
-
- /**
- * Set the context DN
- *
- * @param dn The DN to set
- */
- public void setDn( LdapDN dn )
- {
- this.dn = dn;
- }
-
-
- public void addRequestControl( Control requestControl )
- {
- requestControls.put( requestControl.getID(), 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();
- }
-
-
- public void addResponseControl( Control responseControl )
- {
- responseControls.put( responseControl.getID(), responseControl );
- }
-
-
- public Control getResponseControl( String numericOid )
- {
- return responseControls.get( numericOid );
- }
-
-
- public boolean hasResponseControl( String numericOid )
- {
- return responseControls.containsKey( numericOid );
- }
-
-
- public Control[] getResponseControls()
- {
- if ( responseControls.isEmpty() )
- {
- return EMPTY_CONTROLS;
- }
-
- return responseControls.values().toArray( EMPTY_CONTROLS );
- }
-
-
- public boolean hasResponseControls()
- {
- return ! responseControls.isEmpty();
- }
-
-
- public int getResponseControlCount()
- {
- return responseControls.size();
- }
-
-
- public void addRequestControls( Control[] requestControls )
- {
- for ( Control c : requestControls )
- {
- this.requestControls.put( c.getID(), c );
- }
- }
-
-
- public void setRequestControls( Map<String, Control> requestControls )
- {
- this.requestControls = requestControls;
- }
-
-
- /**
- * @return the operation name
- */
- public abstract String getName();
-
-
- /**
- * Gets the set of bypassed Interceptors.
- *
- * @return the set of bypassed Interceptors
- */
- public Collection<String> getByPassed()
- {
- if ( byPassed == null )
- {
- return Collections.emptyList();
- }
-
- return Collections.unmodifiableCollection( byPassed );
- }
-
-
- /**
- * Sets the set of bypassed Interceptors.
- *
- * @param byPassed the set of bypassed Interceptors
- */
- public void setByPassed( Collection<String> byPassed )
- {
- this.byPassed = byPassed;
- }
-
-
- /**
- * Checks to see if an Interceptor is bypassed for this operation.
- *
- * @param interceptorName the interceptorName of the Interceptor to check for bypass
- * @return true if the Interceptor should be bypassed, false otherwise
- */
- public boolean isBypassed( String interceptorName )
- {
- return byPassed != null && byPassed.contains( interceptorName );
- }
-
-
- /**
- * Checks to see if any Interceptors are bypassed by this operation.
- *
- * @return true if at least one bypass exists
- */
- public boolean hasBypass()
- {
- return byPassed != null && !byPassed.isEmpty();
- }
-
-
- private void setup( AbstractOperationContext opContext )
- {
- opContext.setPreviousOperation( this );
- next = opContext;
- opContext.setByPassed( byPassed );
- opContext.setAuthorizedPrincipal( authorizedPrincipal );
- }
-
-
- public boolean hasEntry( LdapDN dn, Collection<String> byPassed ) throws Exception
- {
- EntryOperationContext opContext = new EntryOperationContext( session, dn );
- setup( opContext );
- opContext.setByPassed( byPassed );
- return session.getDirectoryService().getOperationManager().hasEntry( opContext );
- }
-
-
- public void add( ServerEntry entry, Collection<String> byPassed ) throws Exception
- {
- AddOperationContext opContext = new AddOperationContext( session, entry );
- setup( opContext );
- opContext.setByPassed( byPassed );
- session.getDirectoryService().getOperationManager().add( opContext );
- }
-
-
- public void delete( LdapDN dn, Collection<String> byPassed ) throws Exception
- {
- DeleteOperationContext opContext = new DeleteOperationContext( session, dn );
- setup( opContext );
- opContext.setByPassed( byPassed );
- session.getDirectoryService().getOperationManager().delete( opContext );
- }
-
-
- public void modify( LdapDN dn, List<Modification> mods, Collection<String> byPassed ) throws Exception
- {
- ModifyOperationContext opContext = new ModifyOperationContext( session, dn, mods );
- setup( opContext );
- opContext.setByPassed( byPassed );
- session.getDirectoryService().getOperationManager().modify( opContext );
- }
-
-
- // TODO - need synchronization here and where we update links
- public LookupOperationContext newLookupContext( LdapDN dn )
- {
- LookupOperationContext opContext = new LookupOperationContext( session, dn );
- setup( opContext );
- return opContext;
- }
-
-
- public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
- {
- if ( opContext != next )
- {
- throw new IllegalStateException( "Cannot execute indirect lookup if it is not the next operation." );
- }
- return session.getDirectoryService().getOperationManager().lookup( opContext );
- }
-
-
- public ClonedServerEntry lookup( LdapDN dn, Collection<String> byPassed ) throws Exception
- {
- LookupOperationContext opContext = newLookupContext( dn );
- opContext.setByPassed( byPassed );
- return session.getDirectoryService().getOperationManager().lookup( opContext );
- }
-
-
- 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;
- }
-
-
- /**
- * @param entry the entry to set
- */
- public void setEntry( ClonedServerEntry entry )
- {
- this.entry = entry;
- }
-
-
- /**
- * @return the entry
- */
- public ClonedServerEntry getEntry()
- {
- return entry;
- }
-
-
- /**
- * Set the throwReferral flag to true
- */
- public void throwReferral()
- {
- throwReferral = true;
- }
-
-
- /**
- * @return <code>true</code> if the referrals are thrown
- */
- public boolean isReferralThrown()
- {
- return throwReferral;
- }
-
-
- /**
- * Set the throwReferral flag to false
- */
- public void ignoreReferral()
- {
- throwReferral = false;
- }
-
-
- /**
- * @return <code>true</code> if the referrals are ignored
- */
- public boolean isReferralIgnored()
- {
- return !throwReferral;
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AddContextPartitionOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AddContextPartitionOperationContext.java
deleted file mode 100644
index fff0b74..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AddContextPartitionOperationContext.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.partition.Partition;
-
-
-/**
- * A AddContextPartition context used for Interceptors. It contains all the informations
- * needed for the addContextPartition operation, and used by all the interceptors. If
- * it does not have a partition set for it, then it will load and instantiate it
- * automatically using the information in the partition configuration.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class AddContextPartitionOperationContext extends EmptyOperationContext
-{
- /** the instantiated partition class */
- private Partition partition;
-
-
- /**
- * Creates a new instance of AddContextPartitionOperationContext.
- *
- * @param partition The partition to add
- */
- public AddContextPartitionOperationContext( CoreSession session, Partition partition )
- {
- super( session );
- this.partition = partition;
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "AddContextPartitionOperationContext for partition context '" + partition.getId() + "'";
- }
-
-
- /**
- * @return The partition
- */
- public Partition getPartition()
- {
- return partition;
- }
-
-
- /**
- * Set the partition.
- *
- * @param partition the partition
- */
- public void setPartitionConfiguration( Partition partition )
- {
- this.partition = partition;
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return "AddContextPartition";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java
deleted file mode 100644
index 61447a1..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.shared.ldap.message.InternalAddRequest;
-import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * A Add context used for Interceptors. It contains all the informations
- * needed for the add operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class AddOperationContext extends AbstractChangeOperationContext
-{
- /**
- * Creates a new instance of AddOperationContext.
- *
- * @param session the current Session
- */
- public AddOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- * Creates a new instance of AddOperationContext.
- *
- * @param session the current Session
- * @param dn the name of the entry being added
- */
- public AddOperationContext( CoreSession session, LdapDN dn )
- {
- super( session, dn );
- }
-
-
- /**
- * Creates a new instance of AddOperationContext.
- *
- * @param session the current Session
- * @param entry the entry being added
- */
- public AddOperationContext( CoreSession session, ServerEntry entry )
- {
- super( session, entry.getDn() );
- this.entry = new ClonedServerEntry( entry );
- }
-
-
- /**
- * Creates a new instance of ModifyOperationContext.
- *
- * @param session the current Session
- * @param dn the name of the entry being added
- * @param entry the entry being added
- */
- public AddOperationContext( CoreSession session, LdapDN dn, ServerEntry entry )
- {
- super( session, dn );
- this.entry = new ClonedServerEntry( entry );
- }
-
-
- public AddOperationContext( CoreSession session, InternalAddRequest addRequest ) throws Exception
- {
- super( session );
- entry = new ClonedServerEntry(
- new DefaultServerEntry( session.getDirectoryService().getRegistries(), addRequest.getEntry() ) );
- dn = addRequest.getEntry().getDn();
- requestControls = addRequest.getControls();
-
- if ( requestControls.containsKey( ManageDsaITControl.CONTROL_OID ) )
- {
- ignoreReferral();
- }
- else
- {
- throwReferral();
- }
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return MessageTypeEnum.ADD_REQUEST.name();
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "AddContext for DN '" + getDn().getUpName() + "'" + ", added entry: " + entry;
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java
deleted file mode 100644
index d0f83db..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.ldap.Control;
-
-import org.apache.commons.lang.NotImplementedException;
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.ReferralHandlingMode;
-import org.apache.directory.server.core.LdapPrincipal;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
-import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.StringTools;
-
-
-/**
- * A Bind context used for Interceptors. It contains all the informations
- * needed for the bind operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class BindOperationContext implements OperationContext
-{
- /** The password */
- private byte[] credentials;
-
- /** The SASL mechanism */
- private String saslMechanism;
-
- /** The SASL identifier */
- private String saslAuthId;
-
- private static final Control[] EMPTY_CONTROLS = new Control[0];
-
- /** The DN associated with the context */
- private LdapDN dn;
-
- /** The associated request's controls */
- private Map<String, Control> requestControls = new HashMap<String, Control>(4);
-
- /** The associated response's controls */
- private Map<String, Control> responseControls = new HashMap<String, Control>(4);
-
- /** A flag to tell that this is a collateral operation */
- private boolean collateralOperation;
-
- /** the Interceptors bypassed by this operation */
- private Collection<String> bypassed;
-
- private CoreSession session;
-
- private LdapPrincipal authorizedPrincipal;
-
- private OperationContext next;
-
- private OperationContext previous;
-
- private ReferralHandlingMode referralHandlingMode;
-
- private ClonedServerEntry entry;
-
-
- /**
- * Creates a new instance of BindOperationContext.
- */
- public BindOperationContext( CoreSession session )
- {
- this.session = session;
- }
-
-
- /**
- * @return The authentication level. One of :
- * <li>ANONYMOUS</li>
- * <li>SIMPLE</li>
- * <li>STRONG (sasl)</li>
- * <li>INVALID</li>
- */
- public AuthenticationLevel getAuthenticationLevel()
- {
- if ( ( saslMechanism == null ) )
- {
- if ( dn.isEmpty() )
- {
- if ( StringTools.isEmpty( credentials ) )
- {
- // Dn and Credentials are empty, this is an anonymous authent
- return AuthenticationLevel.NONE;
- }
- else
- {
- // If we have a password but no DN, this is invalid
- return AuthenticationLevel.INVALID;
- }
- }
- else if ( StringTools.isEmpty( credentials ) )
- {
- return AuthenticationLevel.UNAUTHENT;
- }
- else
- {
- return AuthenticationLevel.SIMPLE;
- }
- }
- else
- {
- return AuthenticationLevel.STRONG;
- }
- }
-
-
- /**
- * @return the SASL mechanisms
- */
- public String getSaslMechanism()
- {
- return saslMechanism;
- }
-
-
- public void setSaslMechanism( String saslMechanism )
- {
- this.saslMechanism = saslMechanism;
- }
-
-
- /**
- * @return The principal password
- */
- public byte[] getCredentials()
- {
- return credentials;
- }
-
-
- public void setCredentials( byte[] credentials )
- {
- this.credentials = credentials;
- }
-
-
- /**
- * @return The SASL authentication ID
- */
- public String getSaslAuthId()
- {
- return saslAuthId;
- }
-
-
- public void setSaslAuthId( String saslAuthId )
- {
- this.saslAuthId = saslAuthId;
- }
-
-
- public boolean isSaslBind()
- {
- return saslMechanism != null;
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return MessageTypeEnum.BIND_REQUEST.name();
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "BindContext for DN '" + getDn().getUpName() + "', credentials <" +
- ( credentials != null ? StringTools.dumpBytes( credentials ) : "" ) + ">" +
- ( saslMechanism != null ? ", saslMechanism : <" + saslMechanism + ">" : "" ) +
- ( saslAuthId != null ? ", saslAuthId <" + saslAuthId + ">" : "" );
- }
-
-
- public CoreSession getSession()
- {
- return session;
- }
-
-
- public void setSession( CoreSession session )
- {
- this.session = session;
- }
-
-
- /**
- * Tells if the current operation is considered a side effect of the
- * current context
- */
- public boolean isCollateralOperation()
- {
- return collateralOperation;
- }
-
-
- public void setCollateralOperation( boolean collateralOperation )
- {
- this.collateralOperation = collateralOperation;
- }
-
-
- /**
- * @return The associated DN
- */
- public LdapDN getDn()
- {
- return dn;
- }
-
-
- /**
- * Set the context DN
- *
- * @param dn The DN to set
- */
- public void setDn( LdapDN dn )
- {
- this.dn = dn;
- }
-
-
- public void addRequestControl( Control requestControl )
- {
- requestControls.put( requestControl.getID(), 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();
- }
-
-
- public void addResponseControl( Control responseControl )
- {
- responseControls.put( responseControl.getID(), responseControl );
- }
-
-
- public Control getResponseControl( String numericOid )
- {
- return responseControls.get( numericOid );
- }
-
-
- public boolean hasResponseControl( String numericOid )
- {
- return responseControls.containsKey( numericOid );
- }
-
-
- public Control[] getResponseControls()
- {
- if ( responseControls.isEmpty() )
- {
- return EMPTY_CONTROLS;
- }
-
- return responseControls.values().toArray( EMPTY_CONTROLS );
- }
-
-
- public boolean hasResponseControls()
- {
- return ! responseControls.isEmpty();
- }
-
-
- public int getResponseControlCount()
- {
- return responseControls.size();
- }
-
-
- public void addRequestControls( Control[] requestControls )
- {
- for ( Control c : requestControls )
- {
- this.requestControls.put( c.getID(), c );
- }
- }
-
-
- /**
- * Gets the set of bypassed Interceptors.
- *
- * @return the set of bypassed Interceptors
- */
- public Collection<String> getByPassed()
- {
- if ( bypassed == null )
- {
- return Collections.emptyList();
- }
-
- return Collections.unmodifiableCollection( bypassed );
- }
-
-
- /**
- * Sets the set of bypassed Interceptors.
- *
- * @param byPassed the set of bypassed Interceptors
- */
- public void setByPassed( Collection<String> byPassed )
- {
- this.bypassed = byPassed;
- }
-
-
- /**
- * Checks to see if an Interceptor is bypassed for this operation.
- *
- * @param interceptorName the interceptorName of the Interceptor to check for bypass
- * @return true if the Interceptor should be bypassed, false otherwise
- */
- public boolean isBypassed( String interceptorName )
- {
- return bypassed != null && bypassed.contains( interceptorName );
- }
-
-
- /**
- * Checks to see if any Interceptors are bypassed by this operation.
- *
- * @return true if at least one bypass exists
- */
- public boolean hasBypass()
- {
- return bypassed != null && !bypassed.isEmpty();
- }
-
-
- public LookupOperationContext newLookupContext( LdapDN dn )
- {
- return new LookupOperationContext( session, dn );
- }
-
-
- public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception
- {
- return session.getDirectoryService().getOperationManager().lookup( opContext );
- }
-
-
- public ClonedServerEntry lookup( LdapDN dn, Collection<String> byPassed ) throws Exception
- {
- LookupOperationContext opContext = newLookupContext( dn );
- opContext.setByPassed( byPassed );
- return session.getDirectoryService().getOperationManager().lookup( opContext );
- }
-
-
- 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;
- }
-
-
- public OperationContext getPreviousOperation()
- {
- return previous;
- }
-
-
- public void add( ServerEntry entry, Collection<String> bypass ) throws Exception
- {
- throw new NotImplementedException();
- }
-
-
- public void delete( LdapDN dn, Collection<String> bypass ) throws Exception
- {
- throw new NotImplementedException();
- }
-
-
- public void modify( LdapDN dn, List<Modification> mods, Collection<String> bypass ) throws Exception
- {
- throw new NotImplementedException();
- }
-
-
- private void setup( AbstractOperationContext opContext )
- {
- opContext.setPreviousOperation( this );
- next = opContext;
- opContext.setByPassed( opContext.getByPassed() );
- opContext.setAuthorizedPrincipal( authorizedPrincipal );
- }
-
-
- public boolean hasEntry( LdapDN dn, Collection<String> byPassed ) throws Exception
- {
- EntryOperationContext opContext = new EntryOperationContext( session, dn );
- setup( opContext );
- opContext.setByPassed( byPassed );
- return session.getDirectoryService().getOperationManager().hasEntry( opContext );
- }
-
-
- public ReferralHandlingMode getReferralHandlingMode()
- {
- return referralHandlingMode;
- }
-
-
- public void setReferralHandlingMode( ReferralHandlingMode referralHandlingMode )
- {
- this.referralHandlingMode = referralHandlingMode;
- }
-
-
- public ClonedServerEntry getEntry()
- {
- return entry;
- }
-
-
- public void setEntry( ClonedServerEntry entry )
- {
- this.entry = entry;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void throwReferral()
- {
- throw new NotImplementedException( " The throwReferral method is not implemented for a Bind operation" );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isReferralThrown()
- {
- throw new NotImplementedException( " The isReferralThrown method is not implemented for a Bind operation" );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void ignoreReferral()
- {
- throw new NotImplementedException( " The ignoreReferral method is not implemented for a Bind operation" );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isReferralIgnored()
- {
- throw new NotImplementedException( " The isReferralIgnored method is not implemented for a Bind operation" );
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java
deleted file mode 100644
index 8c67f41..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ChangeOperationContext.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.changelog.ChangeLogEvent;
-import org.apache.directory.server.core.CoreSession.LogChange;
-
-
-/**
- * Operations (write based) causing changes extend this interface.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public interface ChangeOperationContext extends OperationContext
-{
- /**
- * Gets the ChangeLogEvent associated with this operation after the
- * operation has been executed. Returns null if the ChangeLogService has
- * not been enabled.
- *
- * @return the ChangeLogEvent associated with this operation, or null
- */
- ChangeLogEvent getChangeLogEvent();
-
-
- /**
- * Set the flag which tells the server to log the changes into
- * the changeLog file
- *
- * @param log The flag
- */
- void setLogChange( LogChange log );
-
-
- /**
- * @return True if the changes are logged into the changeLog
- */
- boolean isLogChange();
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java
deleted file mode 100644
index b0223ca..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/CompareOperationContext.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
-import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
-import org.apache.directory.shared.ldap.message.InternalCompareRequest;
-import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.StringTools;
-
-
-/**
- * A Compare context used for Interceptors. It contains all the informations
- * needed for the compare operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class CompareOperationContext extends AbstractOperationContext
-{
- /** The entry OID */
- private String oid;
-
- /** The value to be compared */
- private Value<?> value;
-
-
- /**
- *
- * Creates a new instance of CompareOperationContext.
- *
- */
- public CompareOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- *
- * Creates a new instance of CompareOperationContext.
- *
- */
- public CompareOperationContext( CoreSession session, LdapDN dn )
- {
- super( session, dn );
- }
-
-
- /**
- *
- * Creates a new instance of LookupOperationContext.
- *
- */
- public CompareOperationContext( CoreSession session, String oid )
- {
- super( session );
- this.oid = oid;
- }
-
-
- /**
- *
- * Creates a new instance of LookupOperationContext.
- *
- */
- public CompareOperationContext( CoreSession session, LdapDN dn, String oid )
- {
- super( session, dn );
- this.oid = oid;
- }
-
-
- /**
- *
- * Creates a new instance of LookupOperationContext.
- *
- */
- public CompareOperationContext( CoreSession session, LdapDN dn, String oid, Value<?> value )
- {
- super( session, dn );
- this.oid = oid;
- this.value = value;
- }
-
-
- public CompareOperationContext( CoreSession session, InternalCompareRequest compareRequest )
- {
- super( session, compareRequest.getName() );
- this.oid = compareRequest.getAttributeId();
- this.value = compareRequest.getAssertionValue();
- this.requestControls = compareRequest.getControls();
-
- if ( requestControls.containsKey( ManageDsaITControl.CONTROL_OID ) )
- {
- ignoreReferral();
- }
- else
- {
- throwReferral();
- }
- }
-
-
- /**
- * @return The compared OID
- */
- public String getOid()
- {
- return oid;
- }
-
-
- /**
- * Set the compared OID
- * @param oid The compared OID
- */
- public void setOid( String oid )
- {
- this.oid = oid;
- }
-
-
- /**
- * @return The value to compare
- */
- public Object getValue()
- {
- return value;
- }
-
-
- /**
- * Set the value to compare
- * @param value The value to compare
- */
- public void setValue( Value<?> value )
- {
- this.value = value;
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return MessageTypeEnum.COMPARE_REQUEST.name();
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "CompareContext for DN '" + getDn().getUpName() + "'" +
- ( ( oid != null ) ? ", oid : <" + oid + ">" : "" ) +
- ( ( value != null ) ? ", value :'" +
- ( ( value instanceof ClientStringValue ) ?
- ((ClientStringValue)value).get() :
- ( ( value instanceof ClientBinaryValue ) ?
- StringTools.dumpBytes( ((ClientBinaryValue)value).getReference() ) :
- "unknown value type" ) )
- + "'"
- : "" );
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
deleted file mode 100644
index 4ff8a6a..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteOperationContext.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.shared.ldap.message.InternalDeleteRequest;
-import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * A Delete context used for Interceptors. It contains all the informations
- * needed for the delete operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class DeleteOperationContext extends AbstractChangeOperationContext
-{
- /**
- * An optimization added to prevent redundant lookups of the deleted
- * entry.
- */
- private ClonedServerEntry entry;
-
-
- /**
- * Creates a new instance of DeleteOperationContext.
- */
- public DeleteOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- * Creates a new instance of DeleteOperationContext.
- *
- * @param deleteDn The entry DN to delete
- */
- public DeleteOperationContext( CoreSession session, LdapDN deleteDn )
- {
- super( session, deleteDn );
- }
-
-
- public DeleteOperationContext( CoreSession session, InternalDeleteRequest deleteRequest )
- {
- super( session, deleteRequest.getName() );
- requestControls = deleteRequest.getControls();
-
- if ( requestControls.containsKey( ManageDsaITControl.CONTROL_OID ) )
- {
- ignoreReferral();
- }
- else
- {
- throwReferral();
- }
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return MessageTypeEnum.DEL_REQUEST.name();
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "DeleteContext for DN '" + getDn().getUpName() + "'";
- }
-
-
- /**
- * @param entry the entry to set
- */
- public void setEntry( ClonedServerEntry entry )
- {
- this.entry = entry;
- }
-
-
- /**
- * Gets the deleted entry if cached. Must be called before deleting the
- * entry when the entry member is null or this call will fail.
- *
- * @return the entry
- */
- public ClonedServerEntry getEntry()
- {
- return entry;
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/EmptyOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/EmptyOperationContext.java
deleted file mode 100644
index 39cb085..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/EmptyOperationContext.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * An EmptySuffix context used for Interceptors. It contains no data, and mask
- * the DN in AbstractOperationContext
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public abstract class EmptyOperationContext extends AbstractOperationContext
-{
- /**
- * Creates a new instance of EmptyOperationContext.
- */
- public EmptyOperationContext( CoreSession session )
- {
- super( session, LdapDN.EMPTY_LDAPDN );
- }
-
-
- /**
- * Set the context DN
- *
- * @param dn The DN to set
- */
- public void setDn( LdapDN dn )
- {
- if ( dn.equals( LdapDN.EMPTY_LDAPDN ) )
- {
- return;
- }
-
- throw new UnsupportedOperationException(
- "Cannot set the empty operation context to anything other than the EmptyDN" );
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "EmptyOperationContext";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/EntryOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/EntryOperationContext.java
deleted file mode 100644
index 0edd83c..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/EntryOperationContext.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * A Entry context used for Interceptors. It contains all the informations
- * needed for the hasEntry operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class EntryOperationContext extends AbstractOperationContext
-{
- /**
- * Creates a new instance of EntryOperationContext.
- */
- public EntryOperationContext( CoreSession session )
- {
- super( session );
- }
-
- /**
- * Creates a new instance of EntryOperationContext.
- *
- * @param entryDn The Entry DN to unbind
- */
- public EntryOperationContext( CoreSession session, LdapDN entryDn )
- {
- super( session, entryDn );
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return MessageTypeEnum.ADD_REQUEST.name();
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "EntryContext for DN '" + getDn().getUpName() + "'";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/GetMatchedNameOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/GetMatchedNameOperationContext.java
deleted file mode 100644
index df19733..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/GetMatchedNameOperationContext.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * A GetMatchedName context used for Interceptors. It contains all the informations
- * needed for the getMatchedName operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class GetMatchedNameOperationContext extends AbstractOperationContext
-{
- /**
- * Creates a new instance of GetMatchedNameOperationContext.
- */
- public GetMatchedNameOperationContext( CoreSession session )
- {
- super( session );
- }
-
- /**
- * Creates a new instance of GetMatchedNameOperationContext.
- *
- * @param dn The DN to match
- */
- public GetMatchedNameOperationContext( CoreSession session, LdapDN dn )
- {
- super( session, dn );
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return "MatchedName";
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "GetMatchedNameContext with DN '" + getDn().getUpName() + "'";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/GetRootDSEOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/GetRootDSEOperationContext.java
deleted file mode 100644
index 39a5f5c..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/GetRootDSEOperationContext.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * A GetRootDSE context used for Interceptors. It contains all the informations
- * needed for the getRootDSE operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class GetRootDSEOperationContext extends AbstractOperationContext
-{
- /**
- * Creates a new instance of GetRootDSEOperationContext.
- */
- public GetRootDSEOperationContext( CoreSession session )
- {
- super( session );
- }
-
- /**
- * Creates a new instance of GetRootDSEOperationContext.
- *
- * @param dn The entry DN used to get the rootDSE
- */
- public GetRootDSEOperationContext( CoreSession session, LdapDN dn )
- {
- super( session, dn );
- }
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return "GetRootDSE";
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "GetRootDSEContext with DN '" + getDn().getUpName() + "'";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/GetSuffixOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/GetSuffixOperationContext.java
deleted file mode 100644
index 6934e4a..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/GetSuffixOperationContext.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * A GetSuffix context used for Interceptors. It contains all the informations
- * needed for the GetSuffix operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class GetSuffixOperationContext extends AbstractOperationContext
-{
- /**
- * Creates a new instance of GetSuffixOperationContext.
- */
- public GetSuffixOperationContext( CoreSession session )
- {
- super( session );
- }
-
- /**
- * Creates a new instance of GetSuffixOperationContext.
- *
- * @param dn The DN to get the suffix from
- */
- public GetSuffixOperationContext( CoreSession session, LdapDN dn )
- {
- super( session, dn );
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return "GetSuffix";
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "GetSuffixOperationContext with DN '" + getDn().getUpName() + "'";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ListOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ListOperationContext.java
deleted file mode 100644
index 7e6715f..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ListOperationContext.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import java.util.Set;
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
-import org.apache.directory.shared.ldap.message.AliasDerefMode;
-
-
-/**
- * A ListContext context used for Interceptors. It contains all the informations
- * needed for the List operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class ListOperationContext extends SearchingOperationContext
-{
- /**
- * Creates a new instance of ListOperationContext.
- */
- public ListOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- * Creates a new instance of ListOperationContext.
- *
- * @param dn The DN to get the suffix from
- */
- public ListOperationContext( CoreSession session, LdapDN dn )
- {
- super( session, dn );
- }
-
-
- /**
- * Creates a new instance of ListOperationContext.
- *
- * @param dn The DN to get the suffix from
- * @param aliasDerefMode the alias dereferencing mode to use
- */
- public ListOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode )
- {
- super( session, dn, aliasDerefMode );
- }
-
-
- /**
- * Creates a new instance of ListOperationContext with attributes to return.
- *
- * @param session the session associated with this {@link OperationContext}
- * @param dn the base DN
- * @param aliasDerefMode the alias dereferencing mode to use
- * @param returningAttributes the attributes to return
- */
- public ListOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode,
- Set<AttributeTypeOptions> returningAttributes )
- {
- super( session, dn, aliasDerefMode, returningAttributes );
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return "List";
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "List with DN '" + getDn().getUpName() + "'";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java
deleted file mode 100644
index 8fb4f81..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ListSuffixOperationContext.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * A ListSuffix context used for Interceptors. It contains all the informations
- * needed for the ListSuffix operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class ListSuffixOperationContext extends AbstractOperationContext
-{
- /**
- * Creates a new instance of ListSuffixOperationContext.
- */
- public ListSuffixOperationContext( CoreSession session )
- {
- super( session );
- }
-
- /**
- * Creates a new instance of ListSuffixOperationContext.
- *
- * @param dn The DN to get the suffix from
- */
- public ListSuffixOperationContext( CoreSession session, Registries registries, LdapDN dn )
- {
- super( session, dn );
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return "ListSuffix";
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "ListSuffixOperationContext with DN '" + getDn().getUpName() + "'";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java
deleted file mode 100644
index ad01bbf..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/LookupOperationContext.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.StringTools;
-
-
-/**
- * A context for tracking lookup operations. Lookup operations will return a
- * cloned server entry.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class LookupOperationContext extends AbstractOperationContext
-{
- private static final String[] EMPTY = new String[] {};
-
- /** The list of attributes id to return */
- private List<String> attrsId = new ArrayList<String>();
-
- private Boolean allOperational;
-
- private Boolean allUser;
-
-
- /**
- *
- * Creates a new instance of LookupOperationContext.
- *
- */
- public LookupOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- *
- * Creates a new instance of LookupOperationContext.
- *
- */
- public LookupOperationContext( CoreSession session, LdapDN dn )
- {
- super( session, dn );
- }
-
-
- /**
- *
- * Creates a new instance of LookupOperationContext.
- *
- */
- public LookupOperationContext( CoreSession session, String attrsId[] )
- {
- super( session );
- setAttrsId( attrsId );
- }
-
-
- /**
- *
- * Creates a new instance of LookupOperationContext.
- *
- */
- public LookupOperationContext( CoreSession session, LdapDN dn, String attrsId[] )
- {
- super( session, dn );
- setAttrsId( attrsId );
- }
-
-
- /**
- * @return Get the attribute ids as a String array
- */
- public String[] getAttrsIdArray()
- {
- if ( attrsId == null || attrsId.size() == 0 )
- {
- return EMPTY;
- }
- else
- {
- String[] attrs = new String[ attrsId.size()];
- return attrsId.toArray( attrs );
- }
- }
-
-
- /**
- * Set the attribute Ids
- *
- * @param attrsId The String array containing all the attribute IDs
- */
- public void setAttrsId( String[] attrsId )
- {
- if ( attrsId != null && attrsId.length > 0 )
- {
- this.attrsId = new ArrayList<String>( Arrays.asList( attrsId ) );
-
- // filter out the '+' and '*' and set boolean parameters
- for ( String id : this.attrsId )
- {
- if ( id.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
- {
- allOperational = true;
- }
- else if ( id.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) )
- {
- allUser = true;
- }
- }
-
- if ( allOperational != null && allOperational )
- {
- this.attrsId.remove( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES );
- }
-
- if ( allUser != null && allUser )
- {
- this.attrsId.remove( SchemaConstants.ALL_USER_ATTRIBUTES );
- }
- }
- }
-
-
- /**
- * Add an attribute ID to the current list, creating the list if necessary
- *
- * @param attrId the Id to add
- */
- public void addAttrsId( String attrId )
- {
- if ( attrId.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) )
- {
- allUser = true;
- return;
- }
-
- if ( attrId.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
- {
- allOperational = true;
- return;
- }
-
- if ( attrsId == null )
- {
- attrsId = new ArrayList<String>();
- }
-
- attrsId.add( attrId );
- }
-
-
- /**
- * @return The attribute IDs list
- */
- public List<String> getAttrsId()
- {
- return attrsId;
- }
-
-
- public Boolean getAllUser()
- {
- return allUser;
- }
-
-
- public Boolean getAllOperational()
- {
- return allOperational;
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return "Lookup";
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "LookupContext for DN '" + getDn().getUpName() + "'" + ( ( attrsId != null ) ? ", attributes : <" + StringTools.listToString( attrsId ) + ">" : "" );
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
deleted file mode 100644
index 8917b4e..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.naming.NamingException;
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerEntryUtils;
-import org.apache.directory.server.core.entry.ServerModification;
-import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.client.ClientModification;
-import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.InternalModifyRequest;
-import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * A Modify context used for Interceptors. It contains all the informations
- * needed for the modify operation, and used by all the interceptors
- *
- * This context can use either Attributes or ModificationItem, but not both.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class ModifyOperationContext extends AbstractChangeOperationContext
-{
- /** The modification items */
- private List<Modification> modItems;
-
- /** Cloned entry that is modified */
- private ClonedServerEntry entry;
-
-
- /**
- * Creates a new instance of ModifyOperationContext.
- */
- public ModifyOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- * Creates a new instance of ModifyOperationContext.
- *
- * @param dn the dn of the entry to be modified
- * @param modItems the modifications to be performed on the entry
- */
- public ModifyOperationContext( CoreSession session, LdapDN dn, List<Modification> modItems )
- {
- super( session, dn );
-
- this.modItems = modItems;
- }
-
-
- public ModifyOperationContext( CoreSession session, InternalModifyRequest modifyRequest ) throws Exception
- {
- super( session, modifyRequest.getName() );
-
- modItems = ServerEntryUtils.toServerModification(
- modifyRequest.getModificationItems().toArray( new ClientModification[0]),
- session.getDirectoryService().getRegistries().getAttributeTypeRegistry() );
-
- requestControls = modifyRequest.getControls();
-
- if ( requestControls.containsKey( ManageDsaITControl.CONTROL_OID ) )
- {
- ignoreReferral();
- }
- else
- {
- throwReferral();
- }
- }
-
-
- /**
- * Set the modified attributes
- * @param modItems The modified attributes
- */
- public void setModItems( List<Modification> modItems )
- {
- this.modItems = modItems;
- }
-
-
- /**
- * @return The modifications
- */
- public List<Modification> getModItems()
- {
- return modItems;
- }
-
-
- public static List<Modification> createModItems( ServerEntry serverEntry, ModificationOperation modOp ) throws NamingException
- {
- List<Modification> items = new ArrayList<Modification>( serverEntry.size() );
-
- for ( EntryAttribute attribute:serverEntry )
- {
- items.add( new ServerModification( modOp, attribute ) );
- }
-
- return items;
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return MessageTypeEnum.MODIFY_REQUEST.name();
- }
-
-
- public void setEntry( ClonedServerEntry entry )
- {
- this.entry = entry;
- }
-
-
- public ClonedServerEntry getEntry()
- {
- return entry;
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
-
- sb.append("ModifyContext for DN '").append( getDn().getUpName() ).append( "', modifications :\n" );
-
- if ( modItems != null )
- {
- for ( Modification mod:modItems )
- {
- sb.append( mod ).append( '\n' );
- }
- }
-
- return sb.toString();
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
deleted file mode 100644
index 5c615c8..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.message.InternalModifyDnRequest;
-import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.name.Rdn;
-
-
-/**
- * A Move And Rename context used for Interceptors. It contains all the informations
- * needed for the modify DN operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class MoveAndRenameOperationContext extends RenameOperationContext
-{
- /** The parent DN */
- private LdapDN parent;
-
- /** Cached calculated new DN after move and rename */
- private LdapDN newDn;
-
- /**
- * Creates a new instance of MoveAndRenameOperationContext.
- */
- public MoveAndRenameOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- * Creates a new instance of MoveAndRenameOperationContext.
- *
- * @param oldDn the original source entry DN to be moved and renamed
- * @param parent the new entry superior of the target after the move
- * @param newRdn the new rdn to use for the target once renamed
- * @param delOldRdn true if the old rdn value is deleted, false otherwise
- */
- public MoveAndRenameOperationContext( CoreSession session, LdapDN oldDn, LdapDN parent, Rdn newRdn, boolean delOldRdn )
- {
- super( session, oldDn, newRdn, delOldRdn );
- this.parent = parent;
- }
-
-
- public MoveAndRenameOperationContext( CoreSession session, InternalModifyDnRequest modifyDnRequest )
- {
- // super sets the newRdn and the delOldRdn members and tests
- super( session, modifyDnRequest );
- this.parent = modifyDnRequest.getNewSuperior();
-
- if ( parent == null )
- {
- throw new IllegalStateException( "NewSuperior must not be null: " + modifyDnRequest );
- }
-
- if ( requestControls.containsKey( ManageDsaITControl.CONTROL_OID ) )
- {
- ignoreReferral();
- }
- else
- {
- throwReferral();
- }
- }
-
-
- /**
- * @return The parent DN
- */
- public LdapDN getParent()
- {
- return parent;
- }
-
-
- /**
- * Set the parent DN
- *
- * @param parent The parent
- */
- public void setParent( LdapDN parent )
- {
- this.parent = parent;
- }
-
-
- /**
- * Gets cached copy of already computed new name or creates it if not
- *
- * @return the normalized new name after move and rename
- * @throws Exception if the name cannot be normalized
- */
- public LdapDN getNewDn() throws Exception
- {
- if ( newDn == null )
- {
- newDn = new LdapDN( getParent().getUpName() );
- newDn.add( getNewRdn().getUpName() );
- newDn.normalize( session.getDirectoryService()
- .getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
- }
-
- return newDn;
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "ReplaceContext for old DN '" + getDn().getUpName() + "'" +
- ", parent '" + parent + "'";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
deleted file mode 100644
index f16ab60..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.InternalModifyDnRequest;
-import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * A Move context used for Interceptors. It contains all the informations
- * needed for the modify DN operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class MoveOperationContext extends AbstractChangeOperationContext
-{
- /** The parent DN */
- private LdapDN parent;
-
-
- /**
- * Creates a new instance of MoveOperationContext.
- */
- public MoveOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- * Creates a new instance of MoveOperationContext.
- */
- public MoveOperationContext( CoreSession session, LdapDN oldDn, LdapDN parent )
- {
- super( session, oldDn );
- this.parent = parent;
- }
-
-
- public MoveOperationContext( CoreSession session, InternalModifyDnRequest modifyDnRequest )
- {
- super( session, modifyDnRequest.getName() );
- this.parent = modifyDnRequest.getNewSuperior();
-
- if ( parent == null )
- {
- throw new IllegalArgumentException( "The new superior cannot be null for " + modifyDnRequest );
- }
-
- this.requestControls = modifyDnRequest.getControls();
-
- if ( modifyDnRequest.getNewRdn() != null )
- {
- throw new IllegalArgumentException( modifyDnRequest + " represents a move and rename operation." );
- }
-
- if ( requestControls.containsKey( ManageDsaITControl.CONTROL_OID ) )
- {
- ignoreReferral();
- }
- else
- {
- throwReferral();
- }
- }
-
-
- /**
- * @return The parent DN
- */
- public LdapDN getParent()
- {
- return parent;
- }
-
-
- /**
- * Set the parent DN
- *
- * @param parent The parent
- */
- public void setParent( LdapDN parent )
- {
- this.parent = parent;
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return MessageTypeEnum.MOD_DN_REQUEST.name();
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "ReplaceContext for old DN '" + getDn().getUpName() + "'" +
- ", parent '" + parent + "'";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java
deleted file mode 100644
index e1a36af..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/OperationContext.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.naming.ldap.Control;
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.LdapPrincipal;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.interceptor.Interceptor;
-import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * This interface represent the context passed as an argument to each interceptor.
- * It will contain data used by all the operations.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public interface OperationContext
-{
- /**
- * Checks to see if this operation is the first operation in a chain of
- * operations performed on the DirectoryService. The first operation in
- * a sequence of operations, is not a byproduct of another operation
- * unlike operations following in the sequence. The other operations
- * following the first, occur as a side effect to complete this first
- * operation.
- *
- * @return true if the operation is the first, false otherwise
- */
- boolean isFirstOperation();
-
-
- /**
- * Gets the first, direct operation issued against the DirectoryService.
- *
- * @return the first, direct operation issued
- */
- OperationContext getFirstOperation();
-
-
- /**
- * Gets the previous, operation issued on the DirectoryService.
- *
- * @return the previous, operation issued
- */
- OperationContext getPreviousOperation();
-
-
- /**
- * Gets the next, indirect operation issued on the DirectoryService.
- *
- * @return the next, indirect operation issued
- */
- OperationContext getNextOperation();
-
-
- /**
- * Gets the last, operation issued on the DirectoryService.
- *
- * @return the last, operation issued
- */
- OperationContext getLastOperation();
-
-
- /**
- * Gets the effective principal for this operation which may not be the
- * same as the authenticated principal when the session for this context
- * has an explicit authorization id, or this operation was applied with
- * the proxy authorization control.
- *
- * @see CoreSession#getAuthenticatedPrincipal()
- * @see CoreSession#getEffectivePrincipal()
- * @return the effective principal for this operation
- */
- LdapPrincipal getEffectivePrincipal();
-
-
- /**
- * @return The associated DN
- */
- LdapDN getDn();
-
-
- /**
- * Set the context DN
- *
- * @param dn The DN to set
- */
- void setDn( LdapDN dn );
-
-
- /**
- * Gets the server entry associated with the target DN of this
- * OperationContext. The entry associated with the DN may be altered
- * during the course of processing an LDAP operation through the
- * InterceptorChain. This place holder is put here to prevent the need
- * for repetitive lookups of the target entry. Furthermore the returned
- * entry may be altered by any Interceptor in the chain and this is why a
- * ClonedServerEntry is returned instead of a ServerEntry. A
- * ClonedServerEntry has an immutable reference to the original state of
- * the target entry. The original state can be accessed via a call to
- * {@link ClonedServerEntry#getOriginalEntry()}. The return value may be
- * null in which case any lookup performed to access it may set it to
- * prevent the need for subsequent lookups.
- *
- * Also note that during the course of handling some operations such as
- * those that rename, move or rename and move the entry, may alter the DN
- * of this entry. Interceptor implementors should not presume the DN or
- * the values contained in this entry are currently what is present in the
- * DIT. The original entry contained in the ClonedServerEntry shoudl be
- * used as the definitive source of information about the state of the
- * entry in the DIT before returning from the Partition subsystem.
- *
- * @return target entry associated with the DN of this OperationContext
- */
- ClonedServerEntry getEntry();
-
-
- /**
- * Sets the server entry associated with the target DN of this
- * OperationContext.
- *
- * @param entry the entry whose DN is associated with this OperationContext.
- */
- void setEntry( ClonedServerEntry entry );
-
-
- /**
- * Adds a response control to this operation.
- *
- * @param responseControl the response control to add to this operation
- */
- void addResponseControl( Control responseControl );
-
-
- /**
- * Checks to see if a response control is present on this operation.
- *
- * @param numericOid the numeric OID of the control also known as it's type OID
- * @return true if the control is associated with this operation, false otherwise
- */
- boolean hasResponseControl( String numericOid );
-
-
- /**
- * Gets a response control if present for this request.
- *
- * @param numericOid the numeric OID of the control also known as it's type OID
- * @return the control if present
- */
- Control getResponseControl( String numericOid );
-
-
- /**
- * Gets all the response controls producted during this operation.
- *
- * @return an array over all the response controls
- */
- Control[] getResponseControls();
-
-
- /**
- * Checks if any response controls have been generated for this operation.
- *
- * @return true if any response controls have been generated, false otherwise
- */
- boolean hasResponseControls();
-
-
- /**
- * Checks the number of response controls have been generated for this operation.
- *
- * @return the number of response controls that have been generated
- */
- int getResponseControlCount();
-
-
- /**
- * Adds a request control to this operation.
- *
- * @param requestControl the request control to add to this operation
- */
- void addRequestControl( Control requestControl );
-
-
- /**
- * Checks to see if a request control is present on this request.
- *
- * @param numericOid the numeric OID of the control also known as it's type OID
- * @return true if the control is associated with this operation, false otherwise
- */
- boolean hasRequestControl( String numericOid );
-
-
- /**
- * Checks if any request controls exists for this operation.
- *
- * @return true if any request controls exist, false otherwise
- */
- boolean hasRequestControls();
-
-
- /**
- * Gets a request control if present for this request.
- *
- * @param numericOid the numeric OID of the control also known as it's type OID
- * @return the control if present
- */
- Control getRequestControl( String numericOid );
-
-
- /**
- * Adds many request controls to this operation.
- *
- * @param requestControls the request controls to add to this operation
- */
- void addRequestControls( Control[] requestControls );
-
-
- /**
- * @return the operation's name
- */
- String getName();
-
-
- /**
- * Checks to see if an Interceptor is bypassed for this operation.
- *
- * @param interceptorName the interceptorName of the Interceptor to check for bypass
- * @return true if the Interceptor should be bypassed, false otherwise
- */
- boolean isBypassed( String interceptorName );
-
-
- /**
- * Checks to see if any Interceptors are bypassed by this Invocation.
- *
- * @return true if at least one bypass exists
- */
- boolean hasBypass();
-
-
- /**
- * Gets the set of bypassed Interceptors.
- *
- * @return the set of bypassed Interceptors
- */
- Collection<String> getByPassed();
-
-
- /**
- * Sets the set of bypassed Interceptors.
- *
- * @param byPassed the set of bypassed Interceptors
- */
- void setByPassed( Collection<String> byPassed );
-
-
- /**
- * Gets the session associated with this operation.
- *
- * @return the session associated with this operation
- */
- CoreSession getSession();
-
-
- // -----------------------------------------------------------------------
- // Utility Factory Methods to Create New OperationContexts
- // -----------------------------------------------------------------------
-
-
- LookupOperationContext newLookupContext( LdapDN dn );
-
-
- ClonedServerEntry lookup( LdapDN dn, Collection<String> byPass ) throws Exception;
-
-
- ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception;
-
-
- void modify( LdapDN dn, List<Modification> mods, Collection<String> byPass ) throws Exception;
-
-
- void add( ServerEntry entry, Collection<String> byPass ) throws Exception;
-
-
- void delete( LdapDN dn, Collection<String> byPass ) throws Exception;
-
-
- /**
- * Checks to see if an entry exists.
- *
- * @param dn the distinguished name of the entry to check
- * @param byPass collection of {@link Interceptor}'s to bypass for this check
- * @return true if the entry exists, false if it does not
- * @throws Exception on failure to perform this operation
- */
- boolean hasEntry( LdapDN dn, Collection<String> byPass ) throws Exception;
-
-
- /**
- * Set the throwReferral flag to true
- */
- void throwReferral();
-
-
- /**
- * @return <code>true</code> if the referrals are thrown
- */
- boolean isReferralThrown();
-
-
- /**
- * Set the throwReferral flag to false
- */
- void ignoreReferral();
-
-
- /**
- * @return <code>true</code> if the referrals are ignored
- */
- boolean isReferralIgnored();
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java
deleted file mode 100644
index a6f23d4..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/RemoveContextPartitionOperationContext.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-/**
- * A RemoveContextPartition context used for Interceptors. It contains all the informations
- * needed for the removeContextPartition operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class RemoveContextPartitionOperationContext extends AbstractOperationContext
-{
- /**
- * Creates a new instance of RemoveContextPartitionOperationContext.
- */
- public RemoveContextPartitionOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- * Creates a new instance of RemoveContextPartitionOperationContext.
- *
- * @param registries
- * @param dn The Entry DN from which the partition should be removed
- */
- public RemoveContextPartitionOperationContext( CoreSession session, LdapDN dn )
- {
- super( session, dn );
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return "RemoveContext";
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "RemoveContextPartitionOperationContext for DN '" + getDn().getUpName() + "'";
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
deleted file mode 100644
index b7896a9..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/RenameOperationContext.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
-import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.InternalModifyDnRequest;
-import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.name.Rdn;
-
-
-/**
- * A RenameService context used for Interceptors. It contains all the informations
- * needed for the modify DN operation, and used by all the interceptors
- *
- * This is used when the modifyDN is about changing the RDN, not the base DN.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class RenameOperationContext extends AbstractChangeOperationContext
-{
- /** The new RDN */
- private Rdn newRdn;
-
- /** Cached copy of the new DN */
- private LdapDN newDn;
-
- /** The flag to remove the old DN Attribute */
- private boolean delOldDn;
-
- /** The entry after being renamed and altered for rdn attributes */
- private ClonedServerEntry alteredEntry;
-
-
- /**
- * Creates a new instance of RenameOperationContext.
- */
- public RenameOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- * Creates a new instance of RenameOperationContext.
- *
- * @param oldDn the dn of the entry before the rename
- * @param newRdn the new RDN to use for the target
- * @param delOldDn true if we delete the old RDN value
- */
- public RenameOperationContext( CoreSession session, LdapDN oldDn, Rdn newRdn, boolean delOldDn )
- {
- super( session, oldDn );
- this.newRdn = newRdn;
- this.delOldDn = delOldDn;
- }
-
-
- public RenameOperationContext( CoreSession session, InternalModifyDnRequest modifyDnRequest )
- {
- super( session, modifyDnRequest.getName() );
- this.newRdn = modifyDnRequest.getNewRdn();
-
- if ( newRdn == null )
- {
- throw new IllegalStateException( "newRdn must not be null for a rename: " + modifyDnRequest );
- }
-
- this.delOldDn = modifyDnRequest.getDeleteOldRdn();
- this.requestControls = modifyDnRequest.getControls();
-
- if ( requestControls.containsKey( ManageDsaITControl.CONTROL_OID ) )
- {
- ignoreReferral();
- }
- else
- {
- throwReferral();
- }
- }
-
-
- /**
- * @return The delete old DN flag
- */
- public boolean getDelOldDn()
- {
- return delOldDn;
- }
-
-
- /**
- * Set the flag to delete the old DN
- * @param delOldDn the flag to set
- */
- public void setDelOldDn( boolean delOldDn )
- {
- this.delOldDn = delOldDn;
- }
-
-
- /**
- * @return The new DN either computed if null or already computed
- */
- public LdapDN getNewDn() throws Exception
- {
- if ( newDn == null )
- {
- newDn = new LdapDN( getDn().getUpName() );
- newDn.remove( newDn.size() - 1 );
- newDn.add( newRdn.getUpName() );
- newDn.normalize( session.getDirectoryService().getRegistries()
- .getAttributeTypeRegistry().getNormalizerMapping() );
- }
-
- return newDn;
- }
-
-
- /**
- * @return The new RDN
- */
- public Rdn getNewRdn()
- {
- return newRdn;
- }
-
-
- /**
- * Set the new RDN
- * @param newRdn The new RDN
- */
- public void setNewRdn( Rdn newRdn )
- {
- this.newRdn = newRdn;
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return MessageTypeEnum.MOD_DN_REQUEST.name();
- }
-
-
- /**
- * Returns the entry after it has been renamed and potentially changed for
- * Rdn alterations.
- *
- * @return the new renamed entry
- */
- public ClonedServerEntry getAlteredEntry()
- {
- return alteredEntry;
- }
-
-
- public void setAlteredEntry( ClonedServerEntry alteredEntry )
- {
- this.alteredEntry = alteredEntry;
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "RenameContext for old DN '" + getDn().getUpName() + "'" +
- ", new RDN '" + newRdn + "'" +
- ( delOldDn ? ", delete old Dn" : "" ) ;
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java
deleted file mode 100644
index 72d47e6..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/SearchOperationContext.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import java.util.Set;
-
-import javax.naming.directory.SearchControls;
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.filter.SearchScope;
-import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.InternalSearchRequest;
-import org.apache.directory.shared.ldap.message.control.ManageDsaITControl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
-
-
-/**
- * A Search context used for Interceptors. It contains all the informations
- * needed for the search operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class SearchOperationContext extends SearchingOperationContext
-{
- /** The filter */
- private ExprNode filter;
-
-
- /**
- * Creates a new instance of SearchOperationContext.
- */
- public SearchOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- * Creates a new instance of SearchOperationContext.
- * @throws Exception
- */
- public SearchOperationContext( CoreSession session, InternalSearchRequest searchRequest ) throws Exception
- {
- super( session );
-
- this.dn = searchRequest.getBase();
- this.filter = searchRequest.getFilter();
- this.abandoned = searchRequest.isAbandoned();
- this.aliasDerefMode = searchRequest.getDerefAliases();
-
- this.requestControls = searchRequest.getControls();
- this.scope = searchRequest.getScope();
- this.sizeLimit = searchRequest.getSizeLimit();
- this.timeLimit = searchRequest.getTimeLimit();
- this.noAttributes = searchRequest.getTypesOnly();
- setReturningAttributes( searchRequest.getAttributes() );
-
- if ( requestControls.containsKey( ManageDsaITControl.CONTROL_OID ) )
- {
- ignoreReferral();
- }
- else
- {
- throwReferral();
- }
- }
-
-
- /**
- * Creates a new instance of SearchOperationContext.
- *
- * @param aliasDerefMode the alias dereferencing mode
- * @param dn the dn of the search base
- * @param filter the filter AST to use for the search
- * @param searchControls the search controls
- */
- public SearchOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode, ExprNode filter,
- SearchControls searchControls ) throws Exception
- {
- super( session, dn, aliasDerefMode, searchControls );
- this.filter = filter;
- }
-
-
- /**
- * Creates a new instance of SearchOperationContext.
- *
- * @param session the session this operation is associated with
- * @param dn the search base
- * @param scope the search scope
- * @param filter the filter AST to use for the search
- * @param aliasDerefMode the alias dereferencing mode
- * @param returningAttributes the attributes to return
- */
- public SearchOperationContext( CoreSession session, LdapDN dn, SearchScope scope,
- ExprNode filter, AliasDerefMode aliasDerefMode, Set<AttributeTypeOptions> returningAttributes )
- {
- super( session, dn, aliasDerefMode, returningAttributes );
- super.setScope( scope );
- this.filter = filter;
- }
-
-
- /**
- * Checks whether or not the ManageDsaITControl is present. If not
- * present then the filter is modified to force the return of all referral
- * entries regardless of whether or not the filter matches the referral
- * entry.
- */
- public boolean hasManageDsaItControl()
- {
- return super.hasRequestControl( ManageDsaITControl.CONTROL_OID );
- }
-
-
- /**
- * @return The filter
- */
- public ExprNode getFilter()
- {
- return filter;
- }
-
-
- /**
- * Set the filter into the context.
- *
- * @param filter The filter to set
- */
- public void setFilter( ExprNode filter )
- {
- this.filter = filter;
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "SearchContext for DN '" + getDn().getUpName() + "', filter :'"
- + filter + "'";
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return MessageTypeEnum.SEARCH_REQUEST.name();
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/SearchingOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/SearchingOperationContext.java
deleted file mode 100644
index 329ea97..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/SearchingOperationContext.java
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.naming.NamingException;
-import javax.naming.directory.NoSuchAttributeException;
-import javax.naming.directory.SearchControls;
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.filter.SearchScope;
-import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
-import org.apache.directory.shared.ldap.schema.SchemaUtils;
-import org.apache.directory.shared.ldap.util.ArrayUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.directory.shared.ldap.filter.SearchScope.ONELEVEL;
-
-
-/**
- * A context used for search related operations and used by all
- * the Interceptors.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public abstract class SearchingOperationContext extends AbstractOperationContext
-{
- /** The LoggerFactory used by this Interceptor */
- private static Logger LOG = LoggerFactory.getLogger( SearchingOperationContext.class );
-
- private static String[] EMPTY_STR_ARRAY = new String[0];
-
- /** A flag describing the way alias should be handled */
- protected AliasDerefMode aliasDerefMode = AliasDerefMode.DEREF_ALWAYS;
-
- /** The sizeLimit for this search operation */
- protected long sizeLimit = 0;
-
- /** The timeLimit for this search operation */
- protected int timeLimit = 0;
-
- /** The scope for this search : default to One Level */
- protected SearchScope scope = ONELEVEL;
-
- /** A flag set if the returned attributes set contains '+' */
- protected boolean allOperationalAttributes = false;
-
- /** A flag set if the returned attributes set contains '*' */
- protected boolean allUserAttributes = false;
-
- /** A flag set if the returned attributes set contains '1.1' */
- protected boolean noAttributes = false;
-
- /** A set containing the returning attributeTypesOptions */
- protected Set<AttributeTypeOptions> returningAttributes;
-
- /** A flag if the search operation is abandoned */
- protected boolean abandoned = false;
-
-
- /**
- * Creates a new instance of ListOperationContext.
- */
- public SearchingOperationContext( CoreSession session )
- {
- super( session );
- }
-
-
- /**
- * Creates a new instance of ListOperationContext.
- *
- * @param dn The DN to get the suffix from
- */
- public SearchingOperationContext( CoreSession session, LdapDN dn )
- {
- super( session, dn );
- }
-
-
- /**
- * Creates a new instance of ListOperationContext.
- *
- * @param dn The DN to get the suffix from
- * @param aliasDerefMode the alias dereferencing mode to use
- */
- public SearchingOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode )
- {
- super( session, dn );
- this.aliasDerefMode = aliasDerefMode;
- }
-
-
- protected void setReturningAttributes( Collection<String> attributesIds )
- throws Exception
- {
- setReturningAttributes( attributesIds.toArray( EMPTY_STR_ARRAY ) );
- }
-
-
- protected void setReturningAttributes( String[] attributesIds ) throws Exception
- {
- if ( attributesIds != null && attributesIds.length != 0 )
- {
- returningAttributes = new HashSet<AttributeTypeOptions>();
-
- for ( String returnAttribute : attributesIds )
- {
- if ( returnAttribute.equals( SchemaConstants.NO_ATTRIBUTE ) )
- {
- noAttributes = true;
- continue;
- }
-
- if ( returnAttribute.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
- {
- allOperationalAttributes = true;
- continue;
- }
-
- if ( returnAttribute.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) )
- {
- allUserAttributes = true;
- continue;
- }
-
- try
- {
- String id = SchemaUtils.stripOptions( returnAttribute );
- Set<String> options = SchemaUtils.getOptions( returnAttribute );
-
- AttributeType attributeType = session.getDirectoryService()
- .getRegistries().getAttributeTypeRegistry().lookup( id );
- AttributeTypeOptions attrOptions = new AttributeTypeOptions( attributeType, options );
-
- returningAttributes.add( attrOptions );
- }
- catch ( NoSuchAttributeException nsae )
- {
- LOG.warn( "Requested attribute {} does not exist in the schema, it will be ignored", returnAttribute );
- // Unknown attributes should be silently ignored, as RFC 2251 states
- }
- }
- }
- }
-
-
- /**
- * Creates a new instance of ListOperationContext.
- *
- * @param dn The DN to get the suffix from
- * @param aliasDerefMode the alias dereferencing mode to use
- * @throws NamingException
- */
- public SearchingOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode,
- SearchControls searchControls ) throws Exception
- {
- super( session, dn );
- this.aliasDerefMode = aliasDerefMode;
- this.scope = SearchScope.getSearchScope( searchControls );
- this.timeLimit = searchControls.getTimeLimit();
- this.sizeLimit = searchControls.getCountLimit();
-
- if ( searchControls.getReturningAttributes() != null )
- {
- setReturningAttributes( searchControls.getReturningAttributes() );
- }
- }
-
-
- /**
- * Creates a new instance of a SearchingOperationContext using one level
- * scope, with attributes to return.
- *
- * @param dn The DN to get the suffix from
- * @param aliasDerefMode the alias dereferencing mode to use
- * @throws NamingException
- */
- public SearchingOperationContext( CoreSession session, LdapDN dn, AliasDerefMode aliasDerefMode,
- Set<AttributeTypeOptions> returningAttributes )
- {
- super( session, dn );
- this.aliasDerefMode = aliasDerefMode;
- this.returningAttributes = returningAttributes;
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "ListOperationContext with DN '" + getDn().getUpName() + "'";
- }
-
-
- public AliasDerefMode getAliasDerefMode()
- {
- return aliasDerefMode;
- }
-
-
- /**
- * @param sizeLimit the sizeLimit to set
- */
- public void setSizeLimit( long sizeLimit )
- {
- this.sizeLimit = sizeLimit;
- }
-
-
- /**
- * @return the sizeLimit
- */
- public long getSizeLimit()
- {
- return sizeLimit;
- }
-
-
- /**
- * @param timeLimit the timeLimit to set
- */
- public void setTimeLimit( int timeLimit )
- {
- this.timeLimit = timeLimit;
- }
-
-
- /**
- * @return the timeLimit
- */
- public int getTimeLimit()
- {
- return timeLimit;
- }
-
-
- /**
- * @param scope the scope to set
- */
- public void setScope( SearchScope scope )
- {
- this.scope = scope;
- }
-
-
- /**
- * @return the scope
- */
- public SearchScope getScope()
- {
- return scope;
- }
-
-
- /**
- * @param allOperationalAttributes the allOperationalAttributes to set
- */
- public void setAllOperationalAttributes( boolean allOperationalAttribute )
- {
- this.allOperationalAttributes = allOperationalAttribute;
- }
-
-
- /**
- * @return the allOperationalAttributes
- */
- public boolean isAllOperationalAttributes()
- {
- return allOperationalAttributes;
- }
-
-
- /**
- * @param allUserAttributes the allUserAttributes to set
- */
- public void setAllUserAttributes( boolean allUserAttributes )
- {
- this.allUserAttributes = allUserAttributes;
- }
-
-
- /**
- * @return the allUserAttributes
- */
- public boolean isAllUserAttributes()
- {
- return allUserAttributes;
- }
-
-
- /**
- * @param noAttributes the noAttributes to set
- */
- public void setNoAttributes( boolean noAttributes )
- {
- this.noAttributes = noAttributes;
- }
-
-
- /**
- * @return the noAttributes
- */
- public boolean isNoAttributes()
- {
- return noAttributes;
- }
-
-
- /**
- * @param returningAttributes the returningAttributes to set
- */
- public void setReturningAttributes( Set<AttributeTypeOptions> returningAttributes )
- {
- this.returningAttributes = returningAttributes;
- }
-
-
- /**
- * @return the returningAttributes
- */
- public Set<AttributeTypeOptions> getReturningAttributes()
- {
- return returningAttributes;
- }
-
-
- /**
- * Creates a new SearchControls object populated with the parameters
- * contained in this SearchOperationContext in normalized form.
- *
- * @return a new SearchControls object
- */
- public SearchControls getSearchControls()
- {
- return getSearchControls( false );
- }
-
-
- /**
- * Creates a new SearchControls object populated with the parameters
- * contained in this SearchOperationContext.
- *
- * @param denormalized true if attribute values are <b>not</b> normalized
- * @return a new SearchControls object
- */
- public SearchControls getSearchControls( boolean denormalized )
- {
- SearchControls controls = new SearchControls();
- controls.setCountLimit( sizeLimit );
- controls.setSearchScope( scope.getJndiScope() );
- controls.setTimeLimit( timeLimit );
-
- Set<String> allReturningAttributes = new HashSet<String>();
-
- if ( noAttributes )
- {
- allReturningAttributes.add( SchemaConstants.NO_ATTRIBUTE );
- }
-
- if ( allUserAttributes )
- {
- allReturningAttributes.add( SchemaConstants.ALL_USER_ATTRIBUTES );
- }
-
- if ( allOperationalAttributes )
- {
- allReturningAttributes.add( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES );
- }
-
- if ( returningAttributes != null )
- {
- for ( AttributeTypeOptions at : returningAttributes )
- {
- if ( denormalized )
- {
- allReturningAttributes.add( at.getAttributeType().getName() );
- }
- else
- {
- allReturningAttributes.add( at.getAttributeType().getOid() );
- }
- }
- }
-
- if ( allReturningAttributes.size() > 0 )
- {
- controls.setReturningAttributes( allReturningAttributes.toArray( ArrayUtils.EMPTY_STRING_ARRAY ) );
- }
-
- return controls;
- }
-
-
- /**
- * @param abandoned the abandoned to set
- */
- public void setAbandoned( boolean abandoned )
- {
- this.abandoned = abandoned;
- }
-
-
- /**
- * @return the abandoned
- */
- public boolean isAbandoned()
- {
- return abandoned;
- }
-}
diff --git a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java b/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java
deleted file mode 100644
index c922d50..0000000
--- a/core-interceptor/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.directory.server.core.interceptor.context;
-
-
-import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.InternalUnbindRequest;
-
-
-/**
- * A Unbind context used for Interceptors. It contains all the informations
- * needed for the unbind operation, and used by all the interceptors
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class UnbindOperationContext extends AbstractOperationContext
-{
- /**
- * Creates a new instance of UnbindOperationContext.
- */
- public UnbindOperationContext( CoreSession session )
- {
- super( session, session.getEffectivePrincipal().getJndiName() );
- }
-
-
- public UnbindOperationContext( CoreSession session, InternalUnbindRequest unbindRequest )
- {
- super( session, session.getEffectivePrincipal().getJndiName() );
- this.setRequestControls( unbindRequest.getControls() );
- }
-
-
- /**
- * @return the operation name
- */
- public String getName()
- {
- return MessageTypeEnum.UNBIND_REQUEST.name();
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- return "UnbindContext for DN '" + getDn().getUpName() + "'";
- }
-}
diff --git a/core/pom.xml b/core/pom.xml
index d0a3df3..672dcae 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -69,12 +69,6 @@
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-core-interceptor</artifactId>
- <version>${pom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-api</artifactId>
<version>${pom.version}</version>
</dependency>
diff --git a/jdbm-partition/pom.xml b/jdbm-partition/pom.xml
index 6803c13..519d426 100644
--- a/jdbm-partition/pom.xml
+++ b/jdbm-partition/pom.xml
@@ -74,12 +74,6 @@
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-core-interceptor</artifactId>
- <version>${pom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-api</artifactId>
<version>${pom.version}</version>
</dependency>
diff --git a/ldif-partition/pom.xml b/ldif-partition/pom.xml
index 5399d60..f97bc1f 100644
--- a/ldif-partition/pom.xml
+++ b/ldif-partition/pom.xml
@@ -50,12 +50,6 @@
<dependency>
<groupId>org.apache.directory.server</groupId>
- <artifactId>apacheds-core-interceptor</artifactId>
- <version>${pom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-api</artifactId>
<version>${pom.version}</version>
</dependency>
diff --git a/pom.xml b/pom.xml
index d8ad271..2761a78 100644
--- a/pom.xml
+++ b/pom.xml
@@ -351,7 +351,6 @@
<module>core-api</module>
<module>core-jndi</module>
<module>core-constants</module>
- <module>core-interceptor</module>
<module>core-shared</module>
<module>core-plugin</module>
<module>core-unit</module>