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.shared.ldap.schema.registries;
021    
022    
023    import java.util.Iterator;
024    
025    import org.apache.directory.shared.ldap.exception.LdapException;
026    
027    import org.apache.directory.shared.i18n.I18n;
028    import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
029    import org.apache.directory.shared.ldap.message.ResultCodeEnum;
030    import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
031    import org.apache.directory.shared.ldap.schema.SchemaObject;
032    import org.apache.directory.shared.ldap.schema.SchemaObjectType;
033    
034    
035    /**
036     * An immutable wrapper of the MatchingRuleUse registry.
037     *
038     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
039     * @version $Rev: 828111 $
040     */
041    public class ImmutableMatchingRuleUseRegistry implements MatchingRuleUseRegistry
042    {
043        /** The wrapped MatchingRuleUse registry */
044        MatchingRuleUseRegistry immutableMatchingRuleUseRegistry;
045    
046    
047        /**
048         * Creates a new instance of ImmutableMatchingRuleUseRegistry.
049         *
050         * @param matchingRuleUseRegistry The wrapped MatchingRuleUse registry
051         */
052        public ImmutableMatchingRuleUseRegistry( MatchingRuleUseRegistry matchingRuleUseRegistry )
053        {
054            immutableMatchingRuleUseRegistry = matchingRuleUseRegistry;
055        }
056    
057    
058        /**
059         * {@inheritDoc}
060         */
061        public ImmutableMatchingRuleUseRegistry copy()
062        {
063            return ( ImmutableMatchingRuleUseRegistry ) immutableMatchingRuleUseRegistry.copy();
064        }
065    
066    
067        /**
068         * {@inheritDoc}
069         */
070        public int size()
071        {
072            return immutableMatchingRuleUseRegistry.size();
073        }
074    
075    
076        /**
077         * {@inheritDoc}
078         */
079        public boolean contains( String oid )
080        {
081            return immutableMatchingRuleUseRegistry.contains( oid );
082        }
083    
084    
085        /**
086         * {@inheritDoc}
087         */
088        public String getOidByName( String name ) throws LdapException
089        {
090            return immutableMatchingRuleUseRegistry.getOidByName( name );
091        }
092    
093    
094        /**
095         * {@inheritDoc}
096         */
097        public String getSchemaName( String oid ) throws LdapException
098        {
099            return immutableMatchingRuleUseRegistry.getSchemaName( oid );
100        }
101    
102    
103        /**
104         * {@inheritDoc}
105         */
106        public SchemaObjectType getType()
107        {
108            return immutableMatchingRuleUseRegistry.getType();
109        }
110    
111    
112        /**
113         * {@inheritDoc}
114         */
115        public Iterator<MatchingRuleUse> iterator()
116        {
117            return immutableMatchingRuleUseRegistry.iterator();
118        }
119    
120    
121        /**
122         * {@inheritDoc}
123         */
124        public MatchingRuleUse lookup( String oid ) throws LdapException
125        {
126            return immutableMatchingRuleUseRegistry.lookup( oid );
127        }
128    
129    
130        /**
131         * {@inheritDoc}
132         */
133        public Iterator<String> oidsIterator()
134        {
135            return immutableMatchingRuleUseRegistry.oidsIterator();
136        }
137    
138    
139        /**
140         * {@inheritDoc}
141         */
142        public void register( MatchingRuleUse schemaObject ) throws LdapException
143        {
144            throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04281 ) );
145        }
146    
147    
148        /**
149         * {@inheritDoc}
150         */
151        public void renameSchema( String originalSchemaName, String newSchemaName ) throws LdapException
152        {
153            throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04281 ) );
154        }
155    
156    
157        /**
158         * {@inheritDoc}
159         */
160        public MatchingRuleUse unregister( String numericOid ) throws LdapException
161        {
162            throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04281 ) );
163        }
164    
165    
166        /**
167         * {@inheritDoc}
168         */
169        public void unregisterSchemaElements( String schemaName ) throws LdapException
170        {
171            throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04281 ) );
172        }
173    
174    
175        /**
176         * {@inheritDoc}
177         */
178        public SchemaObject get( String oid )
179        {
180            return immutableMatchingRuleUseRegistry.get( oid );
181        }
182    
183    
184        /**
185         * {@inheritDoc}
186         */
187        public void clear() throws LdapException
188        {
189            throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04281 ) );
190        }
191    
192    
193        /**
194         * {@inheritDoc}
195         */
196        public MatchingRuleUse unregister( MatchingRuleUse schemaObject ) throws LdapException
197        {
198            throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04281 ) );
199        }
200    }