{
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();
out.writeByte( modDnType.getValue() );
switch ( modDnType )
{
case MOVE:
out.writeUTF( modDnControl.getNewSuperiorDn() );
break;
case MOVE_AND_RENAME:
out.writeUTF( modDnControl.getNewSuperiorDn() );
// Fall through
case RENAME:
out.writeUTF( modDnControl.getNewRdn() );
out.writeBoolean( modDnControl.isDeleteOldRdn() );
break;
}
}
out.flush();