Examples of SyncStateValue


Examples of org.apache.directory.shared.ldap.extras.controls.SyncStateValue

            {
              0x30, 0x00 // SyncStateValue ::= SEQUENCE {
            } );
        bb.flip();

        SyncStateValue decorator = new SyncStateValueDecorator( codec );

        ((SyncStateValueDecorator)decorator).decode( bb.array() );
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.extras.controls.SyncStateValue

              0x30, 0x05,                 // SyncStateValue ::= SEQUENCE {
                0x04, 0x03, 'a', 'b', 'c' //     cookie syncCookie OPTIONAL,
            } );
        bb.flip();

        SyncStateValue decorator = new SyncStateValueDecorator( codec );

        ((SyncStateValueDecorator)decorator).decode( bb.array() );
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.extras.controls.SyncStateValue

                                           //         modify (2)
                                           //     }
            } );
        bb.flip();

        SyncStateValue decorator = new SyncStateValueDecorator( codec );

        ((SyncStateValueDecorator)decorator).decode( bb.array() );
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.extras.controls.SyncStateValue

                0x04, 0x03, 'a', 'b', 'c',     //     entryUUID syncUUID OPTIONAL,
                0x04, 0x04, 'x', 'k', 'c', 'd' //     cookie syncCookie OPTIONAL,
            } );
        bb.flip();

        SyncStateValue decorator = new SyncStateValueDecorator( codec );

        SyncStateValue syncStateValue = (SyncStateValue)((SyncStateValueDecorator)decorator).decode( bb.array() );

        assertEquals( SyncStateTypeEnum.MODDN, syncStateValue.getSyncStateType() );
        assertEquals( "abc", Strings.utf8ToString(syncStateValue.getEntryUUID()) );
        assertEquals( "xkcd", Strings.utf8ToString(syncStateValue.getCookie()) );

        // Check the encoding
        try
        {
            ByteBuffer encoded = ((SyncStateValueDecorator)syncStateValue).encode( ByteBuffer.allocate( ((SyncStateValueDecorator)syncStateValue).computeLength() ) );
View Full Code Here

Examples of org.apache.directory.shared.ldap.extras.controls.SyncStateValue

            } );
        bb.flip();

        SyncStateValueDecorator decorator = new SyncStateValueDecorator( codec );

        SyncStateValue syncStateValue = (SyncStateValue)decorator.decode( bb.array() );

        assertEquals( SyncStateTypeEnum.PRESENT, syncStateValue.getSyncStateType() );
        assertEquals( "abc", Strings.utf8ToString(syncStateValue.getEntryUUID()) );
        assertEquals( "xkcd", Strings.utf8ToString(syncStateValue.getCookie()) );

        // Check the encoding
        try
        {
            ByteBuffer encoded = ((SyncStateValueDecorator)syncStateValue).encode( ByteBuffer.allocate( ((SyncStateValueDecorator)syncStateValue).computeLength() ) );
View Full Code Here

Examples of org.apache.directory.shared.ldap.extras.controls.SyncStateValue

            } );
        bb.flip();

        SyncStateValueDecorator decorator = new SyncStateValueDecorator( codec );

        SyncStateValue syncStateValue = (SyncStateValue)decorator.decode( bb.array() );

        assertEquals( SyncStateTypeEnum.ADD, syncStateValue.getSyncStateType() );
        assertEquals( "abc", Strings.utf8ToString(syncStateValue.getEntryUUID()) );
        assertNull( syncStateValue.getCookie() );

        // Check the encoding
        try
        {
            ByteBuffer encoded = ((SyncStateValueDecorator)syncStateValue).encode( ByteBuffer.allocate( ((SyncStateValueDecorator)syncStateValue).computeLength() ) );
View Full Code Here

Examples of org.apache.directory.shared.ldap.extras.controls.SyncStateValue

            } );
        bb.flip();

        SyncStateValueDecorator decorator = new SyncStateValueDecorator( codec );

        SyncStateValue syncStateValue = (SyncStateValue)decorator.decode( bb.array() );

        assertEquals( SyncStateTypeEnum.MODIFY, syncStateValue.getSyncStateType() );
        assertEquals( "abc", Strings.utf8ToString(syncStateValue.getEntryUUID()) );
        assertEquals( "", Strings.utf8ToString(syncStateValue.getCookie()) );

        // Check the encoding
        try
        {
            bb = ByteBuffer.allocate( 0x0A );
View Full Code Here

Examples of org.apache.directory.shared.ldap.extras.controls.SyncStateValue

            } );
        bb.flip();

        SyncStateValueDecorator decorator = new SyncStateValueDecorator( codec );

        SyncStateValue syncStateValue = (SyncStateValue)decorator.decode( bb.array() );

        assertEquals( SyncStateTypeEnum.MODDN, syncStateValue.getSyncStateType() );
        assertEquals( "abc", Strings.utf8ToString(syncStateValue.getEntryUUID()) );
        assertEquals( "xkcd", Strings.utf8ToString(syncStateValue.getCookie()) );

        // Check the encoding
        try
        {
            ByteBuffer encoded = ((SyncStateValueDecorator)syncStateValue).encode( ByteBuffer.allocate( ((SyncStateValueDecorator)syncStateValue).computeLength() ) );
View Full Code Here

Examples of org.apache.directory.shared.ldap.extras.controls.SyncStateValue

    public void handleSearchResult( SearchResultEntry syncResult )
    {
        LOG.debug( "------------- starting handleSearchResult ------------" );

        SyncStateValue syncStateCtrl = ( SyncStateValue ) syncResult.getControl( SyncStateValue.OID );

        try
        {
            Entry remoteEntry = syncResult.getEntry();

            if ( syncStateCtrl.getCookie() != null )
            {
                syncCookie = syncStateCtrl.getCookie();
                LOG.debug( "assigning the cookie from sync state value control: "
                    + Strings.utf8ToString(syncCookie) );
            }

            SyncStateTypeEnum state = syncStateCtrl.getSyncStateType();

            LOG.debug( "state name {}", state.name() );

            // check to avoid conversion of UUID from byte[] to String
            if ( LOG.isDebugEnabled() )
            {
                LOG.debug( "entryUUID = {}", Strings.uuidToString(syncStateCtrl.getEntryUUID()) );
            }

            switch ( state )
            {
                case ADD:
                    //System.out.println( "Entry added : " + remoteEntry.getDn() );
                    nbAdded.getAndIncrement();
                    break;

                case MODIFY:
                    LOG.debug( "modifying entry with dn {}", remoteEntry.getDn().getName() );
                    modify( remoteEntry );
                    break;

                case MODDN:
                    SyncModifyDn adsModDnControl = ( SyncModifyDn ) syncResult.getControls().get( SyncModifyDn.OID );
                    //Apache Directory Server's special control
                    applyModDnOperation( adsModDnControl );
                    break;

                case DELETE:
                    LOG.debug( "deleting entry with dn {}", remoteEntry.getDn().getName() );
                    // incase of a MODDN operation resulting in a branch to be moved out of scope
                    // ApacheDS replication provider sends a single delete event on the Dn of the moved branch
                    // so the branch needs to be recursively deleted here
                    deleteRecursive( remoteEntry.getDn(), null );
                    break;

                case PRESENT:
                    LOG.debug( "entry present {}", remoteEntry );
                    break;
            }

            // store the cookie only if the above operation was successful
            if ( syncStateCtrl.getCookie() != null )
            {
                storeCookie();
            }
        }
        catch ( Exception e )
View Full Code Here

Examples of org.apache.directory.shared.ldap.extras.controls.SyncStateValue

    public void handleSearchResult( SearchResultEntry syncResult )
    {

        LOG.debug( "------------- starting handleSearchResult ------------" );

        SyncStateValue syncStateCtrl = ( SyncStateValue ) syncResult.getControl( SyncStateValue.OID );

        try
        {
            Entry remoteEntry = syncResult.getEntry();

            if ( syncStateCtrl.getCookie() != null )
            {
                syncCookie = syncStateCtrl.getCookie();
                LOG.debug( "assigning the cookie from sync state value control: "
                    + Strings.utf8ToString(syncCookie) );
            }

            SyncStateTypeEnum state = syncStateCtrl.getSyncStateType();

            LOG.debug( "state name {}", state.name() );

            // check to avoid conversion of UUID from byte[] to String
            if ( LOG.isDebugEnabled() )
            {
                LOG.debug( "entryUUID = {}", Strings.uuidToString(syncStateCtrl.getEntryUUID()) );
            }

            switch ( state )
            {
                case ADD:
                    Dn remoteDn = directoryService.getDnFactory().create( remoteEntry.getDn().getName() );
                    //System.out.println( "C: ADDING " + remoteDn );
                   
                    if ( !session.exists( remoteDn ) )
                    {
                        //System.out.println( "C: " + remoteDn + " does not exist, adding it" );
                        LOG.debug( "adding entry with dn {}", remoteDn );
                        LOG.debug( remoteEntry.toString() );
                        session.add( new DefaultEntry( schemaManager, remoteEntry ) );
                    }
                    else
                    {
                        //System.out.println( "C: " + remoteDn + " exists, modifying it" );
                        LOG.debug( "updating entry in refreshOnly mode {}", remoteDn );
                        modify( remoteEntry );
                    }

                    break;

                case MODIFY:
                    LOG.debug( "modifying entry with dn {}", remoteEntry.getDn().getName() );
                    //System.out.println( "C: MODIFY " + remoteEntry.getDn() );
                    modify( remoteEntry );
                    break;

                case MODDN:
                    SyncModifyDn adsModDnControl = ( SyncModifyDn ) syncResult.getControls().get( SyncModifyDn.OID );
                    //System.out.println( "C: MODDN " + adsModDnControl.getModDnType() + ", " + adsModDnControl.getEntryDn()
                    //    + ", " + adsModDnControl.getNewSuperiorDn() + ", " + adsModDnControl.getNewRdn() );
                    //Apache Directory Server's special control
                    applyModDnOperation( adsModDnControl );
                    break;

                case DELETE:
                    //System.out.println( "C: DELETING " + remoteEntry.getDn().getNormName() );
                    LOG.debug( "deleting entry with dn {}", remoteEntry.getDn().getName() );
                    // incase of a MODDN operation resulting in a branch to be moved out of scope
                    // ApacheDS replication provider sends a single delete event on the Dn of the moved branch
                    // so the branch needs to be recursively deleted here
                    deleteRecursive( remoteEntry.getDn(), null );
                    break;

                case PRESENT:
                    LOG.debug( "entry present {}", remoteEntry );
                    break;
            }

            // store the cookie only if the above operation was successful
            if ( syncStateCtrl.getCookie() != null )
            {
                storeCookie();
            }
        }
        catch ( Exception e )
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.