SyncStateValueStatesEnum.SYNC_TYPE_STATE, UniversalTag.ENUMERATED.getValue(),
new GrammarAction<SyncStateValueContainer>( "Set SyncStateValueControl state type" )
{
public void action( SyncStateValueContainer container ) throws DecoderException
{
BerValue value = container.getCurrentTLV().getValue();
try
{
// Check that the value is into the allowed interval
int syncStateType = IntegerDecoder.parse( value, SyncStateTypeEnum.PRESENT.getValue(),
SyncStateTypeEnum.MODDN.getValue() );
SyncStateTypeEnum syncStateTypeEnum = SyncStateTypeEnum.getSyncStateType( syncStateType );
if ( IS_DEBUG )
{
LOG.debug( "SyncStateType = {}", syncStateTypeEnum );
}
container.getSyncStateValueControl().setSyncStateType( syncStateTypeEnum );
// move on to the entryUUID transition
container.setGrammarEndAllowed( false );
}
catch ( IntegerDecoderException e )
{
String msg = I18n.err( I18n.ERR_04030 );
LOG.error( msg, e );
throw new DecoderException( msg );
}
}
} );
/**
* Transition from sync state tpe to entryUUID
* SyncStateValue ::= SEQUENCE OF {
* ...
* entryUUID syncUUID
* ...
*
* Stores the entryUUID
*/
super.transitions[SyncStateValueStatesEnum.SYNC_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition<SyncStateValueContainer>(
SyncStateValueStatesEnum.SYNC_TYPE_STATE, SyncStateValueStatesEnum.SYNC_UUID_STATE,
UniversalTag.OCTET_STRING.getValue(),
new GrammarAction<SyncStateValueContainer>( "Set SyncStateValueControl entryUUID" )
{
public void action( SyncStateValueContainer container ) throws DecoderException
{
BerValue value = container.getCurrentTLV().getValue();
byte[] entryUUID = value.getData();
if ( IS_DEBUG )
{
LOG.debug( "entryUUID = {}", Strings.dumpBytes( entryUUID ) );
}
container.getSyncStateValueControl().setEntryUUID( entryUUID );
// We can have an END transition
container.setGrammarEndAllowed( true );
}
} );
/**
* Transition from entryUUID to cookie
* SyncRequestValue ::= SEQUENCE OF {
* ...
* cookie syncCookie OPTIONAL
* }
*
* Stores the reloadHint flag
*/
super.transitions[SyncStateValueStatesEnum.SYNC_UUID_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition<SyncStateValueContainer>(
SyncStateValueStatesEnum.SYNC_UUID_STATE, SyncStateValueStatesEnum.COOKIE_STATE,
UniversalTag.OCTET_STRING.getValue(),
new GrammarAction<SyncStateValueContainer>( "Set SyncStateValueControl cookie value" )
{
public void action( SyncStateValueContainer container ) throws DecoderException
{
BerValue value = container.getCurrentTLV().getValue();
byte[] cookie = value.getData();
if ( IS_DEBUG )
{
LOG.debug( "cookie = {}", cookie );
}