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

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


                // Transform the response
                ExtendedResponseCodec extResCodec = (ExtendedResponseCodec)response;
                extResCodec.setMessageId( messageId );
                extResCodec.addControl( response.getCurrentControl() );

                ExtendedResponse extendedResponse = convert( extResCodec );

                ExtendedFuture extendedFuture = (ExtendedFuture)responseFuture;

                if ( extendedFuture == null )
                {
                    LOG.error( "ExtendedFuture is null" );
                    throw new LdapException( "extendedFuture is null"  );
                }

                // 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


        {
            // Read the response, waiting for it if not available immediately
            long timeout = getTimeout( extendedRequest.getTimeout() );

            // 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 occured" );
                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

    /**
     * converts the ExtendedResponseCodec to ExtendedResponse.
     */
    private ExtendedResponse convert( ExtendedResponseCodec extRespCodec )
    {
        ExtendedResponse extResponse = new ExtendedResponse();

        OID oid = null;
        try
        {
            if ( extRespCodec.getResponseName() != null )
            {
                oid = new OID( extRespCodec.getResponseName() );
            }
        }
        catch ( DecoderException e )
        {
            // can happen in case of a PROTOCOL_ERROR result, ignore
            //LOG.error( "invalid response name {}", extRespCodec.getResponseName() );
        }

        extResponse.setOid( oid );
        extResponse.setValue( extRespCodec.getResponse() );
        extResponse.setMessageId( extRespCodec.getMessageId() );
        extResponse.setLdapResult( convert( extRespCodec.getLdapResult() ) );

        return extResponse;
    }
View Full Code Here


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

       ExtendedFuture extendedFuture = connection.extendedAsync( extendedRequest );

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

           assertNotNull( extendedResponse );
           assertEquals( ResultCodeEnum.SUCCESS, extendedResponse.getLdapResult().getResultCode() );
           assertTrue( connection.isAuthenticated() );
       }
       catch ( TimeoutException toe )
       {
           fail();
View Full Code Here

TOP

Related Classes of org.apache.directory.ldap.client.api.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.