SyncModifyDnStatesEnum.ENTRY_DN_STATE, UniversalTag.OCTET_STRING.getValue(),
new GrammarAction<SyncModifyDnContainer>( "Set SyncModifyDnControl entryDn value" )
{
public void action( SyncModifyDnContainer container ) throws DecoderException
{
Value value = container.getCurrentTLV().getValue();
// Check that the value is into the allowed interval
String entryDn = Strings.utf8ToString(value.getData());
if ( IS_DEBUG )
{
LOG.debug( "ModDN entryDn = {}", entryDn );
}
container.getSyncModifyDnControl().setEntryDn( entryDn );
// move on to the next transition
container.setGrammarEndAllowed( false );
}
} );
/**
* Transition to move choice
* Operation ::= CHOICE {
* move-name [0] LDAPDN
* }
*
* Stores the newSuperiorDn value
*/
super.transitions[SyncModifyDnStatesEnum.ENTRY_DN_STATE.ordinal()][SyncModifyDnTags.MOVE_TAG.getValue()] = new GrammarTransition(
SyncModifyDnStatesEnum.ENTRY_DN_STATE, SyncModifyDnStatesEnum.MOVE_STATE,
SyncModifyDnTags.MOVE_TAG.getValue(),
new GrammarAction<SyncModifyDnContainer>( "Set SyncModifyDnControl newSuperiorDn" )
{
public void action( SyncModifyDnContainer container ) throws DecoderException
{
container.getSyncModifyDnControl().setModDnType( SyncModifyDnType.MOVE );
// We need to read the move operation's superiorDN
Value value = container.getCurrentTLV().getValue();
// Check that the value is into the allowed interval
String newSuperiorDn = Strings.utf8ToString(value.getData());
if ( IS_DEBUG )
{
LOG.debug( "ModDN newSuperiorDn = {}", newSuperiorDn );
}
container.getSyncModifyDnControl().setNewSuperiorDn( newSuperiorDn );
// move on to the next transition
container.setGrammarEndAllowed( true );
}
} );
/**
* read the newSuperiorDn
* move-name [0] LDAPDN
*/
super.transitions[SyncModifyDnStatesEnum.ENTRY_DN_STATE.ordinal()][SyncModifyDnTags.RENAME_TAG.getValue()] = new GrammarTransition(
SyncModifyDnStatesEnum.ENTRY_DN_STATE, SyncModifyDnStatesEnum.RENAME_STATE,
SyncModifyDnTags.RENAME_TAG.getValue(),
new GrammarAction<SyncModifyDnContainer>( "enter SyncModifyDnControl rename choice" )
{
public void action( SyncModifyDnContainer container ) throws DecoderException
{
container.getSyncModifyDnControl().setModDnType( SyncModifyDnType.RENAME );
container.setGrammarEndAllowed( false );
}
} );
/**
* Transition from rename's RENAME state to newRdn
*
* Rename SEQUENCE {
* new-rdn Rdn,
* }
*
* Stores the newRdn value
*/
super.transitions[SyncModifyDnStatesEnum.RENAME_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
SyncModifyDnStatesEnum.RENAME_STATE, SyncModifyDnStatesEnum.RENAME_NEW_RDN_STATE,
UniversalTag.OCTET_STRING.getValue(),
new GrammarAction<SyncModifyDnContainer>( "Set SyncModifyDnControl newRdn value" )
{
public void action( SyncModifyDnContainer container ) throws DecoderException
{
Value value = container.getCurrentTLV().getValue();
String newRdn = Strings.utf8ToString(value.getData());
if ( IS_DEBUG )
{
LOG.debug( "newRdn = {}", newRdn );
}
container.getSyncModifyDnControl().setNewRdn( newRdn );
// terminal state
container.setGrammarEndAllowed( false );
}
} );
/**
* Transition from rename's RENAME newRdn to deleteOldRdn
*
* Rename SEQUENCE {
* ....
* deleteOldRdn
* }
*
* Stores the deleteOldRdn value
*/
super.transitions[SyncModifyDnStatesEnum.RENAME_NEW_RDN_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = new GrammarTransition(
SyncModifyDnStatesEnum.RENAME_NEW_RDN_STATE, SyncModifyDnStatesEnum.RENAME_DEL_OLD_RDN_STATE,
UniversalTag.BOOLEAN.getValue(),
new GrammarAction<SyncModifyDnContainer>( "Set SyncModifyDnControl deleteOldRdn value" )
{
public void action( SyncModifyDnContainer container ) throws DecoderException
{
Value value = container.getCurrentTLV().getValue();
byte deleteOldRdn = value.getData()[0];
if ( IS_DEBUG )
{
LOG.debug( "deleteOldRdn = {}", deleteOldRdn );
}
if( deleteOldRdn != 0 )
{
container.getSyncModifyDnControl().setDeleteOldRdn( true );
}
// terminal state
container.setGrammarEndAllowed( true );
}
} );
/**
* Transition from entryDN to moveAndRename SEQUENCE
* MoveAndRename SEQUENCE {
*
* Stores the deleteOldRdn flag
*/
super.transitions[SyncModifyDnStatesEnum.ENTRY_DN_STATE.ordinal()][SyncModifyDnTags.MOVEANDRENAME_TAG.getValue()] = new GrammarTransition(
SyncModifyDnStatesEnum.ENTRY_DN_STATE, SyncModifyDnStatesEnum.MOVE_AND_RENAME_STATE,
SyncModifyDnTags.MOVEANDRENAME_TAG.getValue(),
new GrammarAction<SyncModifyDnContainer>( "enter SyncModifyDnControl moveAndRename choice" )
{
public void action( SyncModifyDnContainer container ) throws DecoderException
{
container.getSyncModifyDnControl().setModDnType( SyncModifyDnType.MOVEANDRENAME );
container.setGrammarEndAllowed( false );
}
} );
/**
* Transition from MOVE_AND_RENAME_STATE to newSuperiorDn
*
* MoveAndRename SEQUENCE {
* superior-name LDAPDN
* ....
*
* Stores the newRdn value
*/
super.transitions[SyncModifyDnStatesEnum.MOVE_AND_RENAME_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
SyncModifyDnStatesEnum.MOVE_AND_RENAME_STATE, SyncModifyDnStatesEnum.MOVE_AND_RENAME_NEW_SUPERIOR_DN_STATE,
UniversalTag.OCTET_STRING.getValue(),
new GrammarAction<SyncModifyDnContainer>( "Set SyncModifyDnControl moveAndRename state's newSuperirorDN value" )
{
public void action( SyncModifyDnContainer container ) throws DecoderException
{
Value value = container.getCurrentTLV().getValue();
String newSuperirorDn = Strings.utf8ToString(value.getData());
if ( IS_DEBUG )
{
LOG.debug( "newSuperirorDn = {}", newSuperirorDn );
}
container.getSyncModifyDnControl().setNewSuperiorDn( newSuperirorDn );
// terminal state
container.setGrammarEndAllowed( false );
}
} );
/**
* Transition from moveAndRename's newSuperiorDn to newRdn
*
* MoveAndRename SEQUENCE {
* superior-name LDAPDN
* ....
*
* Stores the newRdn value
*/
super.transitions[SyncModifyDnStatesEnum.MOVE_AND_RENAME_NEW_SUPERIOR_DN_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
SyncModifyDnStatesEnum.MOVE_AND_RENAME_NEW_SUPERIOR_DN_STATE, SyncModifyDnStatesEnum.MOVE_AND_RENAME_NEW_RDN_STATE,
UniversalTag.OCTET_STRING.getValue(),
new GrammarAction<SyncModifyDnContainer>( "Set SyncModifyDnControl moveAndRename state's newRdn value" )
{
public void action( SyncModifyDnContainer container ) throws DecoderException
{
Value value = container.getCurrentTLV().getValue();
String newRdn = Strings.utf8ToString(value.getData());
if ( IS_DEBUG )
{
LOG.debug( "newRdn = {}", newRdn );
}
container.getSyncModifyDnControl().setNewRdn( newRdn );
// terminal state
container.setGrammarEndAllowed( false );
}
} );
/**
* Transition from moveAndRename's newRdn to deleteOldRdn
* MoveAndRename SEQUENCE {
* ....
* delete-old-rdn BOOLEAN
*
* Stores the deleteOldRdn flag
*/
super.transitions[SyncModifyDnStatesEnum.MOVE_AND_RENAME_NEW_RDN_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = new GrammarTransition(
SyncModifyDnStatesEnum.MOVE_AND_RENAME_NEW_RDN_STATE, SyncModifyDnStatesEnum.MOVE_AND_RENAME_DEL_OLD_RDN_STATE,
UniversalTag.BOOLEAN.getValue(),
new GrammarAction<SyncModifyDnContainer>( "Set SyncModifyDnControl deleteOldRdn value" )
{
public void action( SyncModifyDnContainer container ) throws DecoderException
{
Value value = container.getCurrentTLV().getValue();
byte deleteOldRdn = value.getData()[0];
if ( IS_DEBUG )
{
LOG.debug( "deleteOldRdn = {}", deleteOldRdn );
}