Package org.apache.directory.api.ldap.model.message

Examples of org.apache.directory.api.ldap.model.message.ExtendedResponse


        // Get the result from the future
        try
        {
            // Read the response, waiting for it if not available immediately
            // Get the response, blocking
            ExtendedResponse extendedResponse = ( ExtendedResponse ) extendedFuture
                .get( timeout, TimeUnit.MILLISECONDS );

            if ( extendedResponse == null )
            {
                // We didn't received anything : this is an error
                LOG.error( "Extended failed : timeout occurred" );
                throw new LdapException( TIME_OUT_ERROR );
            }

            if ( extendedResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
            {
                // Everything is fine, return the response
                LOG.debug( "Extended successful : {}", extendedResponse );
            }
            else
View Full Code Here


                throw new LdapException( "Cannot use TLS when the useSsl flag is set true in the configuration" );
            }

            checkSession();

            ExtendedResponse resp = extended( START_TLS_REQ_OID );
            LdapResult result = resp.getLdapResult();

            if ( result.getResultCode() == ResultCodeEnum.SUCCESS )
            {
                addSslFilter();
            }
View Full Code Here

        else
        {
            element = new DefaultElement( EXTENDED_RESPONSE_TAG );
        }

        ExtendedResponse extendedResponse = ( ExtendedResponse ) getDecorated();

        // LDAP Result
        LdapResultDsml ldapResultDsml = new LdapResultDsml( getCodecService(),
            getDecorated().getLdapResult(), getDecorated() );
        ldapResultDsml.toDsml( element );

        // ResponseName
        String responseName = extendedResponse.getResponseName();
        if ( responseName != null )
        {
            element.addElement( "responseName" ).addText( responseName );
        }
View Full Code Here

                writeResponse( respWriter, delResponseDsml );

                break;

            case EXTENDED_REQUEST:
                ExtendedResponse extendedResponse = connection.extended( ( ExtendedRequest<?> ) request );
                resultCode = extendedResponse.getLdapResult().getResultCode();
                ExtendedResponseDsml extendedResponseDsml = new ExtendedResponseDsml( connection.getCodecService(),
                    extendedResponse );
                writeResponse( respWriter, extendedResponseDsml );

                break;
View Full Code Here

            LdapResult result = req.getResultResponse().getLdapResult();
            result.setResultCode( ResultCodeEnum.OTHER );
            result.setDiagnosticMessage( ResultCodeEnum.OTHER
                + ": Extended operation handler for the specified EXTENSION_OID (" + req.getRequestName()
                + ") has failed to process your request:\n" + ExceptionUtils.getStackTrace( e ) );
            ExtendedResponse resp = req.getResultResponse();
            session.getIoSession().write( resp );
        }
    }
View Full Code Here

    @Test
    public void testExtended() throws Exception
    {
        try
        {
            ExtendedResponse response = connection.extended( StartTlsRequest.OID );
            assertNotNull( response );
            assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
        }
        finally
        {
            // close connection to stop TLS
            connection.close();
View Full Code Here

            ExtendedRequest extendedRequest = new ExtendedRequestImpl();
            extendedRequest.setRequestName( StartTlsRequest.OID );

            ExtendedFuture extendedFuture = connection.extendedAsync( extendedRequest );

            ExtendedResponse extendedResponse = ( ExtendedResponse ) extendedFuture.get( 1000, TimeUnit.MILLISECONDS );

            assertNotNull( extendedResponse );
            assertEquals( ResultCodeEnum.SUCCESS, extendedResponse.getLdapResult().getResultCode() );
            assertTrue( connection.isAuthenticated() );
        }
        finally
        {
            // close connection to stop TLS
View Full Code Here

     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<ExtendedResponseDecorator<?>> container ) throws DecoderException
    {
        // We can allocate the ExtendedResponse Object
        ExtendedResponse extendedResponse = null;

        // Get the Value and store it in the ExtendedResponse
        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_04017 );
            LOG.error( msg );
            throw new DecoderException( msg );
        }
        else
        {
            String responseName = new Oid( Strings.asciiBytesToString( tlv.getValue().getData() ) )
                .toString();

            extendedResponse = LdapApiServiceFactory.getSingleton().newExtendedResponse( responseName,
                container.getMessageId(), null );
            container.setMessage( LdapApiServiceFactory.getSingleton().decorate( extendedResponse ) );
        }

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

        if ( IS_DEBUG )
        {
            LOG.debug( "OID read : {}", extendedResponse.getResponseName() );
        }
    }
View Full Code Here

     */
    private boolean isNoticeOfDisconnect( Message message )
    {
        if ( message instanceof ExtendedResponse )
        {
            ExtendedResponse response = ( ExtendedResponse ) message;

            if ( response.getResponseName().equals( NoticeOfDisconnect.EXTENSION_OID ) )
            {
                return true;
            }
        }

View Full Code Here

                break;

            case EXTENDED_RESPONSE:
                // Transform the response
                ExtendedResponse extendedResponse = ( ExtendedResponse ) response;

                ExtendedFuture extendedFuture = ( ExtendedFuture ) responseFuture;

                // remove the listener from the listener map
                if ( LOG.isDebugEnabled() )
                {
                    if ( extendedResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
                    {
                        // Everything is fine, return the response
                        LOG.debug( "Extended successful : {}", extendedResponse );
                    }
                    else
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.message.ExtendedResponse

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.