1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.ldap.model.schema.registries;
21
22
23 import java.util.Iterator;
24 import java.util.Map;
25
26 import org.apache.directory.api.i18n.I18n;
27 import org.apache.directory.api.ldap.model.exception.LdapException;
28 import org.apache.directory.api.ldap.model.exception.LdapNoSuchAttributeException;
29 import org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException;
30 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
31 import org.apache.directory.api.ldap.model.schema.AttributeType;
32 import org.apache.directory.api.ldap.model.schema.SchemaObjectType;
33 import org.apache.directory.api.ldap.model.schema.normalizers.OidNormalizer;
34
35
36
37
38
39
40
41 public class ImmutableAttributeTypeRegistry implements AttributeTypeRegistry
42 {
43
44 AttributeTypeRegistry immutableAttributeTypeRegistry;
45
46
47
48
49
50
51
52 public ImmutableAttributeTypeRegistry( AttributeTypeRegistry attributeTypeRegistry )
53 {
54 immutableAttributeTypeRegistry = attributeTypeRegistry;
55 }
56
57
58
59
60
61 public Map<String, OidNormalizer> getNormalizerMapping()
62 {
63 return immutableAttributeTypeRegistry.getNormalizerMapping();
64 }
65
66
67
68
69
70 public boolean hasDescendants( String ancestorId ) throws LdapException
71 {
72 return immutableAttributeTypeRegistry.hasDescendants( ancestorId );
73 }
74
75
76
77
78
79 public boolean hasDescendants( AttributeType ancestor ) throws LdapException
80 {
81 return immutableAttributeTypeRegistry.hasDescendants( ancestor );
82 }
83
84
85
86
87
88 public Iterator<AttributeType> descendants( String ancestorId ) throws LdapException
89 {
90 return immutableAttributeTypeRegistry.descendants( ancestorId );
91 }
92
93
94
95
96
97 public Iterator<AttributeType> descendants( AttributeType ancestor ) throws LdapException
98 {
99 return immutableAttributeTypeRegistry.descendants( ancestor );
100 }
101
102
103
104
105
106 public void register( AttributeType attributeType ) throws LdapException
107 {
108 throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04275 ) );
109 }
110
111
112
113
114
115 public void registerDescendants( AttributeType attributeType, AttributeType ancestor ) throws LdapException
116 {
117 throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04275 ) );
118 }
119
120
121
122
123
124 public void unregisterDescendants( AttributeType attributeType, AttributeType ancestor ) throws LdapException
125 {
126 throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04275 ) );
127 }
128
129
130
131
132
133 public AttributeType unregister( String numericOid ) throws LdapException
134 {
135 throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION,
136 "Cannot modify the AttributeTypeRegistry copy" );
137 }
138
139
140
141
142
143 public void addMappingFor( AttributeType attributeType ) throws LdapException
144 {
145 throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04275 ) );
146 }
147
148
149
150
151
152 public void removeMappingFor( AttributeType attributeType ) throws LdapException
153 {
154 throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04275 ) );
155 }
156
157
158
159
160
161 public AttributeType lookup( String oid ) throws LdapException
162 {
163 return immutableAttributeTypeRegistry.lookup( oid );
164 }
165
166
167
168
169
170 public String toString()
171 {
172 return immutableAttributeTypeRegistry.toString();
173 }
174
175
176
177
178
179 public AttributeTypeRegistry copy()
180 {
181 return ( AttributeTypeRegistry ) immutableAttributeTypeRegistry.copy();
182 }
183
184
185
186
187
188 public int size()
189 {
190 return immutableAttributeTypeRegistry.size();
191 }
192
193
194
195
196
197 public Iterator<AttributeType> iterator()
198 {
199 return immutableAttributeTypeRegistry.iterator();
200 }
201
202
203
204
205
206 public Iterator<String> oidsIterator()
207 {
208 return immutableAttributeTypeRegistry.oidsIterator();
209 }
210
211
212
213
214
215 public boolean contains( String oid )
216 {
217 return immutableAttributeTypeRegistry.contains( oid );
218 }
219
220
221
222
223
224 public String getOidByName( String name ) throws LdapException
225 {
226 try
227 {
228 return immutableAttributeTypeRegistry.getOidByName( name );
229 }
230 catch ( LdapException le )
231 {
232 throw new LdapNoSuchAttributeException( le.getMessage(), le );
233 }
234 }
235
236
237
238
239
240 public String getSchemaName( String oid ) throws LdapException
241 {
242 return immutableAttributeTypeRegistry.getSchemaName( oid );
243 }
244
245
246
247
248
249 public SchemaObjectType getType()
250 {
251 return immutableAttributeTypeRegistry.getType();
252 }
253
254
255
256
257
258 public void renameSchema( String originalSchemaName, String newSchemaName )
259 {
260
261 }
262
263
264
265
266
267 public void unregisterSchemaElements( String schemaName ) throws LdapException
268 {
269 throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04275 ) );
270 }
271
272
273
274
275
276 public AttributeType get( String oid )
277 {
278 return immutableAttributeTypeRegistry.get( oid );
279 }
280
281
282
283
284
285 public void clear() throws LdapException
286 {
287 throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04275 ) );
288 }
289
290
291
292
293
294 public AttributeType unregister( AttributeType schemaObject ) throws LdapException
295 {
296 throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04275 ) );
297 }
298 }