Package org.apache.directory.shared.asn1

Examples of org.apache.directory.shared.asn1.DecoderException


                        }
                        catch ( IntegerDecoderException e )
                        {
                            String msg = I18n.err( I18n.ERR_04028 );
                            LOG.error( msg, e );
                            throw new DecoderException( msg );
                        }
                    }
                } );

        /**
         * Transition from mode to cookie
         * SyncRequestValue ::= SEQUENCE OF {
         *     ...
         *     cookie     syncCookie OPTIONAL,
         *     ...
         *    
         * Stores the cookie
         */
        super.transitions[SyncRequestValueStatesEnum.MODE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
            new GrammarTransition( SyncRequestValueStatesEnum.MODE_STATE,
                SyncRequestValueStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl cookie" )
                {
                    public void action( SyncRequestValueContainer container ) throws DecoderException
                    {
                        Value value = container.getCurrentTLV().getValue();

                        byte[] cookie = value.getData();

                        if ( IS_DEBUG )
                        {
                            LOG.debug( "cookie = " + Strings.dumpBytes( cookie ) );
                        }

                        container.getSyncRequestValueControl().setCookie( cookie );

                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from mode to reloadHint
         * SyncRequestValue ::= SEQUENCE OF {
         *     ...
         *     reloadHint BOOLEAN DEFAULT FALSE
         * }
         *    
         * Stores the reloadHint flag
         */
        super.transitions[SyncRequestValueStatesEnum.MODE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncRequestValueStatesEnum.MODE_STATE,
                SyncRequestValueStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl reloadHint flag" )
                {
                    public void action( SyncRequestValueContainer container ) throws DecoderException
                    {
                        Value value = container.getCurrentTLV().getValue();

                        try
                        {
                            boolean reloadHint = BooleanDecoder.parse( value );

                            if ( IS_DEBUG )
                            {
                                LOG.debug( "reloadHint = " + reloadHint );
                            }

                            container.getSyncRequestValueControl().setReloadHint( reloadHint );

                            // We can have an END transition
                            container.setGrammarEndAllowed( true );
                        }
                        catch ( BooleanDecoderException e )
                        {
                            String msg = I18n.err( I18n.ERR_04029 );
                            LOG.error( msg, e );
                            throw new DecoderException( msg );
                        }
                    }
                } );

        /**
         * Transition from cookie to reloadHint
         * SyncRequestValue ::= SEQUENCE OF {
         *     ...
         *     reloadHint BOOLEAN DEFAULT FALSE
         * }
         *    
         * Stores the reloadHint flag
         */
        super.transitions[SyncRequestValueStatesEnum.COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncRequestValueStatesEnum.COOKIE_STATE,
                SyncRequestValueStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl reloadHint flag" )
                {
                    public void action( SyncRequestValueContainer container ) throws DecoderException
                    {
                        Value value = container.getCurrentTLV().getValue();

                        try
                        {
                            boolean reloadHint = BooleanDecoder.parse( value );

                            if ( IS_DEBUG )
                            {
                                LOG.debug( "reloadHint = " + reloadHint );
                            }

                            container.getSyncRequestValueControl().setReloadHint( reloadHint );

                            // We can have an END transition
                            container.setGrammarEndAllowed( true );
                        }
                        catch ( BooleanDecoderException e )
                        {
                            String msg = I18n.err( I18n.ERR_04029 );
                            LOG.error( msg, e );
                            throw new DecoderException( msg );
                        }
                    }
                } );
    }
View Full Code Here


                        }
                        catch ( BooleanDecoderException be )
                        {
                            String msg = I18n.err( I18n.ERR_04025 );
                            LOG.error( msg, be );
                            throw new DecoderException( msg );
                        }

                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from refreshDelete choice state to refreshDone
         *     refreshDelete [1] SEQUENCE {
         *         ....
         *         refreshDone BOOLEAN DEFAULT TRUE
         *     }
         *    
         * Load the refreshDone flag
         */
        super.transitions[SyncInfoValueStatesEnum.REFRESH_DELETE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_DELETE_STATE,
                SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE,
                UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "RefreshDelete refreshDone flag" )
                {
                    public void action( SyncInfoValueContainer container ) throws DecoderException
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        Value value = container.getCurrentTLV().getValue();

                        try
                        {
                            boolean refreshDone = BooleanDecoder.parse( value );

                            if ( IS_DEBUG )
                            {
                                LOG.debug( "refreshDone = {}", refreshDone );
                            }

                            control.setRefreshDone( refreshDone );

                            container.setSyncInfoValueControl( control );

                            // the END transition for grammar
                            container.setGrammarEndAllowed( true );
                        }
                        catch ( BooleanDecoderException be )
                        {
                            String msg = I18n.err( I18n.ERR_04025 );
                            LOG.error( msg, be );
                            throw new DecoderException( msg );
                        }

                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from initial state to SyncInfoValue refreshPresent choice
         * SyncInfoValue ::= CHOICE {
         *     ...
         *     refreshPresent [2] SEQUENCE {
         *     ...
         *    
         * Initialize the syncInfoValue object
         */
        super.transitions[SyncInfoValueStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.REFRESH_PRESENT_TAG
            .getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.START_STATE,
                SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
                SyncInfoValueTags.REFRESH_PRESENT_TAG.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "RefreshDelete choice for SyncInfoValueControl" )
                {
                    public void action( SyncInfoValueContainer container )
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        container.setSyncInfoValueControl( control );

                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from refreshPresent state to cookie
         *     refreshPresent [2] SEQUENCE {
         *         cookie syncCookie OPTIONAL,
         *     ...
         *    
         * Load the cookie object
         */
        super.transitions[SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
                SyncInfoValueStatesEnum.REFRESH_PRESENT_COOKIE_STATE,
                UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "RefreshPresent cookie" )
                {
                    public void action( SyncInfoValueContainer container )
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        Value value = container.getCurrentTLV().getValue();

                        byte[] cookie = value.getData();

                        if ( IS_DEBUG )
                        {
                            LOG.debug( "cookie = " + Strings.dumpBytes( cookie ) );
                        }

                        container.getSyncInfoValueControl().setCookie( cookie );
                        container.setSyncInfoValueControl( control );

                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from refreshPresent cookie state to refreshDone
         *     refreshPresent [2] SEQUENCE {
         *         ....
         *         refreshDone BOOLEAN DEFAULT TRUE
         *     }
         *    
         * Load the refreshDone flag
         */
        super.transitions[SyncInfoValueStatesEnum.REFRESH_PRESENT_COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN
            .getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_PRESENT_COOKIE_STATE,
                SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE,
                UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "RefreshPresent refreshDone flag" )
                {
                    public void action( SyncInfoValueContainer container ) throws DecoderException
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        Value value = container.getCurrentTLV().getValue();

                        try
                        {
                            boolean refreshDone = BooleanDecoder.parse( value );

                            if ( IS_DEBUG )
                            {
                                LOG.debug( "refreshDone = {}", refreshDone );
                            }

                            control.setRefreshDone( refreshDone );

                            container.setSyncInfoValueControl( control );

                            // the END transition for grammar
                            container.setGrammarEndAllowed( true );
                        }
                        catch ( BooleanDecoderException be )
                        {
                            String msg = I18n.err( I18n.ERR_04025 );
                            LOG.error( msg, be );
                            throw new DecoderException( msg );
                        }

                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from refreshPresent choice state to refreshDone
         *     refreshPresent [1] SEQUENCE {
         *         ....
         *         refreshDone BOOLEAN DEFAULT TRUE
         *     }
         *    
         * Load the refreshDone flag
         */
        super.transitions[SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
                SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE,
                UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "RefreshPresent refreshDone flag" )
                {
                    public void action( SyncInfoValueContainer container ) throws DecoderException
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        Value value = container.getCurrentTLV().getValue();

                        try
                        {
                            boolean refreshDone = BooleanDecoder.parse( value );

                            if ( IS_DEBUG )
                            {
                                LOG.debug( "refreshDone = {}", refreshDone );
                            }

                            control.setRefreshDone( refreshDone );

                            container.setSyncInfoValueControl( control );

                            // the END transition for grammar
                            container.setGrammarEndAllowed( true );
                        }
                        catch ( BooleanDecoderException be )
                        {
                            String msg = I18n.err( I18n.ERR_04025 );
                            LOG.error( msg, be );
                            throw new DecoderException( msg );
                        }

                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from initial state to SyncInfoValue syncIdSet choice
         * SyncInfoValue ::= CHOICE {
         *     ...
         *     syncIdSet [3] SEQUENCE {
         *     ...
         *    
         * Initialize the syncInfoValue object
         */
        super.transitions[SyncInfoValueStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.SYNC_ID_SET_TAG.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.START_STATE,
                SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                SyncInfoValueTags.SYNC_ID_SET_TAG.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet choice for SyncInfoValueControl" )
                {
                    public void action( SyncInfoValueContainer container )
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        container.setSyncInfoValueControl( control );
                    }
                } );

        /**
         * Transition from syncIdSet state to cookie
         *     syncIdSet [3] SEQUENCE {
         *         cookie syncCookie OPTIONAL,
         *     ...
         *    
         * Load the cookie object
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
                UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet cookie" )
                {
                    public void action( SyncInfoValueContainer container )
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        Value value = container.getCurrentTLV().getValue();

                        byte[] cookie = value.getData();

                        if ( IS_DEBUG )
                        {
                            LOG.debug( "cookie = " + Strings.dumpBytes( cookie ) );
                        }

                        container.getSyncInfoValueControl().setCookie( cookie );
                        container.setSyncInfoValueControl( control );
                    }
                } );

        /**
         * Transition from syncIdSet state to refreshDeletes
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         refreshDeletes BOOLEAN DEFAULT FALSE,
         *     ...
         *    
         * Load the refreshDeletes flag
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE,
                UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet refreshDeletes" )
                {
                    public void action( SyncInfoValueContainer container ) throws DecoderException
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        Value value = container.getCurrentTLV().getValue();

                        try
                        {
                            boolean refreshDeletes = BooleanDecoder.parse( value );

                            if ( IS_DEBUG )
                            {
                                LOG.debug( "refreshDeletes = {}", refreshDeletes );
                            }

                            control.setRefreshDeletes( refreshDeletes );

                            container.setSyncInfoValueControl( control );
                        }
                        catch ( BooleanDecoderException be )
                        {
                            String msg = I18n.err( I18n.ERR_04026 );
                            LOG.error( msg, be );
                            throw new DecoderException( msg );
                        }
                    }
                } );

        /**
         * Transition from syncIdSet cookie state to refreshDeletes
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         refreshDeletes BOOLEAN DEFAULT FALSE,
         *     ...
         *    
         * Load the refreshDeletes flag
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
                SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE,
                UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet refreshDeletes" )
                {
                    public void action( SyncInfoValueContainer container ) throws DecoderException
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        Value value = container.getCurrentTLV().getValue();

                        try
                        {
                            boolean refreshDeletes = BooleanDecoder.parse( value );

                            if ( IS_DEBUG )
                            {
                                LOG.debug( "refreshDeletes = {}", refreshDeletes );
                            }

                            control.setRefreshDeletes( refreshDeletes );

                            container.setSyncInfoValueControl( control );
                        }
                        catch ( BooleanDecoderException be )
                        {
                            String msg = I18n.err( I18n.ERR_04024 );
                            LOG.error( msg, be );
                            throw new DecoderException( msg );
                        }
                    }
                } );

        /**
         * Transition from syncIdSet state to syncUUIDs
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         syncUUIDs      *SET OF* syncUUID
         *     }
         *    
         * Initialize the UUID set : no action associated, except allowing a grammar end
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.SET.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                UniversalTag.SET.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet syncUUIDs" )
                {
                    public void action( SyncInfoValueContainer container ) throws DecoderException
                    {
                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from syncIdSet cookie state to syncUUIDs
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         syncUUIDs      *SET OF* syncUUID
         *     }
         *    
         * Initialize the UUID set : no action associated
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE.ordinal()][UniversalTag.SET.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
                SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                UniversalTag.SET.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet syncUUIDs" )
                {
                    public void action( SyncInfoValueContainer container ) throws DecoderException
                    {
                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from syncIdSet refreshDeletes state to syncUUIDs
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         syncUUIDs      *SET OF* syncUUID
         *     }
         *    
         * Initialize the UUID set : no action associated
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE.ordinal()][UniversalTag.SET
            .getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE,
                SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                UniversalTag.SET.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet syncUUIDs" )
                {
                    public void action( SyncInfoValueContainer container ) throws DecoderException
                    {
                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from syncIdSet syncUUIDs to syncUUID
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         syncUUIDs      SET OF *syncUUID*
         *     }
         *    
         * Add the first UUID in the UUIDs list
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE.ordinal()][UniversalTag.OCTET_STRING
            .getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE,
                UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet first UUID" )
                {
                    public void action( SyncInfoValueContainer container ) throws DecoderException
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        Value value = container.getCurrentTLV().getValue();

                        byte[] uuid = value.getData();

                        // UUID must be exactly 16 bytes long
                        if ( ( uuid == null ) || ( uuid.length != 16 ) )
                        {
                            String msg = I18n.err( I18n.ERR_04027 );
                            LOG.error( msg );
                            throw new DecoderException( msg );
                        }

                        if ( IS_DEBUG )
                        {
                            LOG.debug( "UUID = " + Strings.dumpBytes( uuid ) );
                        }

                        // Store the UUID in the UUIDs list
                        control.addSyncUUID( uuid );

                        // We can have an END transition
                        container.setGrammarEndAllowed( true );
                    }
                } );

        /**
         * Transition from syncIdSet syncUUID to syncUUID
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         syncUUIDs      SET OF *syncUUID*
         *     }
         *    
         * Add a new UUID in the UUIDs list
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE.ordinal()][UniversalTag.OCTET_STRING
            .getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE,
                SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE,
                UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet UUID" )
                {
                    public void action( SyncInfoValueContainer container ) throws DecoderException
                    {
                        SyncInfoValue control = container.getSyncInfoValueControl();

                        Value value = container.getCurrentTLV().getValue();

                        byte[] uuid = value.getData();

                        // UUID must be exactly 16 bytes long
                        if ( ( uuid == null ) || ( uuid.length != 16 ) )
                        {
                            String msg = I18n.err( I18n.ERR_04027 );
                            LOG.error( msg );
                            throw new DecoderException( msg );
                        }

                        if ( IS_DEBUG )
                        {
                            LOG.debug( "UUID = " + Strings.dumpBytes( uuid ) );
View Full Code Here

                    }
                    catch ( IntegerDecoderException e )
                    {
                        String msg = I18n.err( I18n.ERR_04030 );
                        LOG.error( msg, e );
                        throw new DecoderException( msg );
                    }
                }
            } );

        /**
 
View Full Code Here

        }
        catch ( IntegerDecoderException ide )
        {
            LOG.error( I18n.err( I18n.ERR_04018, Strings.dumpBytes( value.getData() ), ide.getMessage() ) );

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

        if ( IS_DEBUG )
        {
            LOG.debug( "The result code is set to " + resultCode );
View Full Code Here

        }
        catch ( LongDecoderException lde )
        {
            String msg = I18n.err( I18n.ERR_04103, value.toString() );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        searchRequest.setSizeLimit( sizeLimit );

        if ( IS_DEBUG )
View Full Code Here

        }
        catch ( IntegerDecoderException ide )
        {
            String msg = I18n.err( I18n.ERR_04101, value.toString() );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        searchRequest.setScope( SearchScope.getSearchScope( scope ) );

        if ( IS_DEBUG )
View Full Code Here

        }
        catch ( IntegerDecoderException ide )
        {
            String msg = I18n.err( I18n.ERR_04104, value.toString() );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        searchRequest.setTimeLimit( timeLimit );

        if ( IS_DEBUG )
View Full Code Here

        }
        catch ( IntegerDecoderException ide )
        {
            String msg = I18n.err( I18n.ERR_04102, value.toString() );
            LOG.error( msg );
            throw new DecoderException( msg );
        }

        searchRequest.setDerefAliases( AliasDerefMode.getDerefMode( derefAliases ) );

        if ( IS_DEBUG )
View Full Code Here

        catch ( BooleanDecoderException bde )
        {
            LOG.error( I18n
                .err( I18n.ERR_04105, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );

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

        if ( IS_DEBUG )
        {
            LOG.debug( "The search will return {}", ( searchRequest.getTypesOnly() ? "only attributs type"
View Full Code Here

                    }
                    catch ( BooleanDecoderException be )
                    {
                        String msg = I18n.err( I18n.ERR_04025 );
                        LOG.error( msg, be );
                        throw new DecoderException( msg );
                    }


                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
            } );


        /**
         * Transition from refreshDelete choice state to refreshDone
         *     refreshDelete [1] SEQUENCE {
         *         ....
         *         refreshDone BOOLEAN DEFAULT TRUE
         *     }
         *    
         * Load the refreshDone flag
         */
        super.transitions[SyncInfoValueStatesEnum.REFRESH_DELETE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_DELETE_STATE,
                                    SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE,
                                    UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "RefreshDelete refreshDone flag" )
            {
                public void action( SyncInfoValueContainer container ) throws DecoderException
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    Value value = container.getCurrentTLV().getValue();

                    try
                    {
                        boolean refreshDone = BooleanDecoder.parse( value );

                        if ( IS_DEBUG )
                        {
                            LOG.debug( "refreshDone = {}", refreshDone );
                        }

                        control.setRefreshDone( refreshDone );

                        container.setSyncInfoValueControl( control );

                        // the END transition for grammar
                        container.setGrammarEndAllowed( true );
                    }
                    catch ( BooleanDecoderException be )
                    {
                        String msg = I18n.err( I18n.ERR_04025 );
                        LOG.error( msg, be );
                        throw new DecoderException( msg );
                    }


                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
            } );
       
       
        /**
         * Transition from initial state to SyncInfoValue refreshPresent choice
         * SyncInfoValue ::= CHOICE {
         *     ...
         *     refreshPresent [2] SEQUENCE {
         *     ...
         *    
         * Initialize the syncInfoValue object
         */
        super.transitions[SyncInfoValueStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.REFRESH_PRESENT_TAG.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.START_STATE,
                                    SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
                                    SyncInfoValueTags.REFRESH_PRESENT_TAG.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "RefreshDelete choice for SyncInfoValueControl" )
            {
                public void action( SyncInfoValueContainer container )
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    container.setSyncInfoValueControl( control );

                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
            } );

   
        /**
         * Transition from refreshPresent state to cookie
         *     refreshPresent [2] SEQUENCE {
         *         cookie syncCookie OPTIONAL,
         *     ...
         *    
         * Load the cookie object
         */
        super.transitions[SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
                                    SyncInfoValueStatesEnum.REFRESH_PRESENT_COOKIE_STATE,
                                    UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "RefreshPresent cookie" )
            {
                public void action( SyncInfoValueContainer container )
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    Value value = container.getCurrentTLV().getValue();

                    byte[] cookie = value.getData();

                    if ( IS_DEBUG )
                    {
                        LOG.debug( "cookie = " + Strings.dumpBytes(cookie) );
                    }

                    container.getSyncInfoValueControl().setCookie( cookie );
                    container.setSyncInfoValueControl( control );

                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
            } );
       
       


        /**
         * Transition from refreshPresent cookie state to refreshDone
         *     refreshPresent [2] SEQUENCE {
         *         ....
         *         refreshDone BOOLEAN DEFAULT TRUE
         *     }
         *    
         * Load the refreshDone flag
         */
        super.transitions[SyncInfoValueStatesEnum.REFRESH_PRESENT_COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_PRESENT_COOKIE_STATE,
                                    SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE,
                                    UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "RefreshPresent refreshDone flag" )
            {
                public void action( SyncInfoValueContainer container ) throws DecoderException
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    Value value = container.getCurrentTLV().getValue();

                    try
                    {
                        boolean refreshDone = BooleanDecoder.parse( value );

                        if ( IS_DEBUG )
                        {
                            LOG.debug( "refreshDone = {}", refreshDone );
                        }

                        control.setRefreshDone( refreshDone );

                        container.setSyncInfoValueControl( control );

                        // the END transition for grammar
                        container.setGrammarEndAllowed( true );
                    }
                    catch ( BooleanDecoderException be )
                    {
                        String msg = I18n.err( I18n.ERR_04025 );
                        LOG.error( msg, be );
                        throw new DecoderException( msg );
                    }


                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
            } );


        /**
         * Transition from refreshPresent choice state to refreshDone
         *     refreshPresent [1] SEQUENCE {
         *         ....
         *         refreshDone BOOLEAN DEFAULT TRUE
         *     }
         *    
         * Load the refreshDone flag
         */
        super.transitions[SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
                                    SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE,
                                    UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "RefreshPresent refreshDone flag" )
            {
                public void action( SyncInfoValueContainer container ) throws DecoderException
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    Value value = container.getCurrentTLV().getValue();

                    try
                    {
                        boolean refreshDone = BooleanDecoder.parse( value );

                        if ( IS_DEBUG )
                        {
                            LOG.debug( "refreshDone = {}", refreshDone );
                        }

                        control.setRefreshDone( refreshDone );

                        container.setSyncInfoValueControl( control );

                        // the END transition for grammar
                        container.setGrammarEndAllowed( true );
                    }
                    catch ( BooleanDecoderException be )
                    {
                        String msg = I18n.err( I18n.ERR_04025 );
                        LOG.error( msg, be );
                        throw new DecoderException( msg );
                    }

                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
            } );
       
       
        /**
         * Transition from initial state to SyncInfoValue syncIdSet choice
         * SyncInfoValue ::= CHOICE {
         *     ...
         *     syncIdSet [3] SEQUENCE {
         *     ...
         *    
         * Initialize the syncInfoValue object
         */
        super.transitions[SyncInfoValueStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.SYNC_ID_SET_TAG.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.START_STATE,
                                    SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                                    SyncInfoValueTags.SYNC_ID_SET_TAG.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet choice for SyncInfoValueControl" )
            {
                public void action( SyncInfoValueContainer container )
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    container.setSyncInfoValueControl( control );
                }
            } );
       
       
        /**
         * Transition from syncIdSet state to cookie
         *     syncIdSet [3] SEQUENCE {
         *         cookie syncCookie OPTIONAL,
         *     ...
         *    
         * Load the cookie object
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                                    SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
                                    UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet cookie" )
            {
                public void action( SyncInfoValueContainer container )
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    Value value = container.getCurrentTLV().getValue();

                    byte[] cookie = value.getData();

                    if ( IS_DEBUG )
                    {
                        LOG.debug( "cookie = " + Strings.dumpBytes(cookie) );
                    }

                    container.getSyncInfoValueControl().setCookie( cookie );
                    container.setSyncInfoValueControl( control );
                }
            } );
       
       
        /**
         * Transition from syncIdSet state to refreshDeletes
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         refreshDeletes BOOLEAN DEFAULT FALSE,
         *     ...
         *    
         * Load the refreshDeletes flag
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                                    SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE,
                                    UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet refreshDeletes" )
            {
                public void action( SyncInfoValueContainer container ) throws DecoderException
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    Value value = container.getCurrentTLV().getValue();

                    try
                    {
                        boolean refreshDeletes = BooleanDecoder.parse( value );

                        if ( IS_DEBUG )
                        {
                            LOG.debug( "refreshDeletes = {}", refreshDeletes );
                        }

                        control.setRefreshDeletes( refreshDeletes );

                        container.setSyncInfoValueControl( control );
                    }
                    catch ( BooleanDecoderException be )
                    {
                        String msg = I18n.err( I18n.ERR_04026 );
                        LOG.error( msg, be );
                        throw new DecoderException( msg );
                    }
                }
            } );
       
       
        /**
         * Transition from syncIdSet cookie state to refreshDeletes
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         refreshDeletes BOOLEAN DEFAULT FALSE,
         *     ...
         *    
         * Load the refreshDeletes flag
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
                                    SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE,
                                    UniversalTag.BOOLEAN.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet refreshDeletes" )
            {
                public void action( SyncInfoValueContainer container ) throws DecoderException
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    Value value = container.getCurrentTLV().getValue();

                    try
                    {
                        boolean refreshDeletes = BooleanDecoder.parse( value );

                        if ( IS_DEBUG )
                        {
                            LOG.debug( "refreshDeletes = {}", refreshDeletes );
                        }

                        control.setRefreshDeletes( refreshDeletes );

                        container.setSyncInfoValueControl( control );
                    }
                    catch ( BooleanDecoderException be )
                    {
                        String msg = I18n.err( I18n.ERR_04024 );
                        LOG.error( msg, be );
                        throw new DecoderException( msg );
                    }
                }
            } );
       
       
        /**
         * Transition from syncIdSet state to syncUUIDs
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         syncUUIDs      *SET OF* syncUUID
         *     }
         *    
         * Initialize the UUID set : no action associated, except allowing a grammar end
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.SET.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                                    SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                                    UniversalTag.SET.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet syncUUIDs" )
            {
                public void action( SyncInfoValueContainer container ) throws DecoderException
                {
                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
            } );
       
       
        /**
         * Transition from syncIdSet cookie state to syncUUIDs
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         syncUUIDs      *SET OF* syncUUID
         *     }
         *    
         * Initialize the UUID set : no action associated
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE.ordinal()][UniversalTag.SET.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
                                    SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                                    UniversalTag.SET.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet syncUUIDs" )
            {
                public void action( SyncInfoValueContainer container ) throws DecoderException
                {
                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
            } );
         
       
        /**
         * Transition from syncIdSet refreshDeletes state to syncUUIDs
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         syncUUIDs      *SET OF* syncUUID
         *     }
         *    
         * Initialize the UUID set : no action associated
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE.ordinal()][UniversalTag.SET.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE,
                                    SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                                    UniversalTag.SET.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet syncUUIDs" )
            {
                public void action( SyncInfoValueContainer container ) throws DecoderException
                {
                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
            } );
       
       
        /**
         * Transition from syncIdSet syncUUIDs to syncUUID
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         syncUUIDs      SET OF *syncUUID*
         *     }
         *    
         * Add the first UUID in the UUIDs list
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                                    SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE,
                                    UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet first UUID" )
            {
                public void action( SyncInfoValueContainer container ) throws DecoderException
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    Value value = container.getCurrentTLV().getValue();

                    byte[] uuid = value.getData();
                   
                    // UUID must be exactly 16 bytes long
                    if ( ( uuid == null ) || ( uuid.length != 16 ) )
                    {
                        String msg = I18n.err( I18n.ERR_04027 );
                        LOG.error( msg );
                        throw new DecoderException( msg );
                    }

                    if ( IS_DEBUG )
                    {
                        LOG.debug( "UUID = " + Strings.dumpBytes(uuid) );
                    }

                    // Store the UUID in the UUIDs list
                    control.addSyncUUID( uuid );
                   
                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
            } );
       
       
        /**
         * Transition from syncIdSet syncUUID to syncUUID
         *     syncIdSet [3] SEQUENCE {
         *         ...
         *         syncUUIDs      SET OF *syncUUID*
         *     }
         *    
         * Add a new UUID in the UUIDs list
         */
        super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE,
                                    SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE,
                                    UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<SyncInfoValueContainer>( "SyncIdSet UUID" )
            {
                public void action( SyncInfoValueContainer container ) throws DecoderException
                {
                    SyncInfoValue control = container.getSyncInfoValueControl();
                   
                    Value value = container.getCurrentTLV().getValue();

                    byte[] uuid = value.getData();
                   
                    // UUID must be exactly 16 bytes long
                    if ( ( uuid == null ) || ( uuid.length != 16 ) )
                    {
                        String msg = I18n.err( I18n.ERR_04027 );
                        LOG.error( msg );
                        throw new DecoderException( msg );
                    }

                    if ( IS_DEBUG )
                    {
                        LOG.debug( "UUID = " + Strings.dumpBytes(uuid) );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.asn1.DecoderException

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.