Examples of SyncStateValue


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

     * Create the SyncStateValue control
     */
    private SyncStateValue createControl( DirectoryService directoryService, SyncStateTypeEnum operation, Entry entry )
        throws LdapInvalidAttributeValueException
    {
        SyncStateValue syncStateValue = new SyncStateValueDecorator( directoryService.getLdapCodecService() );

        syncStateValue.setSyncStateType( operation );
        syncStateValue.setEntryUUID(
            Strings.uuidToBytes( entry.get( SchemaConstants.ENTRY_UUID_AT ).getString() ) );
        syncStateValue.setCookie( getCookie( entry ) );
       
        return syncStateValue;
    }
View Full Code Here

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

                SearchResultEntry resultEntry = new SearchResultEntryImpl( searchRequest.getMessageId() );
                resultEntry.setObjectName( entry.getDn() );
                resultEntry.setEntry( entry );

                // Create the control which will be added to the response.
                SyncStateValue syncAdd = createControl( directoryService, SyncStateTypeEnum.ADD, entry );
               
                sendResult( resultEntry, entry, EventType.ADD, syncAdd, null );
            }
           
        }
View Full Code Here

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

            {
                SearchResultEntry resultEntry = new SearchResultEntryImpl( searchRequest.getMessageId() );
                resultEntry.setObjectName( entry.getDn() );
                resultEntry.setEntry( entry );

                SyncStateValue syncDelete = createControl( directoryService, SyncStateTypeEnum.DELETE, entry );

                sendResult( resultEntry, entry, EventType.DELETE, syncDelete, null );
            }
        }
        catch ( LdapInvalidAttributeValueException e )
View Full Code Here

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

                SearchResultEntry resultEntry = new SearchResultEntryImpl( searchRequest.getMessageId() );
                resultEntry.setObjectName( modifyContext.getDn() );
                resultEntry.setEntry( alteredEntry );

                SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODIFY, alteredEntry );

                sendResult( resultEntry, alteredEntry, EventType.MODIFY, syncModify, null );
            }
        }
        catch ( Exception e )
View Full Code Here

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

                SearchResultEntry resultEntry = new SearchResultEntryImpl( searchRequest.getMessageId() );
                resultEntry.setObjectName( moveContext.getDn() );
                resultEntry.setEntry( entry );
                resultEntry.addControl( modDnControl );

                SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODDN, entry );

                sendResult( resultEntry, entry, null, syncModify, modDnControl );
            }
        }
        catch ( Exception e )
View Full Code Here

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

                SearchResultEntry resultEntry = new SearchResultEntryImpl( searchRequest.getMessageId() );
                resultEntry.setObjectName( entry.getDn() );
                resultEntry.setEntry( entry );
                resultEntry.addControl( modDnControl );

                SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODDN, entry );

                sendResult( resultEntry, entry, null, syncModify, modDnControl );
            }
        }
        catch ( Exception e )
View Full Code Here

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

                SearchResultEntry resultEntry = new SearchResultEntryImpl( searchRequest.getMessageId() );
                resultEntry.setObjectName( entry.getDn() );
                resultEntry.setEntry( entry );
                resultEntry.addControl( modDnControl );

                SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODDN, entry );
               
                // In this case, the cookie is different
                syncModify.setCookie( getCookie( entry ) );

                sendResult( resultEntry, entry, null, syncModify, modDnControl );
            }
        }
        catch ( Exception e )
View Full Code Here

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

        SyncStateTypeEnum syncStateType ) throws Exception
    {
        Attribute uuid = entry.get( SchemaConstants.ENTRY_UUID_AT );

        // Create the SyncState control
        SyncStateValue syncStateControl = new SyncStateValueDecorator(
            ldapServer.getDirectoryService().getLdapCodecService() );
        syncStateControl.setSyncStateType( syncStateType );
        syncStateControl.setEntryUUID( Strings.uuidToBytes( uuid.getString() ) );

        if ( syncStateType == SyncStateTypeEnum.DELETE )
        {
            // clear the entry's all attributes except the Dn and entryUUID
            entry.clear();
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() );

                    if ( !session.exists( remoteDn ) )
                    {
                        LOG.debug( "adding entry with dn {}", remoteDn );
                        LOG.debug( remoteEntry.toString() );
                        session.add( new DefaultEntry( schemaManager, remoteEntry ) );
                    }
                    else
                    {
                        LOG.debug( "updating entry in refreshOnly mode {}", remoteDn );
                        modify( remoteEntry );
                    }

                    break;

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

                    break;

                case MODDN:
                    String entryUuid = Strings.uuidToString( syncStateCtrl.getEntryUUID() ).toString();
                    applyModDnOperation( remoteEntry, entryUuid );

                    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

     * Create the SyncStateValue control
     */
    private SyncStateValue createControl( DirectoryService directoryService, SyncStateTypeEnum operation, Entry entry )
        throws LdapInvalidAttributeValueException
    {
        SyncStateValue syncStateValue = new SyncStateValueDecorator( directoryService.getLdapCodecService() );

        syncStateValue.setSyncStateType( operation );
        String uuidStr = entry.get( SchemaConstants.ENTRY_UUID_AT ).getString();
        syncStateValue.setEntryUUID( Strings.uuidToBytes( uuidStr ) );
        syncStateValue.setCookie( getCookie( entry ) );

        return syncStateValue;
    }
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.