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

Examples of org.apache.directory.shared.ldap.model.message.ResultCodeEnum


            {
                System.out.println( "renaming " + personDn + " on the server " + nc.getConfig().getLdapHost() + ":" + nc.getConfig().getLdapPort() );   
            }
           
            ModifyDnResponse resp = nc.modifyDn( modReq );
            ResultCodeEnum rc = resp.getLdapResult().getResultCode();
            if( rc != ResultCodeEnum.SUCCESS )
            {
                System.out.println( "Error renaming " + personDn + " on the server " + nc.getConfig().getLdapHost() + ":" + nc.getConfig().getLdapPort() + " with result code " + rc );
            }
           
View Full Code Here


            {
                System.out.println( "deleting " + personDn + " on the server " + nc.getConfig().getLdapHost() + ":" + nc.getConfig().getLdapPort() );
            }
           
            DeleteResponse resp = nc.delete( delReq );
            ResultCodeEnum rc = resp.getLdapResult().getResultCode();

            if( rc != ResultCodeEnum.SUCCESS )
            {
                System.out.println( "Error deleting " + personDn + " on the server " + nc.getConfig().getLdapHost() + ":" + nc.getConfig().getLdapPort() + " with result code " + rc );
            }
View Full Code Here

            connection.bind( ( String ) null, "abc" );
            fail();
        }
        catch ( LdapAuthenticationException lae )
        {
            ResultCodeEnum resultCode = lae.getResultCode();
            assertEquals( ResultCodeEnum.INVALID_CREDENTIALS, resultCode );
            assertFalse( connection.isAuthenticated() );
            assertTrue( connection.isConnected() );
        }
    }
View Full Code Here

            connection.bind( "uid=admin,ou=system" );
            fail();
        }
        catch ( LdapUnwillingToPerformException lutpe )
        {
            ResultCodeEnum resultCode = lutpe.getResultCode();
            assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, resultCode );
            assertFalse( connection.isAuthenticated() );
            assertTrue( connection.isConnected() );
        }
    }
View Full Code Here

            connection.bind( "uid=admin,ou=system", "badpassword" );
            fail();
        }
        catch ( LdapAuthenticationException lae )
        {
            ResultCodeEnum resultCode = lae.getResultCode();
            assertEquals( ResultCodeEnum.INVALID_CREDENTIALS, resultCode );
            assertFalse( connection.isAuthenticated() );
            assertTrue( connection.isConnected() );
        }
    }
View Full Code Here

            connection.bind( "uid=wrong,ou=system", "secret" );
            fail();
        }
        catch ( LdapAuthenticationException lae )
        {
            ResultCodeEnum resultCode = lae.getResultCode();
            assertEquals( ResultCodeEnum.INVALID_CREDENTIALS, resultCode );
            assertFalse( connection.isAuthenticated() );
            assertTrue( connection.isConnected() );
        }
    }
View Full Code Here

        catch ( Exception e )
        {
            // Something went wrong. Write back an error message
            // For BindRequest, it should be an InvalidCredentials,
            // no matter what kind of exception we got.
            ResultCodeEnum code = null;
            LdapResult result = bindRequest.getResultResponse().getLdapResult();

            if ( e instanceof LdapUnwillingToPerformException )
            {
                code = ResultCodeEnum.UNWILLING_TO_PERFORM;
                result.setResultCode( code );
            }
            else if ( e instanceof LdapInvalidDnException)
            {
                code = ResultCodeEnum.INVALID_DN_SYNTAX;
                result.setResultCode( code );
            }
            else
            {
                code = ResultCodeEnum.INVALID_CREDENTIALS;
                result.setResultCode( code );
            }

            String msg = code.toString() + ": Bind failed: " + e.getLocalizedMessage();

            if ( LOG.isDebugEnabled() )
            {
                msg += ":\n" + ExceptionUtils.getStackTrace( e );
                msg += "\n\nBindRequest = \n" + bindRequest.toString();
View Full Code Here

        LdapResult result = req.getResultResponse().getLdapResult();

        /*
         * Set the result code or guess the best option.
         */
        ResultCodeEnum code;

        if ( e instanceof LdapOperationException )
        {
            code = ( (LdapOperationException) e ).getResultCode();
        }
        else
        {
            code = ResultCodeEnum.getBestEstimate( e, req.getType() );
        }

        result.setResultCode( code );

        /*
         * Setup the error message to put into the request and put entire
         * exception into the message if we are in debug mode.  Note we
         * embed the result code name into the message.
         */
        String msg = code.toString() + ": failed for " + req + ": " + e.getLocalizedMessage();
        LOG.debug( msg, e );

        if ( IS_DEBUG )
        {
            msg += ":\n" + ExceptionUtils.getStackTrace( e );
View Full Code Here

            }

            resp = sf.get();
        }

        ResultCodeEnum resultCode = handleSearchDone( ( SearchResultDone ) resp );

        LOG.debug( "sync operation returned result code {}", resultCode );
        if ( resultCode == ResultCodeEnum.NO_SUCH_OBJECT )
        {
            // log the error and handle it appropriately
View Full Code Here

            LOG.debug( "Returned SUCCESS message: {}.", response );
        }
        catch ( LdapException e )
        {
            // Something went wrong. Write back an error message           
            ResultCodeEnum code = null;
            LdapResult result = bindRequest.getResultResponse().getLdapResult();

            if ( e instanceof LdapOperationException )
            {
                code = ( (LdapOperationException) e ).getResultCode();
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.message.ResultCodeEnum

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.