001    /*
002     *   Licensed to the Apache Software Foundation (ASF) under one
003     *   or more contributor license agreements.  See the NOTICE file
004     *   distributed with this work for additional information
005     *   regarding copyright ownership.  The ASF licenses this file
006     *   to you under the Apache License, Version 2.0 (the
007     *   "License"); you may not use this file except in compliance
008     *   with the License.  You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     *   Unless required by applicable law or agreed to in writing,
013     *   software distributed under the License is distributed on an
014     *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *   KIND, either express or implied.  See the License for the
016     *   specific language governing permissions and limitations
017     *   under the License.
018     *
019     */
020    package org.apache.directory.server.core.partition;
021    
022    
023    import java.util.Collection;
024    import java.util.Collections;
025    import java.util.HashSet;
026    
027    import org.apache.directory.server.core.interceptor.Interceptor;
028    
029    
030    /**
031     * Constants used to determine what kinds of {@link Interceptor}s need to be 
032     * bypassed while performing operations within other Interceptors.
033     *
034     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
035     * @version $Rev$, $Date$
036     */
037    public class ByPassConstants
038    {
039        /**
040         * safe to use set of bypass instructions to lookup raw entries
041         */
042        public final static Collection<String> LOOKUP_BYPASS;
043    
044        /**
045         * safe to use set of bypass instructions to lookup raw entries while
046         * also avoiding hit on collective attributes {@link Interceptor}: used 
047         * by collective attributes interceptor.
048         */
049        public static final Collection<String> LOOKUP_COLLECTIVE_BYPASS;
050    
051        /**
052         * bypass instructions used by ExceptionInterceptor
053         */
054        public final static Collection<String> HAS_ENTRY_BYPASS;
055    
056        /**
057         * safe to use set of bypass instructions to getMatchedDn
058         */
059        public static final Collection<String> GETMATCHEDDN_BYPASS;
060    
061        /**
062         * safe to use set of bypass instructions to lookup raw entries excluding operational attributes
063         */
064        public static final Collection<String> LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS;
065        
066        public static final Collection<String> GET_ROOT_DSE_BYPASS;
067    
068        /**
069         * Bypass String to use when ALL interceptors should be skipped
070         */
071        public static final String BYPASS_ALL = "*";
072    
073        /**
074         * Bypass String to use when ALL interceptors should be skipped
075         */
076        public static final Collection<String> BYPASS_ALL_COLLECTION = Collections.singleton( BYPASS_ALL );
077    
078        /** Bypass for when we modify schema attributes */
079        public static final Collection<String> SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS;
080        
081        static
082        {
083            Collection<String> c = new HashSet<String>();
084            c.add( "org.apache.directory.server.core.normalization.NormalizationInterceptor" );
085            c.add( "org.apache.directory.server.core.authn.AuthenticationInterceptor" );
086            c.add( "org.apache.directory.server.core.authz.AciAuthorizationInterceptor" );
087            c.add( "org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor" );
088            c.add( "org.apache.directory.server.core.operational.OperationalAttributeInterceptor" );
089            c.add( "org.apache.directory.server.core.schema.SchemaInterceptor" );
090            c.add( "org.apache.directory.server.core.subtree.SubentryInterceptor" );
091            c.add( "org.apache.directory.server.core.event.EventInterceptor" );
092            c.add( "org.apache.directory.server.core.journal.JournalInterceptor" );
093            LOOKUP_BYPASS = Collections.unmodifiableCollection( c );
094    
095            c = new HashSet<String>();
096            c.add( "org.apache.directory.server.core.normalization.NormalizationInterceptor" );
097            c.add( "org.apache.directory.server.core.authn.AuthenticationInterceptor" );
098            c.add( "org.apache.directory.server.core.authz.AciAuthorizationInterceptor" );
099            c.add( "org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor" );
100            c.add( "org.apache.directory.server.core.exception.ExceptionInterceptor" );
101            c.add( "org.apache.directory.server.core.operational.OperationalAttributeInterceptor" );
102            c.add( "org.apache.directory.server.core.schema.SchemaInterceptor" );
103            c.add( "org.apache.directory.server.core.subtree.SubentryInterceptor" );
104            c.add( "org.apache.directory.server.core.event.EventInterceptor" );
105            c.add( "org.apache.directory.server.core.journal.JournalInterceptor" );
106            HAS_ENTRY_BYPASS = Collections.unmodifiableCollection( c );
107    
108            c = new HashSet<String>();
109            c.add( "org.apache.directory.server.core.normalization.NormalizationInterceptor" );
110            c.add( "org.apache.directory.server.core.authn.AuthenticationInterceptor" );
111            c.add( "org.apache.directory.server.core.authz.AciAuthorizationInterceptor" );
112            c.add( "org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor" );
113            c.add( "org.apache.directory.server.core.collective.CollectiveAttributeInterceptor" );
114            c.add( "org.apache.directory.server.core.operational.OperationalAttributeInterceptor" );
115            c.add( "org.apache.directory.server.core.schema.SchemaInterceptor" );
116            c.add( "org.apache.directory.server.core.subtree.SubentryInterceptor" );
117            c.add( "org.apache.directory.server.core.event.EventInterceptor" );
118            c.add( "org.apache.directory.server.core.journal.JournalInterceptor" );
119            LOOKUP_COLLECTIVE_BYPASS = Collections.unmodifiableCollection( c );
120    
121            c = new HashSet<String>();
122            c.add( "org.apache.directory.server.core.authn.AuthenticationInterceptor" );
123            c.add( "org.apache.directory.server.core.authz.AciAuthorizationInterceptor" );
124            c.add( "org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor" );
125            c.add( "org.apache.directory.server.core.schema.SchemaInterceptor" );
126            c.add( "org.apache.directory.server.core.operational.OperationalAttributeInterceptor" );
127            c.add( "org.apache.directory.server.core.subtree.SubentryInterceptor" );
128            c.add( "org.apache.directory.server.core.event.EventInterceptor" );
129            c.add( "org.apache.directory.server.core.journal.JournalInterceptor" );
130            GETMATCHEDDN_BYPASS = Collections.unmodifiableCollection( c );
131    
132            c = new HashSet<String>();
133            c.add( "org.apache.directory.server.core.normalization.NormalizationInterceptor" );
134            c.add( "org.apache.directory.server.core.authn.AuthenticationInterceptor" );
135            c.add( "org.apache.directory.server.core.authz.AciAuthorizationInterceptor" );
136            c.add( "org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor" );
137            c.add( "org.apache.directory.server.core.schema.SchemaInterceptor" );
138            c.add( "org.apache.directory.server.core.subtree.SubentryInterceptor" );
139            c.add( "org.apache.directory.server.core.event.EventInterceptor" );
140            c.add( "org.apache.directory.server.core.trigger.TriggerInterceptor" );
141            c.add( "org.apache.directory.server.core.journal.JournalInterceptor" );
142            LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS = Collections.unmodifiableCollection( c );
143                    
144            c = new HashSet<String>();
145            c.add( "org.apache.directory.server.core.normalization.NormalizationInterceptor" );
146            c.add( "org.apache.directory.server.core.changelog.ChangeLogInterceptor" );
147            c.add( "org.apache.directory.server.core.authz.AciAuthorizationInterceptor" );
148            c.add( "org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor" );
149            c.add( "org.apache.directory.server.core.exception.ExceptionInterceptor" );
150            c.add( "org.apache.directory.server.core.operational.OperationalAttributeInterceptor" );
151            c.add( "org.apache.directory.server.core.schema.SchemaInterceptor" );
152            c.add( "org.apache.directory.server.core.subtree.SubentryInterceptor" );
153            c.add( "org.apache.directory.server.core.collective.CollectiveAttributeInterceptor" );
154            c.add( "org.apache.directory.server.core.event.EventInterceptor" );
155            c.add( "org.apache.directory.server.core.trigger.TriggerInterceptor" );
156            c.add( "org.apache.directory.server.core.journal.JournalInterceptor" );
157            GET_ROOT_DSE_BYPASS = Collections.unmodifiableCollection( c );
158            
159            
160            c = new HashSet<String>();
161            c.add( "org.apache.directory.server.core.normalization.NormalizationInterceptor" );
162            c.add( "org.apache.directory.server.core.authz.AciAuthorizationInterceptor" );
163            c.add( "org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor" );
164            c.add( "org.apache.directory.server.core.exception.ExceptionInterceptor" );
165            c.add( "org.apache.directory.server.core.schema.SchemaInterceptor" );
166            c.add( "org.apache.directory.server.core.collective.CollectiveAttributeInterceptor" );
167            c.add( "org.apache.directory.server.core.journal.JournalInterceptor" );
168            SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS = Collections.unmodifiableCollection( c );
169        }
170    }