Package org.apache.directory.shared.ldap.exception

Examples of org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException


            }

            // if the supertype is provided make sure it exists in some schema
            if ( desc.getSuperType() != null && ! dao.hasAttributeType( desc.getSuperType() ) )
            {
                throw new LdapOperationNotSupportedException(
                    "Cannot permit the addition of an attributeType with an invalid super type: "
                        + desc.getSuperType(),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }

            // if the syntax is provided by the description make sure it exists in some schema
            if ( desc.getSyntax() != null && ! dao.hasSyntax( desc.getSyntax() ) )
            {
                throw new LdapOperationNotSupportedException(
                    "Cannot permit the addition of an attributeType with an invalid syntax: " + desc.getSyntax(),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }
           
            // if the matchingRule is provided make sure it exists in some schema
            if ( desc.getEqualityMatchingRule() != null && ! dao.hasMatchingRule( desc.getEqualityMatchingRule() ) )
            {
                throw new LdapOperationNotSupportedException(
                    "Cannot permit the addition of an attributeType with an invalid EQUALITY matchingRule: "
                        + desc.getEqualityMatchingRule(),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }

            // if the matchingRule is provided make sure it exists in some schema
            if ( desc.getOrderingMatchingRule() != null && ! dao.hasMatchingRule( desc.getOrderingMatchingRule() ) )
            {
                throw new LdapOperationNotSupportedException(
                    "Cannot permit the addition of an attributeType with an invalid ORDERING matchingRule: "
                        + desc.getOrderingMatchingRule(),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }

            // if the matchingRule is provided make sure it exists in some schema
            if ( desc.getSubstringsMatchingRule() != null && ! dao.hasMatchingRule( desc.getSubstringsMatchingRule() ) )
            {
                throw new LdapOperationNotSupportedException(
                    "Cannot permit the addition of an attributeType with an invalid SUBSTRINGS matchingRule: "
                        + desc.getSubstringsMatchingRule(),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }

            // if the equality matching rule is null and no super type is specified then there is
            // definitely no equality matchingRule that can be resolved.  We cannot use an attribute
            // without a matchingRule for search or for building indices not to mention lookups.
            if ( desc.getEqualityMatchingRule() == null && desc.getSuperType() == null )
            {
                throw new LdapOperationNotSupportedException(
                    "Cannot permit the addition of an attributeType with an no EQUALITY matchingRule " +
                    "\nand no super type from which to derive an EQUALITY matchingRule.",
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }
            else if ( desc.getEqualityMatchingRule() == null )
            {
                AttributeType superType = globalRegistries.getAttributeTypeRegistry().lookup( desc.getSuperType() );
                if ( superType.getEquality() == null )
                {
                    throw new LdapOperationNotSupportedException(
                        "Cannot permit the addition of an attributeType with which cannot resolve an " +
                        "EQUALITY matchingRule from it's super type.",
                        ResultCodeEnum.UNWILLING_TO_PERFORM );
                }
            }
           
            // a syntax is manditory for an attributeType and if not provided by the description
            // must be provided from some ancestor in the attributeType hierarchy; without either
            // of these the description definitely cannot resolve a syntax and cannot be allowed.
            // if a supertype exists then it must resolve a proper syntax somewhere in the hierarchy.
            if ( desc.getSyntax() == null && desc.getSuperType() == null )
            {
                throw new LdapOperationNotSupportedException(
                    "Cannot permit the addition of an attributeType with an no syntax " +
                    "\nand no super type from which to derive a syntax.",
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }
           
View Full Code Here


                        continue;
                    }
                   
                    if ( ! dao.hasObjectClass( superior ) )
                    {
                        throw new LdapOperationNotSupportedException(
                            "Cannot permit the addition of an objectClass with an invalid superior objectClass: "
                                + superior,
                            ResultCodeEnum.UNWILLING_TO_PERFORM );
                    }
                }
            }
           
            // if the may list is provided make sure attributes exists in some schema
            if ( desc.getMayAttributeTypes() != null && desc.getMayAttributeTypes().size() > 0 )
            {
                for ( String mayAttr : desc.getMayAttributeTypes() )
                {
                    if ( ! dao.hasAttributeType( mayAttr ) )
                    {
                        throw new LdapOperationNotSupportedException(
                            "Cannot permit the addition of an objectClass with an invalid " +
                            "attributeType in the mayList: " + mayAttr,
                            ResultCodeEnum.UNWILLING_TO_PERFORM );
                    }
                }
            }
           
            // if the must list is provided make sure attributes exists in some schema
            if ( desc.getMustAttributeTypes() != null && desc.getMustAttributeTypes().size() > 0 )
            {
                for ( String mustAttr : desc.getMustAttributeTypes() )
                {
                    if ( ! dao.hasAttributeType( mustAttr ) )
                    {
                        throw new LdapOperationNotSupportedException(
                            "Cannot permit the addition of an objectClass with an invalid " +
                            "attributeType in the mustList: " + mustAttr,
                            ResultCodeEnum.UNWILLING_TO_PERFORM );
                    }
                }
View Full Code Here

                throw iave;
            }
           
            if ( ! dao.hasSyntaxChecker( desc.getNumericOid() ) )
            {
                throw new LdapOperationNotSupportedException(
                    "Cannot permit the addition of a syntax without the prior creation of a " +
                    "\nsyntaxChecker with the same object identifier of the syntax!",
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }
View Full Code Here

                throw iave;
            }
           
            if ( ! dao.hasSyntax( desc.getSyntax() )  )
            {
                throw new LdapOperationNotSupportedException(
                    "Cannot create a matchingRule that depends on non-existant syntax: " + desc.getSyntax(),
                    ResultCodeEnum.UNWILLING_TO_PERFORM );
            }
           
            MatchingRuleImpl mr = new MatchingRuleImpl( desc.getNumericOid(), desc.getSyntax(), globalRegistries );
View Full Code Here

    public void delete( String oid, boolean cascade ) throws NamingException
    {
        if ( matchingRuleRegistry.hasMatchingRule( oid ) )
        {
            throw new LdapOperationNotSupportedException( "The normalizer with OID " + oid
                + " cannot be deleted until all "
                + "matchingRules using that normalizer have also been deleted.",
                ResultCodeEnum.UNWILLING_TO_PERFORM );
        }
       
View Full Code Here

    {
        String oldOid = getOid( entry );

        if ( matchingRuleRegistry.hasMatchingRule( oldOid ) )
        {
            throw new LdapOperationNotSupportedException( "The normalizer with OID " + oldOid
                + " cannot have it's OID changed until all "
                + "matchingRules using that normalizer have been deleted.",
                ResultCodeEnum.UNWILLING_TO_PERFORM );
        }
View Full Code Here

        checkNewParent( newParentName );
        String oldOid = getOid( entry );

        if ( matchingRuleRegistry.hasMatchingRule( oldOid ) )
        {
            throw new LdapOperationNotSupportedException( "The normalizer with OID " + oldOid
                + " cannot have it's OID changed until all "
                + "matchingRules using that normalizer have been deleted.",
                ResultCodeEnum.UNWILLING_TO_PERFORM );
        }
View Full Code Here

        checkNewParent( newParentName );
        String oid = getOid( entry );

        if ( matchingRuleRegistry.hasMatchingRule( oid ) )
        {
            throw new LdapOperationNotSupportedException( "The normalizer with OID " + oid
                + " cannot be moved to another schema until all "
                + "matchingRules using that normalizer have been deleted.",
                ResultCodeEnum.UNWILLING_TO_PERFORM );
        }
View Full Code Here

    public void delete( String oid, boolean cascade ) throws NamingException
    {
        if ( syntaxRegistry.hasSyntax( oid ) )
        {
            throw new LdapOperationNotSupportedException( "The syntaxChecker with OID " + oid
                + " cannot be deleted until all "
                + "syntaxes using this syntaxChecker have also been deleted.",
                ResultCodeEnum.UNWILLING_TO_PERFORM );
        }
       
View Full Code Here

    {
        String oldOid = getOid( entry );

        if ( syntaxRegistry.hasSyntax( oldOid ) )
        {
            throw new LdapOperationNotSupportedException( "The syntaxChecker with OID " + oldOid
                + " cannot have it's OID changed until all "
                + "syntaxes using that syntaxChecker have been deleted.",
                ResultCodeEnum.UNWILLING_TO_PERFORM );
        }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.