1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.core.interceptor;
21
22
23 import org.apache.directory.server.core.DirectoryService;
24 import org.apache.directory.server.core.authn.LdapPrincipal;
25 import org.apache.directory.server.core.entry.ClonedServerEntry;
26 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
27 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
28 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
29 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
30 import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
31 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
32 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
33 import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
34 import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
35 import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
36 import org.apache.directory.server.core.interceptor.context.ListOperationContext;
37 import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
38 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
39 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
40 import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
41 import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
42 import org.apache.directory.server.core.interceptor.context.OperationContext;
43 import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
44 import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
45 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
46 import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
47 import org.apache.directory.server.core.invocation.InvocationStack;
48 import org.apache.directory.shared.ldap.name.LdapDN;
49
50 import javax.naming.Context;
51 import java.util.Iterator;
52
53
54
55
56
57
58
59
60
61
62
63
64 public abstract class BaseInterceptor implements Interceptor
65 {
66
67
68
69
70
71 public String getName()
72 {
73 return getClass().getName();
74 }
75
76
77
78
79
80
81 public static LdapPrincipal getPrincipal()
82 {
83 return getContext().getSession().getEffectivePrincipal();
84 }
85
86
87
88
89
90
91
92 public static OperationContext getContext()
93 {
94 return InvocationStack.getInstance().peek();
95 }
96
97
98
99
100
101 protected BaseInterceptor()
102 {
103 }
104
105
106
107
108
109
110 public void init( DirectoryService directoryService ) throws Exception
111 {
112 }
113
114
115
116
117
118 public void destroy()
119 {
120 }
121
122
123
124
125
126
127 public void add( NextInterceptor next, AddOperationContext opContext ) throws Exception
128 {
129 next.add( opContext );
130 }
131
132
133 public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
134 {
135 next.delete( opContext );
136 }
137
138
139 public LdapDN getMatchedName ( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws Exception
140 {
141 return next.getMatchedName( opContext );
142 }
143
144
145 public ClonedServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext opContext ) throws Exception
146 {
147 return next.getRootDSE( opContext );
148 }
149
150
151 public LdapDN getSuffix( NextInterceptor next, GetSuffixOperationContext opContext ) throws Exception
152 {
153 return next.getSuffix( opContext );
154 }
155
156
157 public boolean hasEntry( NextInterceptor next, EntryOperationContext opContext ) throws Exception
158 {
159 return next.hasEntry( opContext );
160 }
161
162
163 public EntryFilteringCursor list( NextInterceptor next, ListOperationContext opContext ) throws Exception
164 {
165 return next.list( opContext );
166 }
167
168
169 public Iterator<String> listSuffixes ( NextInterceptor next, ListSuffixOperationContext opContext )
170 throws Exception
171 {
172 return next.listSuffixes( opContext );
173 }
174
175
176 public ClonedServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws Exception
177 {
178 return next.lookup( opContext );
179 }
180
181
182 public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
183 {
184 next.modify( opContext );
185 }
186
187
188 public void rename( NextInterceptor next, RenameOperationContext opContext ) throws Exception
189 {
190 next.rename( opContext );
191 }
192
193
194 public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext )
195 throws Exception
196 {
197 next.moveAndRename( opContext );
198 }
199
200
201 public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
202 {
203 next.move( opContext );
204 }
205
206
207 public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext opContext ) throws Exception
208 {
209 return next.search( opContext );
210 }
211
212
213 public void addContextPartition( NextInterceptor next, AddContextPartitionOperationContext opContext ) throws Exception
214 {
215 next.addContextPartition( opContext );
216 }
217
218
219 public void removeContextPartition( NextInterceptor next, RemoveContextPartitionOperationContext opContext ) throws Exception
220 {
221 next.removeContextPartition( opContext );
222 }
223
224
225 public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws Exception
226 {
227 return next.compare( opContext );
228 }
229
230
231 public void bind( NextInterceptor next, BindOperationContext opContext ) throws Exception
232 {
233 next.bind( opContext );
234 }
235
236
237 public void unbind( NextInterceptor next, UnbindOperationContext opContext ) throws Exception
238 {
239 next.unbind( opContext );
240 }
241 }