Package org.apache.directory.api.ldap.extras.controls.syncrepl.syncInfoValue

Examples of org.apache.directory.api.ldap.extras.controls.syncrepl.syncInfoValue.SyncInfoValue


            {
                return;
            }

            SyncInfoValueDecorator decorator = new SyncInfoValueDecorator( directoryService.getLdapCodecService() );
            SyncInfoValue syncInfoValue = ( SyncInfoValue ) decorator.decode( syncInfoBytes );

            byte[] cookie = syncInfoValue.getCookie();

            if ( CONSUMER_LOG.isDebugEnabled() )
            {
                CONSUMER_LOG.debug( "Received a SyncInfoValue from producer {} : {}", config.getProducer(),
                    syncInfoValue );
            }

            int replicaId = -1;

            if ( cookie != null )
            {
                CONSUMER_LOG.debug( "setting the cookie from the sync info: " + Strings.utf8ToString( cookie ) );
                CONSUMER_LOG.debug( "setting the cookie from the sync info: " + Strings.utf8ToString( cookie ) );
                syncCookie = cookie;

                String cookieString = Strings.utf8ToString( syncCookie );
                replicaId = LdapProtocolUtils.getReplicaId( cookieString );
            }

            CONSUMER_LOG.info( "refreshDeletes: " + syncInfoValue.isRefreshDeletes() );

            List<byte[]> uuidList = syncInfoValue.getSyncUUIDs();

            // if refreshDeletes set to true then delete all the entries with entryUUID
            // present in the syncIdSet
            if ( syncInfoValue.isRefreshDeletes() )
            {
                deleteEntries( uuidList, false, replicaId );
            }
            else
            {
                deleteEntries( uuidList, true, replicaId );
            }

            CONSUMER_LOG.info( "refreshDone: " + syncInfoValue.isRefreshDone() );

            storeCookie();
        }
        catch ( Exception de )
        {
View Full Code Here


            if ( refreshNPersist )
            {
                IntermediateResponse intermResp = new IntermediateResponseImpl( req.getMessageId() );
                intermResp.setResponseName( SyncInfoValue.OID );

                SyncInfoValue syncInfo = new SyncInfoValueDecorator( ldapServer.getDirectoryService()
                    .getLdapCodecService(),
                    SynchronizationInfoEnum.NEW_COOKIE );
                syncInfo.setCookie( cookie );
                intermResp.setResponseValue( ( ( SyncInfoValueDecorator ) syncInfo ).getValue() );

                PROVIDER_LOG.debug( "Sent the intermediate response to the {} consumer, {}", replicaLog.getId(),
                    intermResp );
                session.getIoSession().write( intermResp );
View Full Code Here

                byte[] cookie = LdapProtocolUtils.createCookie( replicaLog.getId(), replicaLog.getLastSentCsn() );

                IntermediateResponse intermResp = new IntermediateResponseImpl( request.getMessageId() );
                intermResp.setResponseName( SyncInfoValue.OID );

                SyncInfoValue syncInfo = new SyncInfoValueDecorator(
                    ldapServer.getDirectoryService().getLdapCodecService(), SynchronizationInfoEnum.NEW_COOKIE );
                syncInfo.setCookie( cookie );
                intermResp.setResponseValue( ( ( SyncInfoValueDecorator ) syncInfo ).getValue() );

                PROVIDER_LOG.info( "Sending the intermediate response to consumer {}, {}", replicaLog, syncInfo );

                session.getIoSession().write( intermResp );
View Full Code Here

            {
                return;
            }

            SyncInfoValueDecorator decorator = new SyncInfoValueDecorator( ldapCodecService );
            SyncInfoValue syncInfoValue = ( SyncInfoValue ) decorator.decode( syncInfoBytes );

            byte[] cookie = syncInfoValue.getCookie();

            int replicaId = -1;

            if ( cookie != null )
            {
                LOG.debug( "setting the cookie from the sync info: " + Strings.utf8ToString( cookie ) );
                syncCookie = cookie;

                String cookieString = Strings.utf8ToString( syncCookie );
                replicaId = LdapProtocolUtils.getReplicaId( cookieString );
            }

            LOG.info( "refreshDeletes: " + syncInfoValue.isRefreshDeletes() );

            List<byte[]> uuidList = syncInfoValue.getSyncUUIDs();

            // if refreshDeletes set to true then delete all the entries with entryUUID
            // present in the syncIdSet
            if ( syncInfoValue.isRefreshDeletes() )
            {
                deleteEntries( uuidList, false );
            }
            else
            {
                deleteEntries( uuidList, true );
            }

            LOG.info( "refreshDone: " + syncInfoValue.isRefreshDone() );

            storeCookie();
        }
        catch ( Exception de )
        {
View Full Code Here

                'b',
                'c' //     newCookie [0] syncCookie
        } );
        bb.flip();

        SyncInfoValue decorator = new SyncInfoValueDecorator( codec );
        decorator.setType( SynchronizationInfoEnum.NEW_COOKIE );

        SyncInfoValue syncInfoValue = ( SyncInfoValue ) ( ( SyncInfoValueDecorator ) decorator ).decode( bb.array() );

        assertEquals( SynchronizationInfoEnum.NEW_COOKIE, syncInfoValue.getType() );
        assertEquals( "abc", Strings.utf8ToString( syncInfoValue.getCookie() ) );

        // Check the encoding
        try
        {
            ByteBuffer encoded = ( ( SyncInfoValueDecorator ) syncInfoValue ).encode( ByteBuffer
View Full Code Here

                ( byte ) 0x80, 0x00, // syncInfoValue ::= CHOICE {
                                     //     newCookie [0] syncCookie
            } );
        bb.flip();

        SyncInfoValue decorator = new SyncInfoValueDecorator( codec );
        decorator.setType( SynchronizationInfoEnum.NEW_COOKIE );

        SyncInfoValue syncInfoValue = ( SyncInfoValue ) ( ( SyncInfoValueDecorator ) decorator ).decode( bb.array() );

        assertEquals( SynchronizationInfoEnum.NEW_COOKIE, syncInfoValue.getType() );
        assertEquals( "", Strings.utf8ToString( syncInfoValue.getCookie() ) );

        // Check the encoding
        try
        {
            ByteBuffer encoded = ( ( SyncInfoValueDecorator ) syncInfoValue ).encode( ByteBuffer
View Full Code Here

                0x01,
                ( byte ) 0xFF //         refreshDone  BOOLEAN DEFAULT TRUE
        } );
        bb.flip();

        SyncInfoValue decorator = new SyncInfoValueDecorator( codec );

        decorator.setType( SynchronizationInfoEnum.REFRESH_DELETE );

        SyncInfoValue syncInfoValue = ( SyncInfoValue ) ( ( SyncInfoValueDecorator ) decorator ).decode( bb.array() );

        assertEquals( SynchronizationInfoEnum.REFRESH_DELETE, syncInfoValue.getType() );
        assertEquals( "abc", Strings.utf8ToString( syncInfoValue.getCookie() ) );
        assertTrue( syncInfoValue.isRefreshDone() );

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

                0x01,
                ( byte ) 0x00 //         refreshDone  BOOLEAN DEFAULT TRUE
        } );
        bb.flip();

        SyncInfoValue decorator = new SyncInfoValueDecorator( codec );

        decorator.setType( SynchronizationInfoEnum.REFRESH_DELETE );

        SyncInfoValue syncInfoValue = ( SyncInfoValue ) ( ( SyncInfoValueDecorator ) decorator ).decode( bb.array() );

        assertEquals( SynchronizationInfoEnum.REFRESH_DELETE, syncInfoValue.getType() );
        assertEquals( "abc", Strings.utf8ToString( syncInfoValue.getCookie() ) );
        assertFalse( syncInfoValue.isRefreshDone() );

        // Check the encoding
        try
        {
            ByteBuffer encoded = ( ( SyncInfoValueDecorator ) syncInfoValue ).encode( ByteBuffer
View Full Code Here

                'b',
                'c' //         cookie       syncCookie OPTIONAL,
        } );
        bb.flip();

        SyncInfoValue decorator = new SyncInfoValueDecorator( codec );

        decorator.setType( SynchronizationInfoEnum.REFRESH_DELETE );

        SyncInfoValue syncInfoValue = ( SyncInfoValue ) ( ( SyncInfoValueDecorator ) decorator ).decode( bb.array() );

        assertEquals( SynchronizationInfoEnum.REFRESH_DELETE, syncInfoValue.getType() );
        assertEquals( "abc", Strings.utf8ToString( syncInfoValue.getCookie() ) );
        assertTrue( syncInfoValue.isRefreshDone() );

        // Check the encoding
        try
        {
            ByteBuffer encoded = ( ( SyncInfoValueDecorator ) syncInfoValue ).encode( ByteBuffer
View Full Code Here

                0x01,
                0x00 //        refreshDone  BOOLEAN DEFAULT TRUE
        } );
        bb.flip();

        SyncInfoValue decorator = new SyncInfoValueDecorator( codec );

        decorator.setType( SynchronizationInfoEnum.REFRESH_DELETE );

        SyncInfoValue syncInfoValue = ( SyncInfoValue ) ( ( SyncInfoValueDecorator ) decorator ).decode( bb.array() );

        assertEquals( SynchronizationInfoEnum.REFRESH_DELETE, syncInfoValue.getType() );
        assertEquals( "", Strings.utf8ToString( syncInfoValue.getCookie() ) );
        assertFalse( syncInfoValue.isRefreshDone() );

        // Check the encoding
        try
        {
            ByteBuffer encoded = ( ( SyncInfoValueDecorator ) syncInfoValue ).encode( ByteBuffer
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.extras.controls.syncrepl.syncInfoValue.SyncInfoValue

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.