1 17 package org.apache.ldap.server.interceptor; 18 19 20 import org.apache.ldap.server.authn.LdapPrincipal; 21 import org.apache.ldap.server.invocation.*; 22 import org.apache.ldap.server.jndi.ServerContext; 23 24 import javax.naming.NamingException ; 25 26 27 53 public abstract class BaseInterceptor implements Interceptor 54 { 55 60 public static LdapPrincipal getPrincipal( Invocation call ) 61 { 62 ServerContext ctx = ( ServerContext ) call.getContextStack().peek(); 63 return ctx.getPrincipal(); 64 } 65 66 67 protected BaseInterceptor() 68 { 69 } 70 71 72 76 80 public void process( NextInterceptor nextInterceptor, Invocation call ) 81 throws NamingException 82 { 83 if ( call instanceof Add ) 84 { 85 process( nextInterceptor, ( Add ) call ); 86 } 87 else if ( call instanceof Delete ) 88 { 89 process( nextInterceptor, ( Delete ) call ); 90 } 91 else if ( call instanceof GetMatchedDN ) 92 { 93 process( nextInterceptor, ( GetMatchedDN ) call ); 94 } 95 else if ( call instanceof GetSuffix ) 96 { 97 process( nextInterceptor, ( GetSuffix ) call ); 98 } 99 else if ( call instanceof HasEntry ) 100 { 101 process( nextInterceptor, ( HasEntry ) call ); 102 } 103 else if ( call instanceof IsSuffix ) 104 { 105 process( nextInterceptor, ( IsSuffix ) call ); 106 } 107 else if ( call instanceof List ) 108 { 109 process( nextInterceptor, ( List ) call ); 110 } 111 else if ( call instanceof ListSuffixes ) 112 { 113 process( nextInterceptor, ( ListSuffixes ) call ); 114 } 115 else if ( call instanceof Lookup ) 116 { 117 process( nextInterceptor, ( Lookup ) call ); 118 } 119 else if ( call instanceof LookupWithAttrIds ) 120 { 121 process( nextInterceptor, ( LookupWithAttrIds ) call ); 122 } 123 else if ( call instanceof Modify ) 124 { 125 process( nextInterceptor, ( Modify ) call ); 126 } 127 else if ( call instanceof ModifyMany ) 128 { 129 process( nextInterceptor, ( ModifyMany ) call ); 130 } 131 else if ( call instanceof ModifyRN ) 132 { 133 process( nextInterceptor, ( ModifyRN ) call ); 134 } 135 else if ( call instanceof Move ) 136 { 137 process( nextInterceptor, ( Move ) call ); 138 } 139 else if ( call instanceof MoveAndModifyRN ) 140 { 141 process( nextInterceptor, ( MoveAndModifyRN ) call ); 142 } 143 else if ( call instanceof Search ) 144 { 145 process( nextInterceptor, ( Search ) call ); 146 } 147 else 148 { 149 throw new IllegalArgumentException ( "Unknown call type: " + call.getClass() ); 150 } 151 } 152 153 154 158 159 protected void process( NextInterceptor nextInterceptor, Add call ) throws NamingException 160 { 161 nextInterceptor.process( call ); 162 } 163 164 165 protected void process( NextInterceptor nextInterceptor, Delete call ) throws NamingException 166 { 167 nextInterceptor.process( call ); 168 } 169 170 171 protected void process( NextInterceptor nextInterceptor, GetMatchedDN call ) throws NamingException 172 { 173 nextInterceptor.process( call ); 174 } 175 176 177 protected void process( NextInterceptor nextInterceptor, GetSuffix call ) throws NamingException 178 { 179 nextInterceptor.process( call ); 180 } 181 182 183 protected void process( NextInterceptor nextInterceptor, HasEntry call ) throws NamingException 184 { 185 nextInterceptor.process( call ); 186 } 187 188 189 protected void process( NextInterceptor nextInterceptor, IsSuffix call ) throws NamingException 190 { 191 nextInterceptor.process( call ); 192 } 193 194 195 protected void process( NextInterceptor nextInterceptor, List call ) throws NamingException 196 { 197 nextInterceptor.process( call ); 198 } 199 200 201 protected void process( NextInterceptor nextInterceptor, ListSuffixes call ) throws NamingException 202 { 203 nextInterceptor.process( call ); 204 } 205 206 207 protected void process( NextInterceptor nextInterceptor, Lookup call ) throws NamingException 208 { 209 nextInterceptor.process( call ); 210 } 211 212 213 protected void process( NextInterceptor nextInterceptor, LookupWithAttrIds call ) throws NamingException 214 { 215 nextInterceptor.process( call ); 216 } 217 218 219 protected void process( NextInterceptor nextInterceptor, Modify call ) throws NamingException 220 { 221 nextInterceptor.process( call ); 222 } 223 224 225 protected void process( NextInterceptor nextInterceptor, ModifyMany call ) throws NamingException 226 { 227 nextInterceptor.process( call ); 228 } 229 230 231 protected void process( NextInterceptor nextInterceptor, ModifyRN call ) throws NamingException 232 { 233 nextInterceptor.process( call ); 234 } 235 236 237 protected void process( NextInterceptor nextInterceptor, Move call ) throws NamingException 238 { 239 nextInterceptor.process( call ); 240 } 241 242 243 protected void process( NextInterceptor nextInterceptor, MoveAndModifyRN call ) throws NamingException 244 { 245 nextInterceptor.process( call ); 246 } 247 248 249 protected void process( NextInterceptor nextInterceptor, Search call ) throws NamingException 250 { 251 nextInterceptor.process( call ); 252 } 253 } 254 | Popular Tags |