Examples of ModifyDnResponse


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

        modDnReq.setNewRdn( new Rdn( "cn=modifyDnWithString" ) );
        modDnReq.setDeleteOldRdn( true );

        ModifyDnFuture modifyDnFuture = connection.modifyDnAsync( modDnReq );

        ModifyDnResponse response = modifyDnFuture.get( 1000, TimeUnit.MILLISECONDS );

        assertNotNull( response );

        assertTrue( connection.isAuthenticated() );
        assertFalse( session.exists( oldDn ) );
View Full Code Here

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

            throw new IllegalArgumentException( msg );
        }

        int newId = messageId.incrementAndGet();

        ModifyDnResponse resp = new ModifyDnResponseImpl( newId );
        LdapResult result = resp.getLdapResult();
        result.setResultCode( ResultCodeEnum.SUCCESS );

        if ( modDnRequest.getName().isEmpty() )
        {
            // it is not allowed to modify the name of the Root DSE
            String msg = "Modify Dn is not allowed on Root DSE.";
            result.setResultCode( ResultCodeEnum.PROTOCOL_ERROR );
            result.setDiagnosticMessage( msg );
            return resp;
        }

        try
        {
            Dn newRdn = null;

            if ( modDnRequest.getNewRdn() != null )
            {
                newRdn = new Dn( schemaManager, modDnRequest.getNewRdn().getName() );
            }

            Dn oldRdn = new Dn( schemaManager, modDnRequest.getName().getRdn().getName() );

            boolean rdnChanged = modDnRequest.getNewRdn() != null
                && !newRdn.getNormName().equals( oldRdn.getNormName() );

            if ( rdnChanged )
            {
                if ( modDnRequest.getNewSuperior() != null )
                {
                    session.moveAndRename( modDnRequest );
                }
                else
                {
                    session.rename( modDnRequest );
                }
            }
            else if ( modDnRequest.getNewSuperior() != null )
            {
                modDnRequest.setNewRdn( null );
                session.move( modDnRequest );
            }
            else
            {
                // This might be a simple change, we will update the DN and the entry
                // with the new provided value by using a modify operation later on
                session.rename( modDnRequest );
            }

        }
        catch ( LdapException e )
        {
            LOG.warn( e.getMessage(), e );

            resp.getLdapResult().setResultCode( ResultCodeEnum.getResultCode( e ) );
            resp.getLdapResult().setDiagnosticMessage( e.getMessage() );
        }

        addResponseControls( modDnRequest, resp );
        return resp;
    }
View Full Code Here

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

        ModifyDnRequest iModDnReq = new ModifyDnRequestImpl();
        iModDnReq.setName( entryDn );
        iModDnReq.setNewSuperior( newSuperiorDn );

        ModifyDnResponse modifyDnResponse = modifyDn( iModDnReq );
        processResponse( modifyDnResponse );
    }
View Full Code Here

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

        ModifyDnRequest modifyDnRequest = new ModifyDnRequestImpl();
        modifyDnRequest.setName( entryDn );
        modifyDnRequest.setNewRdn( newRdn );
        modifyDnRequest.setDeleteOldRdn( deleteOldRdn );

        ModifyDnResponse modifyDnResponse = modifyDn( modifyDnRequest );
        processResponse( modifyDnResponse );

    }
View Full Code Here

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

        if ( newDn.isRootDse() )
        {
            throw new IllegalArgumentException( "The RootDSE cannot be the target" );
        }

        ModifyDnResponse resp = new ModifyDnResponseImpl();
        resp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );

        ModifyDnRequest modifyDnRequest = new ModifyDnRequestImpl();

        modifyDnRequest.setName( entryDn );
        modifyDnRequest.setNewRdn( newDn.getRdn() );
        modifyDnRequest.setNewSuperior( newDn.getParent() );
        modifyDnRequest.setDeleteOldRdn( deleteOldRdn );

        ModifyDnResponse modifyDnResponse = modifyDn( modifyDnRequest );
        processResponse( modifyDnResponse );
    }
View Full Code Here

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

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

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

            if( verbose )
            {
                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

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

        ModifyDnRequest modReq = new ModifyDnRequestImpl();
        modReq.setName( ouDn );
        modReq.setNewRdn( ouDn.getRdn() );
        modReq.setNewSuperior( ouDn.getParent().getParent() );
       
        ModifyDnResponse resp = nc.modifyDn( modReq );
        ResultCodeEnum rc = resp.getLdapResult().getResultCode();
        if( rc != ResultCodeEnum.SUCCESS )
        {
            System.out.println( "Error moving " + ouDn + " on the server " + nc.getConfig().getLdapHost() + ":" + nc.getConfig().getLdapPort() + ":" + nc.getConfig().getLdapPort() + " with result code " + rc );
        }
View Full Code Here

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

                break;

            case MODIFYDN_RESPONSE:
                // Transform the response
                ModifyDnResponse modifyDnResponse = ( ModifyDnResponse ) response;

                ModifyDnFuture modifyDnFuture = ( ModifyDnFuture ) responseFuture;

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

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

        ModifyDnRequest modDnRequest = new ModifyDnRequestImpl();
        modDnRequest.setName( entryDn );
        modDnRequest.setNewRdn( newRdn );
        modDnRequest.setDeleteOldRdn( deleteOldRdn );

        ModifyDnResponse modifyDnResponse = modifyDn( modDnRequest );

        processResponse( modifyDnResponse );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.