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

Examples of org.apache.directory.shared.ldap.model.message.controls.ChangeType


                            {
                                case ADD:
                                case DELETE:
                                case MODDN:
                                case MODIFY:
                                    ChangeType changeType = ChangeType.getChangeType( change );

                                    if ( IS_DEBUG )
                                    {
                                        LOG.debug( "changeType = " + changeType );
                                    }

                                    container.getEntryChangeDecorator().setChangeType( changeType );
                                    break;

                                default:
                                    String msg = I18n.err( I18n.ERR_04044 );
                                    LOG.error( msg );
                                    throw new DecoderException( msg );
                            }

                            // We can have an END transition
                            container.setGrammarEndAllowed( true );
                        }
                        catch ( IntegerDecoderException e )
                        {
                            String msg = I18n.err( I18n.ERR_04044 );
                            LOG.error( msg, e );
                            throw new DecoderException( msg );
                        }
                        catch ( IllegalArgumentException e )
                        {
                            throw new DecoderException( e.getLocalizedMessage() );
                        }
                    }
                } );

        // ============================================================================================
        // Transition from Change Type to Previous Dn
        // ============================================================================================
        // EntryChangeNotification ::= SEQUENCE {
        //     ...
        //     previousDN LDAPDN OPTIONAL,
        //     ...
        //
        // Set the previousDN into the structure. We first check that it's a
        // valid Dn
        super.transitions[EntryChangeStates.CHANGE_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
            new GrammarTransition<EntryChangeContainer>( EntryChangeStates.CHANGE_TYPE_STATE,
                EntryChangeStates.PREVIOUS_DN_STATE,
                UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<EntryChangeContainer>( "Set EntryChangeControl previousDN" )
                {
                    public void action( EntryChangeContainer container ) throws DecoderException
                    {
                        ChangeType changeType = container.getEntryChangeDecorator().getChangeType();

                        if ( changeType != ChangeType.MODDN )
                        {
                            LOG.error( I18n.err( I18n.ERR_04045 ) );
                            throw new DecoderException( I18n.err( I18n.ERR_04046 ) );
View Full Code Here


                    {
                        case ADD:
                        case DELETE:
                        case MODDN:
                        case MODIFY:
                            ChangeType changeType = ChangeType.getChangeType( change );

                            if ( IS_DEBUG )
                            {
                                LOG.debug( "changeType = " + changeType );
                            }

                            container.getEntryChangeDecorator().setChangeType( changeType );
                            break;

                        default:
                            String msg = I18n.err( I18n.ERR_04044 );
                            LOG.error( msg );
                            throw new DecoderException( msg );
                    }

                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
                catch ( IntegerDecoderException e )
                {
                    String msg = I18n.err( I18n.ERR_04044 );
                    LOG.error( msg, e );
                    throw new DecoderException( msg );
                }
                catch ( IllegalArgumentException e )
                {
                    throw new DecoderException( e.getLocalizedMessage() );
                }
            }
        } );

        // ============================================================================================
        // Transition from Change Type to Previous Dn
        // ============================================================================================
        // EntryChangeNotification ::= SEQUENCE {
        //     ...
        //     previousDN LDAPDN OPTIONAL,
        //     ...
        //
        // Set the previousDN into the structure. We first check that it's a
        // valid Dn
        super.transitions[ EntryChangeStates.CHANGE_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
            new GrammarTransition( EntryChangeStates.CHANGE_TYPE_STATE,
                                    EntryChangeStates.PREVIOUS_DN_STATE,
                                    UniversalTag.OCTET_STRING.getValue(),
            new GrammarAction<EntryChangeContainer>( "Set EntryChangeControl previousDN" )
        {
            public void action( EntryChangeContainer container ) throws DecoderException
            {
                ChangeType changeType = container.getEntryChangeDecorator().getChangeType();


                if ( changeType != ChangeType.MODDN )
                {
                    LOG.error( I18n.err( I18n.ERR_04045 ) );
View Full Code Here

    public byte[] serialize( Object object ) throws IOException
    {
        ReplicaEventMessage replicaEventMessage = (ReplicaEventMessage)object;
   
        Entry entry = replicaEventMessage.getEntry();
        ChangeType changeType = replicaEventMessage.getChangeType();
        SyncModifyDn modDnControl = replicaEventMessage.getModDnControl();
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        // The entry DN
        entry.getDn().writeExternal( out );
       
        // The entry
        byte[] data = entrySerializer.serialize( entry );

        // Entry's length
        out.writeInt( data.length );
       
        // Entry's data
        out.write( data );

        // The change type
        out.writeByte( changeType.getValue() );
       
        // The moddn control if any (only if it's a MODDN operation)
        if ( changeType == ChangeType.MODDN )
        {
            SyncModifyDnType modDnType = modDnControl.getModDnType();
View Full Code Here

            Entry entry = ( Entry ) entrySerializer.deserialize( data );
            entry.setDn( entryDn );

            // Read the changeType
            byte type = in.readByte();
            ChangeType changeType = ChangeType.getChangeType( type );

            if ( changeType == ChangeType.MODDN )
            {
                type = in.readByte();
                SyncModifyDnType modDnType = SyncModifyDnType.getModifyDnType( type );
View Full Code Here

           
            //System.out.println( "/////////////-> Message(" + i + ") read from queue : " + message.getEventType() + "/" + entry.getDn() );

            lastSentCsn = entry.get( SchemaConstants.ENTRY_CSN_AT ).getString();

            ChangeType event = replicaEventMessage.getChangeType();

            // if event type is null, then it is a MODDN operation
            if ( event == ChangeType.MODDN )
            {
                sendSearchResultEntry( session, req, entry, replicaEventMessage.getModDnControl() );
View Full Code Here

        {
            if( LOG.isDebugEnabled() )
            {
                String evt = "MODDN"; // take this as default cause the event type for MODDN is null
               
                ChangeType changeType = qualifiedEvtMsg.getChangeType();
               
                if ( changeType != null )
                {
                    evt = changeType.name();
                }
               
                LOG.debug( "event {} for dn {} is not qualified for sending", evt, qualifiedEvtMsg.getEntry().getDn() );
            }
           
View Full Code Here

            LOG.debug( "Read message from the queue {}", entry );
            PROVIDER_LOG.debug( "Read message from the queue {}", entry );

            lastSentCsn = entry.get( SchemaConstants.ENTRY_CSN_AT ).getString();

            ChangeType event = replicaEventMessage.getChangeType();

            // if event type is null, then it is a MODDN operation
            if ( event == ChangeType.MODDN )
            {
                sendSearchResultEntry( session, req, entry, SyncStateTypeEnum.MODIFY );
View Full Code Here

        {
            if ( LOG.isDebugEnabled() )
            {
                String evt = "MODDN"; // take this as default cause the event type for MODDN is null

                ChangeType changeType = qualifiedEvtMsg.getChangeType();

                if ( changeType != null )
                {
                    evt = changeType.name();
                }

                LOG.debug( "event {} for dn {} is not qualified for sending", evt, qualifiedEvtMsg.getEntry().getDn() );
            }
View Full Code Here

    public byte[] serialize( Object object ) throws IOException
    {
        ReplicaEventMessage replicaEventMessage = ( ReplicaEventMessage ) object;

        Entry entry = replicaEventMessage.getEntry();
        ChangeType changeType = replicaEventMessage.getChangeType();

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream( baos );

        // The entry DN
        entry.getDn().writeExternal( out );

        // The entry
        byte[] data = entrySerializer.serialize( entry );

        // Entry's length
        out.writeInt( data.length );

        // Entry's data
        out.write( data );

        // The change type
        out.writeByte( changeType.getValue() );

        out.flush();

        return baos.toByteArray();
    }
View Full Code Here

            Entry entry = ( Entry ) entrySerializer.deserialize( data );
            entry.setDn( entryDn );

            // Read the changeType
            byte type = in.readByte();
            ChangeType changeType = ChangeType.getChangeType( type );

            // And create a ReplicaEventMessage
            replicaEventMessage = new ReplicaEventMessage( changeType, entry );
        }
        catch ( ClassNotFoundException cnfe )
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.message.controls.ChangeType

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.