View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.ldap.model.schema.registries;
21  
22  
23  import java.util.Iterator;
24  
25  import org.apache.directory.api.i18n.I18n;
26  import org.apache.directory.api.ldap.model.exception.LdapException;
27  import org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException;
28  import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
29  import org.apache.directory.api.ldap.model.schema.Normalizer;
30  import org.apache.directory.api.ldap.model.schema.SchemaObjectType;
31  
32  
33  /**
34   * An immutable wrapper of the Normalizer registry.
35   *
36   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
37   */
38  public class ImmutableNormalizerRegistry implements NormalizerRegistry
39  {
40      /** The wrapped Normalizer registry */
41      NormalizerRegistry immutableNormalizerRegistry;
42  
43  
44      /**
45       * Creates a new immutable NormalizerRegistry instance.
46       * 
47       * @param normalizerRegistry The wrapped Normalizer registry 
48       */
49      public ImmutableNormalizerRegistry( NormalizerRegistry normalizerRegistry )
50      {
51          immutableNormalizerRegistry = normalizerRegistry;
52      }
53  
54  
55      /**
56       *  {@inheritDoc}
57       */
58      @Override
59      public void register( Normalizer normalizer ) throws LdapException
60      {
61          throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04283 ) );
62      }
63  
64  
65      /**
66       *  {@inheritDoc}
67       */
68      @Override
69      public Normalizer unregister( String numericOid ) throws LdapException
70      {
71          throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04283 ) );
72      }
73  
74  
75      /**
76       *  {@inheritDoc}
77       */
78      @Override
79      public void unregisterSchemaElements( String schemaName ) throws LdapException
80      {
81          throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04283 ) );
82      }
83  
84  
85      /**
86       *  {@inheritDoc}
87       */
88      @Override
89      public ImmutableNormalizerRegistry copy()
90      {
91          return ( ImmutableNormalizerRegistry ) immutableNormalizerRegistry.copy();
92      }
93  
94  
95      /**
96       *  {@inheritDoc}
97       */
98      @Override
99      public int size()
100     {
101         return immutableNormalizerRegistry.size();
102     }
103 
104 
105     /**
106      *  {@inheritDoc}
107      */
108     @Override
109     public boolean contains( String oid )
110     {
111         return immutableNormalizerRegistry.contains( oid );
112     }
113 
114 
115     /**
116      *  {@inheritDoc}
117      */
118     @Override
119     public String getOidByName( String name ) throws LdapException
120     {
121         return immutableNormalizerRegistry.getOidByName( name );
122     }
123 
124 
125     /**
126      *  {@inheritDoc}
127      */
128     @Override
129     public String getSchemaName( String oid ) throws LdapException
130     {
131         return immutableNormalizerRegistry.getSchemaName( oid );
132     }
133 
134 
135     /**
136      *  {@inheritDoc}
137      */
138     @Override
139     public SchemaObjectType getType()
140     {
141         return immutableNormalizerRegistry.getType();
142     }
143 
144 
145     /**
146      *  {@inheritDoc}
147      */
148     @Override
149     public Iterator<Normalizer> iterator()
150     {
151         return immutableNormalizerRegistry.iterator();
152     }
153 
154 
155     /**
156      *  {@inheritDoc}
157      */
158     @Override
159     public Normalizer lookup( String oid ) throws LdapException
160     {
161         return immutableNormalizerRegistry.lookup( oid );
162     }
163 
164 
165     /**
166      *  {@inheritDoc}
167      */
168     @Override
169     public Iterator<String> oidsIterator()
170     {
171         return immutableNormalizerRegistry.oidsIterator();
172     }
173 
174 
175     /**
176      *  {@inheritDoc}
177      */
178     @Override
179     public void renameSchema( String originalSchemaName, String newSchemaName ) throws LdapException
180     {
181         throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04283 ) );
182     }
183 
184 
185     /**
186      * {@inheritDoc}
187      */
188     @Override
189     public Normalizer get( String oid )
190     {
191         return immutableNormalizerRegistry.get( oid );
192     }
193 
194 
195     /**
196      * {@inheritDoc}
197      */
198     @Override
199     public void clear() throws LdapException
200     {
201         throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04283 ) );
202     }
203 
204 
205     /**
206      * {@inheritDoc}
207      */
208     @Override
209     public Normalizer unregister( Normalizer schemaObject ) throws LdapException
210     {
211         throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04283 ) );
212     }
213 }