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

Examples of org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException


    {
        int size = dn.size();

        if ( size < 2 )
        {
            throw new LdapInvalidDnException( I18n.err( I18n.ERR_276 ) );
        }

        Rdn rdn = dn.getRdn( size - 2 );

        return rdn.getNormValue().getString();
View Full Code Here


     */
    protected void checkParent( Dn newParent, SchemaManager schemaManager, String objectType ) throws LdapException
    {
        if ( newParent.size() != 3 )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, I18n.err( I18n.ERR_337 ) );
        }

        Rdn rdn = newParent.getRdn();

        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() )
            .equals( SchemaConstants.OU_AT_OID ) )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_338, objectType ) );
        }

        if ( !rdn.getNormValue().getString().equalsIgnoreCase( OBJECT_TYPE_TO_PATH.get( objectType ) ) )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_339, objectType, OBJECT_TYPE_TO_PATH.get( objectType ) ) );
        }
    }
View Full Code Here

    private void checkNewParent( Dn newParent ) throws LdapException
    {
        if ( newParent.size() != 3 )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_396 ) );
        }

        Rdn rdn = newParent.getRdn();
        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
            SchemaConstants.OU_AT_OID ) )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_397 ) );
        }

        if ( !rdn.getNormValue().getString().equalsIgnoreCase( SchemaConstants.SYNTAX_CHECKERS_AT ) )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_372 ) );
        }
    }
View Full Code Here

    private void checkNewParent( Dn newParent ) throws LdapException
    {
        if ( newParent.size() != 3 )
        {
            throw new LdapInvalidDnException(
                ResultCodeEnum.NAMING_VIOLATION,
                "The parent dn of a objectClass should be at most 3 name components in length." );
        }

        Rdn rdn = newParent.getRdn();

        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
            SchemaConstants.OU_AT_OID ) )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_376 ) );
        }

        if ( !rdn.getNormValue().getString().equalsIgnoreCase( SchemaConstants.OBJECT_CLASSES_AT ) )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_377 ) );
        }
    }
View Full Code Here

    private void checkNewParent( Dn newParent ) throws LdapException
    {
        if ( newParent.size() != 3 )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_361 ) );
        }

        Rdn rdn = newParent.getRdn();

        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
            SchemaConstants.OU_AT_OID ) )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_362 ) );
        }

        if ( !rdn.getNormValue().getString().equalsIgnoreCase( SchemaConstants.MATCHING_RULES_AT ) )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_363 ) );
        }
    }
View Full Code Here

        {
            if ( addContext.getDn().size() != 3 )
            {
                String msg = I18n.err( I18n.ERR_81 );
                LOG.error( msg );
                throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, msg );
            }

            String ouValue = addContext.getDn().getRdn().getNormValue().getString();
            ouValue = Strings.toLowerCase( Strings.trim( ouValue ) );

            if ( !VALID_OU_VALUES.contains( ouValue ) )
            {
                String msg = I18n.err( I18n.ERR_82, VALID_OU_VALUES );
                LOG.error( msg );
                throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION, msg );
            }

            // this is a valid container.
            return;
        }
View Full Code Here

            String ouValue = deleteContext.getDn().getRdn().getNormValue().getString();
            ouValue = Strings.toLowerCase( Strings.trim( ouValue ) );

            if ( !VALID_OU_VALUES.contains( ouValue ) )
            {
                throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                    I18n.err( I18n.ERR_379, VALID_OU_VALUES ) );
            }

            return;
        }
View Full Code Here

            // of the workingDirectory followed by the suffix
            if ( ( suffixDn == null ) || ( suffixDn.isEmpty() ) )
            {
                String msg = I18n.err( I18n.ERR_150 );
                LOG.error( msg );
                throw new LdapInvalidDnException( msg );
            }

            suffixDn.apply( schemaManager );

            super.doInit();
View Full Code Here

          
           return new StringValue( normalized );
       }
       catch ( IOException ioe )
       {
           throw new LdapInvalidDnException( I18n.err( I18n.ERR_04224, value ), ioe );
       }
   }
View Full Code Here

           return PrepareString.normalize( value,
               PrepareString.StringType.NUMERIC_STRING );
       }
       catch ( IOException ioe )
       {
           throw new LdapInvalidDnException( I18n.err( I18n.ERR_04224, value ), ioe );
       }
   }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException

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.