All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.directory.shared.ldap.model.schema.registries.ImmutableNameFormRegistry Maven / Gradle / Ivy

/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *  
 *    http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License. 
 *  
 */
package org.apache.directory.shared.ldap.model.schema.registries;


import java.util.Iterator;

import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.model.exception.LdapException;
import org.apache.directory.shared.ldap.model.exception.LdapUnwillingToPerformException;
import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.model.schema.NameForm;
import org.apache.directory.shared.ldap.model.schema.SchemaObjectType;


/**
 * An immutable wrapper of the NameForm registry.
 *
 * @author Apache Directory Project
 */
public class ImmutableNameFormRegistry implements NameFormRegistry
{
    /** The wrapped NameForm registry */
    NameFormRegistry immutableNameFormRegistry;


    /**
     * Creates a new instance of ImmutableNameFormRegistry.
     *
     * @param nameFormRegistry The wrapped NameForm registry
     */
    public ImmutableNameFormRegistry( NameFormRegistry nameFormRegistry )
    {
        immutableNameFormRegistry = nameFormRegistry;
    }


    /**
     * {@inheritDoc}
     */
    public ImmutableNameFormRegistry copy()
    {
        return ( ImmutableNameFormRegistry ) immutableNameFormRegistry.copy();
    }


    /**
     * {@inheritDoc}
     */
    public int size()
    {
        return immutableNameFormRegistry.size();
    }


    /**
     * {@inheritDoc}
     */
    public boolean contains( String oid )
    {
        return immutableNameFormRegistry.contains( oid );
    }


    /**
     * {@inheritDoc}
     */
    public String getOidByName( String name ) throws LdapException
    {
        return immutableNameFormRegistry.getOidByName( name );
    }


    /**
     * {@inheritDoc}
     */
    public String getSchemaName( String oid ) throws LdapException
    {
        return immutableNameFormRegistry.getSchemaName( oid );
    }


    /**
     * {@inheritDoc}
     */
    public SchemaObjectType getType()
    {
        return immutableNameFormRegistry.getType();
    }


    /**
     * {@inheritDoc}
     */
    public Iterator iterator()
    {
        return immutableNameFormRegistry.iterator();
    }


    /**
     * {@inheritDoc}
     */
    public NameForm lookup( String oid ) throws LdapException
    {
        return immutableNameFormRegistry.lookup( oid );
    }


    /**
     * {@inheritDoc}
     */
    public Iterator oidsIterator()
    {
        return immutableNameFormRegistry.oidsIterator();
    }


    /**
     * {@inheritDoc}
     */
    public void register( NameForm schemaObject ) throws LdapException
    {
        throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04282 ) );
    }


    /**
     * {@inheritDoc}
     */
    public void renameSchema( String originalSchemaName, String newSchemaName ) throws LdapException
    {
        throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04282 ) );
    }


    /**
     * {@inheritDoc}
     */
    public NameForm unregister( String numericOid ) throws LdapException
    {
        throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04282 ) );
    }


    /**
     * {@inheritDoc}
     */
    public void unregisterSchemaElements( String schemaName ) throws LdapException
    {
        throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04282 ) );
    }


    /**
     * {@inheritDoc}
     */
    public NameForm get( String oid )
    {
        return immutableNameFormRegistry.get( oid );
    }


    /**
     * {@inheritDoc}
     */
    public void clear() throws LdapException
    {
        throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04282 ) );
    }


    /**
     * {@inheritDoc}
     */
    public NameForm unregister( NameForm schemaObject ) throws LdapException
    {
        throw new LdapUnwillingToPerformException( ResultCodeEnum.NO_SUCH_OPERATION, I18n.err( I18n.ERR_04282 ) );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy