Package org.apache.directory.shared.ldap.codec.decorators

Examples of org.apache.directory.shared.ldap.codec.decorators.IntermediateResponseDecorator


            case EXTENDED_RESPONSE:
                decorator = codec.decorate( ( ExtendedResponse ) decoratedMessage );
                break;
               
            case INTERMEDIATE_RESPONSE:
                decorator = new IntermediateResponseDecorator( codec, ( IntermediateResponse ) decoratedMessage );
                break;
               
            case MODIFY_REQUEST:
                decorator = new ModifyRequestDecorator( codec, ( ModifyRequest ) decoratedMessage );
                break;
View Full Code Here


            LdapConstants.INTERMEDIATE_RESPONSE_TAG, new GrammarAction<LdapMessageContainer<IntermediateResponseDecorator>>( "Init Intermediate Response" )
            {
                public void action( LdapMessageContainer<IntermediateResponseDecorator> container ) throws DecoderException
                {
                    // Now, we can allocate the IntermediateResponse Object
                    IntermediateResponseDecorator intermediateResponse =
                        new IntermediateResponseDecorator( container.getLdapCodecService(),
                            new IntermediateResponseImpl( container.getMessageId() ) );
                    container.setMessage( intermediateResponse );

                    LOG.debug( "Intermediate Response" );
                }
            } );

        // --------------------------------------------------------------------------------------------
        // Transition from IntermediateResponse Message to ResponseName
        // --------------------------------------------------------------------------------------------
        // IntermediateResponse ::= [APPLICATION 25] SEQUENCE {
        //     responseName [0] LDAPOID OPTIONAL,
        //     ...
        //
        // Stores the name
        super.transitions[LdapStatesEnum.INTERMEDIATE_RESPONSE_STATE.ordinal()][LdapConstants.INTERMEDIATE_RESPONSE_NAME_TAG] = new GrammarTransition(
            LdapStatesEnum.INTERMEDIATE_RESPONSE_STATE, LdapStatesEnum.INTERMEDIATE_RESPONSE_NAME_STATE,
            LdapConstants.INTERMEDIATE_RESPONSE_NAME_TAG, new GrammarAction<LdapMessageContainer<IntermediateResponseDecorator>>( "Store response name" )
            {
                public void action( LdapMessageContainer<IntermediateResponseDecorator> container ) throws DecoderException
                {
                    // We can get the IntermediateResponse Object
                    IntermediateResponse intermediateResponse = container.getMessage();

                    // Get the Value and store it in the IntermediateResponse
                    TLV tlv = container.getCurrentTLV();

                    // We have to handle the special case of a 0 length matched
                    // OID.
                    if ( tlv.getLength() == 0 )
                    {
                        String msg = I18n.err( I18n.ERR_04095 );
                        LOG.error( msg );
                        // This will generate a PROTOCOL_ERROR                       
                        throw new DecoderException( msg );
                    }
                    else
                    {
                        byte[] responseNameBytes = tlv.getValue().getData();

                        String oidStr = Strings.utf8ToString(responseNameBytes);

                        if ( OID.isOID( oidStr ) )
                        {
                            OID.isOID( oidStr );
                            intermediateResponse.setResponseName( oidStr );
                        }
                        else
                        {
                            String msg = "The Intermediate Response name is not a valid OID : "
                                + Strings.utf8ToString(responseNameBytes) + " ("
                                + Strings.dumpBytes(responseNameBytes) + ") is invalid";
                            LOG.error( "{} : {}", msg, oidStr );

                            // Rethrow the exception, we will get a PROTOCOL_ERROR
                            throw new DecoderException( msg );
                        }
                    }

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

                    if ( IS_DEBUG )
                    {
                        LOG.debug( "OID read : {}", intermediateResponse.getResponseName() );
                    }
                }
            } );

        // --------------------------------------------------------------------------------------------
        // Transition from IntermediateResponse Message to ResponseValue (ResponseName is null)
        // --------------------------------------------------------------------------------------------
        // IntermediateResponse ::= [APPLICATION 25] SEQUENCE {
        //     ...
        //     responseValue [1] OCTET STRING OPTIONAL
        //     }
        //
        // Stores the value
        super.transitions[LdapStatesEnum.INTERMEDIATE_RESPONSE_STATE.ordinal()][LdapConstants.INTERMEDIATE_RESPONSE_VALUE_TAG] = new GrammarTransition(
            LdapStatesEnum.INTERMEDIATE_RESPONSE_STATE, LdapStatesEnum.INTERMEDIATE_RESPONSE_VALUE_STATE,
            LdapConstants.INTERMEDIATE_RESPONSE_VALUE_TAG,
            new GrammarAction<LdapMessageContainer<IntermediateResponseDecorator>>( "Store response value" )
            {
                public void action( LdapMessageContainer<IntermediateResponseDecorator> container ) throws DecoderException
                {
                    // We can get the IntermediateResponse Object
                    IntermediateResponse intermediateResponse = container.getMessage();

                    // Get the Value and store it in the IntermediateResponse
                    TLV tlv = container.getCurrentTLV();

                    // We have to handle the special case of a 0 length matched
                    // value
                    if ( tlv.getLength() == 0 )
                    {
                        intermediateResponse.setResponseValue( StringConstants.EMPTY_BYTES );
                    }
                    else
                    {
                        intermediateResponse.setResponseValue( tlv.getValue().getData() );
                    }

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

                    if ( IS_DEBUG )
                    {
                        LOG.debug( "Value read : {}", Strings.dumpBytes(intermediateResponse.getResponseValue()) );
                    }
                }
            } );

        // --------------------------------------------------------------------------------------------
        // Transition from ResponseName to ResponseValue
        // --------------------------------------------------------------------------------------------
        // IntermediateResponse ::= [APPLICATION 25] SEQUENCE {
        //     ...
        //     responseValue  [1] OCTET STRING OPTIONAL }
        //
        // Stores the value
        super.transitions[LdapStatesEnum.INTERMEDIATE_RESPONSE_NAME_STATE.ordinal()][LdapConstants.INTERMEDIATE_RESPONSE_VALUE_TAG] = new GrammarTransition(
            LdapStatesEnum.INTERMEDIATE_RESPONSE_NAME_STATE, LdapStatesEnum.INTERMEDIATE_RESPONSE_VALUE_STATE,
            LdapConstants.INTERMEDIATE_RESPONSE_VALUE_TAG,
            new GrammarAction<LdapMessageContainer<IntermediateResponseDecorator>>( "Store value" )
            {
                public void action( LdapMessageContainer<IntermediateResponseDecorator> container ) throws DecoderException
                {
                    // We can allocate the ExtendedRequest Object
                    IntermediateResponse intermediateResponse = container.getMessage();

                    // Get the Value and store it in the IntermediateResponse
                    TLV tlv = container.getCurrentTLV();

                    // We have to handle the special case of a 0 length matched
                    // value
                    if ( tlv.getLength() == 0 )
                    {
                        intermediateResponse.setResponseValue( StringConstants.EMPTY_BYTES );
                    }
                    else
                    {
                        intermediateResponse.setResponseValue( tlv.getValue().getData() );
                    }

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

                    if ( IS_DEBUG )
                    {
                        LOG.debug( "Response value : {}", intermediateResponse.getResponseValue() );
                    }
                }
            } );

        // --------------------------------------------------------------------------------------------
View Full Code Here

            case EXTENDED_RESPONSE:
                decorator = codec.decorate( ( ExtendedResponse ) decoratedMessage );
                break;
               
            case INTERMEDIATE_RESPONSE:
                decorator = new IntermediateResponseDecorator( codec, ( IntermediateResponse ) decoratedMessage );
                break;
               
            case MODIFY_REQUEST:
                decorator = new ModifyRequestDecorator( codec, ( ModifyRequest ) decoratedMessage );
                break;
View Full Code Here

     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<IntermediateResponseDecorator> container ) throws DecoderException
    {
        // Now, we can allocate the IntermediateResponse Object
        IntermediateResponseDecorator intermediateResponse =
            new IntermediateResponseDecorator( container.getLdapCodecService(),
                new IntermediateResponseImpl( container.getMessageId() ) );
        container.setMessage( intermediateResponse );

        LOG.debug( "Intermediate Response" );
    }
View Full Code Here

     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<IntermediateResponseDecorator> container ) throws DecoderException
    {
        // Now, we can allocate the IntermediateResponse Object
        IntermediateResponseDecorator intermediateResponse =
            new IntermediateResponseDecorator( container.getLdapCodecService(),
                new IntermediateResponseImpl( container.getMessageId() ) );
        container.setMessage( intermediateResponse );

        LOG.debug( "Intermediate Response" );
    }
View Full Code Here

            case EXTENDED_RESPONSE:
                decorator = codec.decorate( ( ExtendedResponse ) decoratedMessage );
                break;

            case INTERMEDIATE_RESPONSE:
                decorator = new IntermediateResponseDecorator( codec, ( IntermediateResponse ) decoratedMessage );
                break;

            case MODIFY_REQUEST:
                decorator = new ModifyRequestDecorator( codec, ( ModifyRequest ) decoratedMessage );
                break;
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.codec.decorators.IntermediateResponseDecorator

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.