SearchRequestDecorator searchRequest = container.getMessage();
TLV tlv = container.getCurrentTLV();
// Store the value.
ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter )
searchRequest.getTerminalFilter();
if ( tlv.getLength() == 0 )
{
String msg = I18n.err( I18n.ERR_04109 );
LOG.error( msg );
// It will generate a PROTOCOL_ERROR
throw new DecoderException( I18n.err( I18n.ERR_04109 ) );
}
else
{
extensibleMatchFilter.setMatchingRule( Strings.utf8ToString(tlv.getValue().getData()) );
}
}
} );
// --------------------------------------------------------------------------------------------
// Transition from Extensible Match to type matching rule
// --------------------------------------------------------------------------------------------
// Filter ::= CHOICE {
// ...
// extensibleMatch [9] MatchingRuleAssertion }
//
// MatchingRuleAssertion ::= SEQUENCE {
// ...
// type [2] AttributeDescription OPTIONAL,
// ...
//
// Store the matching rule ID
super.transitions[LdapStatesEnum.EXTENSIBLE_MATCH_STATE.ordinal()][LdapConstants.MATCHING_RULE_TYPE_TAG] = new GrammarTransition(
LdapStatesEnum.EXTENSIBLE_MATCH_STATE, LdapStatesEnum.TYPE_MATCHING_RULE_STATE,
LdapConstants.MATCHING_RULE_TYPE_TAG, new StoreTypeMatchingRuleAction() );
// --------------------------------------------------------------------------------------------
// Transition from Extensible Match to match value
// --------------------------------------------------------------------------------------------
// Filter ::= CHOICE {
// ...
// extensibleMatch [9] MatchingRuleAssertion }
//
// MatchingRuleAssertion ::= SEQUENCE {
// ...
// matchValue [3] AssertionValue,
// ...
//
// Store the matching rule ID
super.transitions[LdapStatesEnum.EXTENSIBLE_MATCH_STATE.ordinal()][LdapConstants.MATCH_VALUE_TAG] = new GrammarTransition(
LdapStatesEnum.EXTENSIBLE_MATCH_STATE, LdapStatesEnum.MATCH_VALUE_STATE, LdapConstants.MATCH_VALUE_TAG,
new StoreMatchValueAction() );
// --------------------------------------------------------------------------------------------
// Transition from matching rule to type matching rule
// --------------------------------------------------------------------------------------------
// Filter ::= CHOICE {
// ...
// extensibleMatch [9] MatchingRuleAssertion }
//
// MatchingRuleAssertion ::= SEQUENCE {
// ...
// type [2] AttributeDescription OPTIONAL,
// ...
//
// Store the matching rule ID
super.transitions[LdapStatesEnum.MATCHING_RULE_STATE.ordinal()][LdapConstants.MATCHING_RULE_TYPE_TAG] = new GrammarTransition(
LdapStatesEnum.MATCHING_RULE_STATE, LdapStatesEnum.TYPE_MATCHING_RULE_STATE,
LdapConstants.MATCHING_RULE_TYPE_TAG, new StoreTypeMatchingRuleAction() );
// --------------------------------------------------------------------------------------------
// Transition from matching rule to match value
// --------------------------------------------------------------------------------------------
// Filter ::= CHOICE {
// ...
// extensibleMatch [9] MatchingRuleAssertion }
//
// MatchingRuleAssertion ::= SEQUENCE {
// ...
// matchValue [3] AssertionValue,
// ...
//
// Store the matching rule ID
super.transitions[LdapStatesEnum.MATCHING_RULE_STATE.ordinal()][LdapConstants.MATCH_VALUE_TAG] = new GrammarTransition(
LdapStatesEnum.MATCHING_RULE_STATE, LdapStatesEnum.MATCH_VALUE_STATE, LdapConstants.MATCH_VALUE_TAG,
new StoreMatchValueAction() );
// --------------------------------------------------------------------------------------------
// Transition from matching type to match value
// --------------------------------------------------------------------------------------------
// Filter ::= CHOICE {
// ...
// extensibleMatch [9] MatchingRuleAssertion }
//
// MatchingRuleAssertion ::= SEQUENCE {
// ...
// matchValue [3] AssertionValue,
// ...
//
// Store the matching rule ID
super.transitions[LdapStatesEnum.TYPE_MATCHING_RULE_STATE.ordinal()][LdapConstants.MATCH_VALUE_TAG] = new GrammarTransition(
LdapStatesEnum.TYPE_MATCHING_RULE_STATE, LdapStatesEnum.MATCH_VALUE_STATE, LdapConstants.MATCH_VALUE_TAG,
new StoreMatchValueAction() );
// --------------------------------------------------------------------------------------------
// Transition from match value to dnAttributes
// --------------------------------------------------------------------------------------------
// Filter ::= CHOICE {
// ...
// extensibleMatch [9] MatchingRuleAssertion }
//
// MatchingRuleAssertion ::= SEQUENCE {
// ...
// dnAttributes [4] BOOLEAN DEFAULT FALSE }
//
// Store the dnAttributes flag
super.transitions[LdapStatesEnum.MATCH_VALUE_STATE.ordinal()][LdapConstants.DN_ATTRIBUTES_FILTER_TAG] = new GrammarTransition(
LdapStatesEnum.MATCH_VALUE_STATE, LdapStatesEnum.DN_ATTRIBUTES_STATE,
LdapConstants.DN_ATTRIBUTES_FILTER_TAG,
new GrammarAction<LdapMessageContainer<SearchRequestDecorator>>( "Store matching dnAttributes Value" )
{
public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException
{
SearchRequestDecorator searchRequest = container.getMessage();
TLV tlv = container.getCurrentTLV();
// Store the value.
ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) searchRequest.getTerminalFilter();
// We get the value. If it's a 0, it's a FALSE. If it's
// a FF, it's a TRUE. Any other value should be an error,
// but we could relax this constraint. So if we have
// something
// which is not 0, it will be interpreted as TRUE, but we
// will generate a warning.
Value value = tlv.getValue();
try
{
extensibleMatchFilter.setDnAttributes( BooleanDecoder.parse( value ) );
}
catch ( BooleanDecoderException bde )
{
LOG.error( I18n
.err( I18n.ERR_04110, Strings.dumpBytes(value.getData()), bde.getMessage() ) );
throw new DecoderException( bde.getMessage() );
}
if ( IS_DEBUG )
{
LOG.debug( "Dn Attributes : {}", Boolean.valueOf( extensibleMatchFilter.isDnAttributes() ) );
}
// unstack the filters if needed
searchRequest.unstackFilters( container );
}