Package org.apache.directory.shared.asn1.ber.tlv

Examples of org.apache.directory.shared.asn1.ber.tlv.BerValue


        // a FF, it's a TRUE. Any other value should be an error,
        // but we could relax this constraint. So if we have
        // something
        // which is not 0, it will be interpreted as TRUE, but we
        // will generate a warning.
        BerValue value = tlv.getValue();

        try
        {
            control.setCritical( BooleanDecoder.parse( value ) );
        }
        catch ( BooleanDecoderException bde )
        {
            LOG.error( I18n
                .err( I18n.ERR_04100, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( bde.getMessage() );
        }
View Full Code Here


        TLV tlv = container.getCurrentTLV();

        // The current TLV should be a integer
        // We get it and store it in sizeLimit
        BerValue value = tlv.getValue();
        long sizeLimit = 0;

        try
        {
            sizeLimit = LongDecoder.parse( value, 0, Integer.MAX_VALUE );
        }
        catch ( LongDecoderException lde )
        {
            String msg = I18n.err( I18n.ERR_04103, value.toString() );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        searchRequest.setSizeLimit( sizeLimit );
View Full Code Here

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04069 ) );
        }

        BerValue value = tlv.getValue();

        try
        {
            int messageId = IntegerDecoder.parse( value, 0, Integer.MAX_VALUE );

            container.setMessageId( messageId );

            if ( IS_DEBUG )
            {
                LOG.debug( "Ldap Message Id has been decoded : " + messageId );
            }
        }
        catch ( IntegerDecoderException ide )
        {
            LOG.error( I18n.err( I18n.ERR_04070, Strings.dumpBytes( value.getData() ), ide
                .getLocalizedMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( ide.getMessage() );
        }
View Full Code Here

        SearchRequest searchRequest = container.getMessage().getDecorated();

        TLV tlv = container.getCurrentTLV();

        // We have to check that this is a correct scope
        BerValue value = tlv.getValue();
        int scope = 0;

        try
        {
            scope = IntegerDecoder.parse( value, LdapConstants.SCOPE_BASE_OBJECT,
                LdapConstants.SCOPE_WHOLE_SUBTREE );
        }
        catch ( IntegerDecoderException ide )
        {
            String msg = I18n.err( I18n.ERR_04101, value.toString() );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        searchRequest.setScope( SearchScope.getSearchScope( scope ) );
View Full Code Here

        MessageDecorator<?> message = container.getMessage();
        CodecControl<? extends Control> control = message.getCurrentControl();

        // Get the current control
        BerValue value = tlv.getValue();

        // Store the value - have to handle the special case of a 0 length value
        if ( tlv.getLength() == 0 )
        {
            control.setValue( StringConstants.EMPTY_BYTES );
        }
        else
        {
            control.setValue( value.getData() );

            if ( control != null )
            {
                control.decode( value.getData() );
            }
        }

        // We can have an END transition
        container.setGrammarEndAllowed( true );
View Full Code Here

        TLV tlv = container.getCurrentTLV();

        // The current TLV should be a integer
        // We get it and store it in timeLimit
        BerValue value = tlv.getValue();

        int timeLimit = 0;

        try
        {
            timeLimit = IntegerDecoder.parse( value, 0, Integer.MAX_VALUE );
        }
        catch ( IntegerDecoderException ide )
        {
            String msg = I18n.err( I18n.ERR_04104, value.toString() );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        searchRequest.setTimeLimit( timeLimit );
View Full Code Here

        SearchRequest searchRequest = container.getMessage().getDecorated();

        TLV tlv = container.getCurrentTLV();

        // We have to check that this is a correct derefAliases
        BerValue value = tlv.getValue();
        int derefAliases = 0;

        try
        {
            derefAliases = IntegerDecoder.parse( value, LdapConstants.NEVER_DEREF_ALIASES,
                LdapConstants.DEREF_ALWAYS );
        }
        catch ( IntegerDecoderException ide )
        {
            String msg = I18n.err( I18n.ERR_04102, value.toString() );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        searchRequest.setDerefAliases( AliasDerefMode.getDerefMode( derefAliases ) );
View Full Code Here

        // a FF, it's a TRUE. Any other value should be an error,
        // but we could relax this constraint. So if we have
        // something
        // which is not 0, it will be interpreted as TRUE, but we
        // will generate a warning.
        BerValue value = tlv.getValue();

        try
        {
            searchRequest.setTypesOnly( BooleanDecoder.parse( value ) );
        }
        catch ( BooleanDecoderException bde )
        {
            LOG.error( I18n
                .err( I18n.ERR_04105, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );

            throw new DecoderException( bde.getMessage() );
        }

        if ( IS_DEBUG )
View Full Code Here

        // a FF, it's a TRUE. Any other value should be an error,
        // but we could relax this constraint. So if we have
        // something
        // which is not 0, it will be interpreted as TRUE, but we
        // will generate a warning.
        BerValue value = tlv.getValue();

        try
        {
            modifyDnRequest.setDeleteOldRdn( BooleanDecoder.parse( value ) );
        }
        catch ( BooleanDecoderException bde )
        {
            LOG.error( I18n
                .err( I18n.ERR_04091, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( bde.getMessage() );
        }
View Full Code Here

    {
        // The current TLV should be a integer
        // We get it and store it in MessageId
        TLV tlv = container.getCurrentTLV();

        BerValue value = tlv.getValue();
        ResultCodeEnum resultCode = ResultCodeEnum.SUCCESS;

        try
        {
            resultCode = ResultCodeEnum.getResultCode( IntegerDecoder.parse( value, 0,
                ResultCodeEnum.E_SYNC_REFRESH_REQUIRED
                    .getResultCode() ) );
        }
        catch ( IntegerDecoderException ide )
        {
            LOG.error( I18n.err( I18n.ERR_04018, Strings.dumpBytes( value.getData() ), ide.getMessage() ) );

            throw new DecoderException( ide.getMessage() );
        }

        if ( IS_DEBUG )
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.asn1.ber.tlv.BerValue

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.