public PasswordModifyRequestGrammar()

in ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestGrammar.java [64:343]


    public PasswordModifyRequestGrammar()
    {
        setName( PasswordModifyRequestGrammar.class.getName() );

        // Create the transitions table
        super.transitions = new GrammarTransition[PasswordModifyRequestStatesEnum.LAST_PASSWORD_MODIFY_REQUEST_STATE
            .ordinal()][256];

        /**
         * Transition from init state to PasswordModify Request Value
         * 
         * PasswdModifyRequestValue ::= SEQUENCE {
         *     ...
         *     
         * Creates the PasswdModifyRequest object
         */
        super.transitions[PasswordModifyRequestStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
            new GrammarTransition<PasswordModifyRequestContainer>(
                PasswordModifyRequestStatesEnum.START_STATE,
                PasswordModifyRequestStatesEnum.PASSWORD_MODIFY_REQUEST_SEQUENCE_STATE,
                UniversalTag.SEQUENCE.getValue(), new GrammarAction<PasswordModifyRequestContainer>(
                    "Init PasswordModifyRequest" )
                {
                    public void action( PasswordModifyRequestContainer container )
                    {
                        // We may have nothing left
                        if ( container.getCurrentTLV().getLength() == 0 )
                        {
                            container.setGrammarEndAllowed( true );
                        }
                    }
                },
                FollowUp.OPTIONAL );

        /**
         * Transition from PasswordModify Request Value to userIdentity
         *
         * PasswdModifyRequestValue ::= SEQUENCE {
         *     userIdentity    [0]  OCTET STRING OPTIONAL
         *     ...
         *     
         * Set the userIdentity into the PasswdModifyRequest instance.
         */
        super.transitions[PasswordModifyRequestStatesEnum.PASSWORD_MODIFY_REQUEST_SEQUENCE_STATE.ordinal()][PasswordModifyRequestConstants.USER_IDENTITY_TAG] =
            new GrammarTransition<PasswordModifyRequestContainer>(
                PasswordModifyRequestStatesEnum.PASSWORD_MODIFY_REQUEST_SEQUENCE_STATE,
                PasswordModifyRequestStatesEnum.USER_IDENTITY_STATE,
                PasswordModifyRequestConstants.USER_IDENTITY_TAG,
                new GrammarAction<PasswordModifyRequestContainer>( "Set PasswordModifyRequest user identity" )
                {
                    public void action( PasswordModifyRequestContainer container )
                    {
                        BerValue value = container.getCurrentTLV().getValue();

                        byte[] userIdentity = value.getData();

                        if ( LOG.isDebugEnabled() )
                        {
                            LOG.debug( I18n.msg( I18n.MSG_08217_USER_IDENTITY, Strings.dumpBytes( userIdentity ) ) );
                        }

                        if ( userIdentity == null )
                        {
                            userIdentity = Strings.EMPTY_BYTES;
                        }

                        container.getPwdModifyRequest().setUserIdentity( userIdentity );

                        // We may have nothing left
                        container.setGrammarEndAllowed( true );
                    }
                },
                FollowUp.OPTIONAL );

        /**
         * Transition from userIdentity to oldPassword
         *
         * PasswdModifyRequestValue ::= SEQUENCE {
         *     userIdentity    [0]  OCTET STRING OPTIONAL
         *     oldPassword     [1]  OCTET STRING OPTIONAL
         *     ...
         *     
         * Set the oldPassword into the PasswdModifyRequest instance.
         */
        super.transitions[PasswordModifyRequestStatesEnum.USER_IDENTITY_STATE.ordinal()][PasswordModifyRequestConstants.OLD_PASSWORD_TAG] =
            new GrammarTransition<PasswordModifyRequestContainer>(
                PasswordModifyRequestStatesEnum.USER_IDENTITY_STATE,
                PasswordModifyRequestStatesEnum.OLD_PASSWORD_STATE,
                PasswordModifyRequestConstants.OLD_PASSWORD_TAG,
                new GrammarAction<PasswordModifyRequestContainer>( "Set PasswordModifyRequest oldPassword" )
                {
                    public void action( PasswordModifyRequestContainer container )
                    {
                        BerValue value = container.getCurrentTLV().getValue();

                        byte[] oldPassword = value.getData();

                        if ( LOG.isDebugEnabled() )
                        {
                            LOG.debug( I18n.msg( I18n.MSG_08209_OLD_PASSWORD ) );
                        }

                        if ( oldPassword == null )
                        {
                            oldPassword = Strings.EMPTY_BYTES;
                        }

                        container.getPwdModifyRequest().setOldPassword( oldPassword );

                        // We may have nothing left
                        container.setGrammarEndAllowed( true );
                    }
                },
                FollowUp.OPTIONAL );

        /**
         * Transition from userIdentity to newPassword
         *
         * PasswdModifyRequestValue ::= SEQUENCE {
         *     userIdentity    [0]  OCTET STRING OPTIONAL
         *     ...
         *     newPassword     [2]  OCTET STRING OPTIONAL
         * 
         *     
         * Set the newPassword into the PasswdModifyRequest instance.
         */
        super.transitions[PasswordModifyRequestStatesEnum.USER_IDENTITY_STATE.ordinal()][PasswordModifyRequestConstants.NEW_PASSWORD_TAG] =
            new GrammarTransition<PasswordModifyRequestContainer>(
                PasswordModifyRequestStatesEnum.USER_IDENTITY_STATE,
                PasswordModifyRequestStatesEnum.NEW_PASSWORD_STATE,
                PasswordModifyRequestConstants.NEW_PASSWORD_TAG,
                new GrammarAction<PasswordModifyRequestContainer>( "Set PasswordModifyRequest newPassword" )
                {
                    public void action( PasswordModifyRequestContainer container )
                    {
                        BerValue value = container.getCurrentTLV().getValue();

                        byte[] newPassword = value.getData();

                        if ( LOG.isDebugEnabled() )
                        {
                            LOG.debug( I18n.msg( I18n.MSG_08208_NEW_PASSWORD ) );
                        }

                        if ( newPassword == null )
                        {
                            newPassword = Strings.EMPTY_BYTES;
                        }

                        container.getPwdModifyRequest().setNewPassword( newPassword );

                        // We may have nothing left
                        container.setGrammarEndAllowed( true );
                    }
                },
                FollowUp.OPTIONAL );

        /**
         * Transition from PasswordModify Request Value to oldPassword
         *
         * PasswdModifyRequestValue ::= SEQUENCE {
         *     ...
         *     oldPassword    [1]  OCTET STRING OPTIONAL
         *     ...
         *     
         * Set the oldPassword into the PasswdModifyRequest instance.
         */
        super.transitions[PasswordModifyRequestStatesEnum.PASSWORD_MODIFY_REQUEST_SEQUENCE_STATE.ordinal()][PasswordModifyRequestConstants.OLD_PASSWORD_TAG] =
            new GrammarTransition<PasswordModifyRequestContainer>(
                PasswordModifyRequestStatesEnum.PASSWORD_MODIFY_REQUEST_SEQUENCE_STATE,
                PasswordModifyRequestStatesEnum.OLD_PASSWORD_STATE,
                PasswordModifyRequestConstants.OLD_PASSWORD_TAG,
                new GrammarAction<PasswordModifyRequestContainer>( "Set PasswordModifyRequest oldPassword" )
                {
                    public void action( PasswordModifyRequestContainer container )
                    {
                        BerValue value = container.getCurrentTLV().getValue();

                        byte[] oldPassword = value.getData();

                        if ( LOG.isDebugEnabled() )
                        {
                            LOG.debug( I18n.msg( I18n.MSG_08209_OLD_PASSWORD ) );
                        }

                        if ( oldPassword == null )
                        {
                            oldPassword = Strings.EMPTY_BYTES;
                        }

                        container.getPwdModifyRequest().setOldPassword( oldPassword );

                        // We may have nothing left
                        container.setGrammarEndAllowed( true );
                    }
                },
                FollowUp.OPTIONAL );

        /**
         * Transition from PasswordModify Request Value to newPassword
         *
         * PasswdModifyRequestValue ::= SEQUENCE {
         *     ...
         *     newPassword    [2]  OCTET STRING OPTIONAL
         * }
         *     
         * Set the newPassword into the PasswdModifyRequest instance.
         */
        super.transitions[PasswordModifyRequestStatesEnum.PASSWORD_MODIFY_REQUEST_SEQUENCE_STATE.ordinal()][PasswordModifyRequestConstants.NEW_PASSWORD_TAG] =
            new GrammarTransition<PasswordModifyRequestContainer>(
                PasswordModifyRequestStatesEnum.PASSWORD_MODIFY_REQUEST_SEQUENCE_STATE,
                PasswordModifyRequestStatesEnum.NEW_PASSWORD_STATE,
                PasswordModifyRequestConstants.NEW_PASSWORD_TAG,
                new GrammarAction<PasswordModifyRequestContainer>( "Set PasswordModifyRequest newPassword" )
                {
                    public void action( PasswordModifyRequestContainer container )
                    {
                        BerValue value = container.getCurrentTLV().getValue();

                        byte[] newPassword = value.getData();

                        if ( LOG.isDebugEnabled() )
                        {
                            LOG.debug( I18n.msg( I18n.MSG_08208_NEW_PASSWORD ) );
                        }

                        if ( newPassword == null )
                        {
                            newPassword = Strings.EMPTY_BYTES;
                        }

                        container.getPwdModifyRequest().setNewPassword( newPassword );

                        // We may have nothing left
                        container.setGrammarEndAllowed( true );
                    }
                },
                FollowUp.OPTIONAL );

        /**
         * Transition from oldPassword to newPassword
         *
         *     ...
         *     oldPassword    [1]  OCTET STRING OPTIONAL
         *     newPassword    [2]  OCTET STRING OPTIONAL
         * }
         *     
         * Set the newPassword into the PasswdModifyRequest instance.
         */
        super.transitions[PasswordModifyRequestStatesEnum.OLD_PASSWORD_STATE.ordinal()][PasswordModifyRequestConstants.NEW_PASSWORD_TAG] =
            new GrammarTransition<PasswordModifyRequestContainer>(
                PasswordModifyRequestStatesEnum.OLD_PASSWORD_STATE,
                PasswordModifyRequestStatesEnum.NEW_PASSWORD_STATE,
                PasswordModifyRequestConstants.NEW_PASSWORD_TAG,
                new GrammarAction<PasswordModifyRequestContainer>( "Set PasswordModifyRequest newPassword" )
                {
                    public void action( PasswordModifyRequestContainer container )
                    {
                        BerValue value = container.getCurrentTLV().getValue();

                        byte[] newPassword = value.getData();

                        if ( LOG.isDebugEnabled() )
                        {
                            LOG.debug( I18n.msg( I18n.MSG_08208_NEW_PASSWORD ) );
                        }

                        if ( newPassword == null )
                        {
                            newPassword = Strings.EMPTY_BYTES;
                        }

                        container.getPwdModifyRequest().setNewPassword( newPassword );

                        // We may have nothing left
                        container.setGrammarEndAllowed( true );
                    }
                },
                FollowUp.OPTIONAL );
    }