View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  
21  package org.apache.directory.api.dsmlv2.request;
22  
23  
24  import java.io.IOException;
25  import java.lang.reflect.Array;
26  import java.util.HashMap;
27  
28  import org.apache.directory.api.asn1.DecoderException;
29  import org.apache.directory.api.asn1.util.Oid;
30  import org.apache.directory.api.dsmlv2.AbstractGrammar;
31  import org.apache.directory.api.dsmlv2.DsmlControl;
32  import org.apache.directory.api.dsmlv2.Dsmlv2Container;
33  import org.apache.directory.api.dsmlv2.Dsmlv2StatesEnum;
34  import org.apache.directory.api.dsmlv2.Grammar;
35  import org.apache.directory.api.dsmlv2.GrammarAction;
36  import org.apache.directory.api.dsmlv2.GrammarTransition;
37  import org.apache.directory.api.dsmlv2.ParserUtils;
38  import org.apache.directory.api.dsmlv2.Tag;
39  import org.apache.directory.api.dsmlv2.request.BatchRequestDsml.OnError;
40  import org.apache.directory.api.dsmlv2.request.BatchRequestDsml.Processing;
41  import org.apache.directory.api.dsmlv2.request.BatchRequestDsml.ResponseOrder;
42  import org.apache.directory.api.i18n.I18n;
43  import org.apache.directory.api.ldap.codec.api.CodecControl;
44  import org.apache.directory.api.ldap.codec.api.LdapApiService;
45  import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
46  import org.apache.directory.api.ldap.codec.api.LdapConstants;
47  import org.apache.directory.api.ldap.model.entry.BinaryValue;
48  import org.apache.directory.api.ldap.model.entry.StringValue;
49  import org.apache.directory.api.ldap.model.entry.Value;
50  import org.apache.directory.api.ldap.model.exception.LdapException;
51  import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
52  import org.apache.directory.api.ldap.model.message.AbandonRequestImpl;
53  import org.apache.directory.api.ldap.model.message.AddRequestImpl;
54  import org.apache.directory.api.ldap.model.message.AliasDerefMode;
55  import org.apache.directory.api.ldap.model.message.BindRequestImpl;
56  import org.apache.directory.api.ldap.model.message.CompareRequest;
57  import org.apache.directory.api.ldap.model.message.CompareRequestImpl;
58  import org.apache.directory.api.ldap.model.message.Control;
59  import org.apache.directory.api.ldap.model.message.DeleteRequestImpl;
60  import org.apache.directory.api.ldap.model.message.ExtendedRequest;
61  import org.apache.directory.api.ldap.model.message.ExtendedRequestImpl;
62  import org.apache.directory.api.ldap.model.message.ExtendedResponse;
63  import org.apache.directory.api.ldap.model.message.ModifyDnRequestImpl;
64  import org.apache.directory.api.ldap.model.message.ModifyRequestImpl;
65  import org.apache.directory.api.ldap.model.message.Request;
66  import org.apache.directory.api.ldap.model.message.SearchRequest;
67  import org.apache.directory.api.ldap.model.message.SearchRequestImpl;
68  import org.apache.directory.api.ldap.model.message.SearchScope;
69  import org.apache.directory.api.ldap.model.name.Dn;
70  import org.apache.directory.api.ldap.model.name.Rdn;
71  import org.apache.directory.api.util.Base64;
72  import org.xmlpull.v1.XmlPullParser;
73  import org.xmlpull.v1.XmlPullParserException;
74  
75  
76  /**
77   * This Class represents the DSMLv2 Request Grammar
78   *
79   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
80   */
81  public final class Dsmlv2Grammar extends AbstractGrammar implements Grammar
82  {
83      private LdapApiService codec = LdapApiServiceFactory.getSingleton();
84  
85  
86      /**
87       * Creates a new instance of Dsmlv2Grammar.
88       */
89      @SuppressWarnings("unchecked")
90      public Dsmlv2Grammar()
91      {
92          name = Dsmlv2Grammar.class.getName();
93  
94          // Create the transitions table
95          super.transitions = ( HashMap<Tag, GrammarTransition>[] ) Array.newInstance( HashMap.class, 200 ); // TODO Change this value
96  
97          //====================================================
98          //  Transitions concerning : BATCH REQUEST
99          //====================================================
100         super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE.ordinal()] = new HashMap<Tag, GrammarTransition>();
101         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
102         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()] = new HashMap<Tag, GrammarTransition>();
103         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
104 
105         // ** OPEN BATCH REQUEST **
106         // State: [INIT_GRAMMAR_STATE] - Tag: <batchRequest>
107         super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE.ordinal()].put( new Tag( "batchRequest", Tag.START ),
108             new GrammarTransition( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE, Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
109                 batchRequestCreation ) );
110 
111         // ** CLOSE BATCH REQUEST **
112         // state: [BATCHREQUEST_START_TAG] - Tag: </batchRequest>
113         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()]
114             .put( new Tag( "batchRequest", Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
115                 Dsmlv2StatesEnum.BATCHREQUEST_END_TAG, null ) );
116         //state: [BATCHREQUEST_LOOP] - Tag: </batchRequest>
117         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( "batchRequest", Tag.END ),
118             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.GRAMMAR_END, null ) );
119 
120         // ** ABANDON REQUEST **
121         // State: [BATCHREQUEST_START_TAG] - Tag: <abandonRequest>
122         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
123             new Tag( "abandonRequest", Tag.START ),
124             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG,
125                 abandonRequestCreation ) );
126         // state: [BATCHREQUEST_LOOP] - Tag: <abandonRequest>
127         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( "abandonRequest", Tag.START ),
128             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG,
129                 abandonRequestCreation ) );
130 
131         // ** ADD REQUEST **
132         // state: [BATCHREQUEST_START_TAG] - Tag: <addRequest>
133         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( "addRequest", Tag.START ),
134             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.ADD_REQUEST_START_TAG,
135                 addRequestCreation ) );
136         // state: [BATCHREQUEST_LOOP] - Tag: <addRequest>
137         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( "addRequest", Tag.START ),
138             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.ADD_REQUEST_START_TAG,
139                 addRequestCreation ) );
140 
141         // ** AUTH REQUEST **
142         // state: [BATCHREQUEST_START_TAG] - Tag: <authRequest>
143         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( "authRequest", Tag.START ),
144             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG,
145                 authRequestCreation ) );
146 
147         // ** COMPARE REQUEST **
148         // state: [BATCHREQUEST_START_TAG] - Tag: <compareRequest>
149         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
150             new Tag( "compareRequest", Tag.START ),
151             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG,
152                 compareRequestCreation ) );
153         // state: [BATCHREQUEST_LOOP] - Tag: <compareRequest>
154         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( "compareRequest", Tag.START ),
155             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG,
156                 compareRequestCreation ) );
157 
158         // ** DEL REQUEST **
159         // state: [BATCHREQUEST_START_TAG] - Tag: <delRequest>
160         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( "delRequest", Tag.START ),
161             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.DEL_REQUEST_START_TAG,
162                 delRequestCreation ) );
163         // state: [BATCHREQUEST_LOOP] - Tag: <delRequest>
164         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( "delRequest", Tag.START ),
165             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.DEL_REQUEST_START_TAG,
166                 delRequestCreation ) );
167 
168         // ** EXTENDED REQUEST **
169         // state: [BATCHREQUEST_START_TAG] - Tag: <extendedRequest>
170         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
171             new Tag( "extendedRequest", Tag.START ),
172             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
173                 Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG, extendedRequestCreation ) );
174         // state: [BATCHREQUEST_LOOP] - Tag: <extendedRequest>
175         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( "extendedRequest", Tag.START ),
176             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG,
177                 extendedRequestCreation ) );
178 
179         // ** MOD Dn REQUEST **
180         // state: [BATCHREQUEST_START_TAG] - Tag: <modDNRequest>
181         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put( new Tag( "modDNRequest", Tag.START ),
182             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
183                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG, modDNRequestCreation ) );
184         // state: [BATCHREQUEST_LOOP] - Tag: <modDNRequest>
185         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( "modDNRequest", Tag.START ),
186             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG,
187                 modDNRequestCreation ) );
188 
189         // ** MODIFY REQUEST **
190         // state: [BATCHREQUEST_START_TAG] - Tag: <modifyRequest>
191         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
192             new Tag( "modifyRequest", Tag.START ),
193             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
194                 modifyRequestCreation ) );
195         // state: [BATCHREQUEST_LOOP] - Tag: <modifyRequest>
196         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( "modifyRequest", Tag.START ),
197             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
198                 modifyRequestCreation ) );
199 
200         // ** SEARCH REQUEST **
201         // state: [BATCHREQUEST_START_TAG] - Tag: <searchRequest>
202         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_START_TAG.ordinal()].put(
203             new Tag( "searchRequest", Tag.START ),
204             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_START_TAG, Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
205                 searchRequestCreation ) );
206         // state: [BATCHREQUEST_LOOP] - Tag: <searchRequest>
207         super.transitions[Dsmlv2StatesEnum.BATCHREQUEST_LOOP.ordinal()].put( new Tag( "searchRequest", Tag.START ),
208             new GrammarTransition( Dsmlv2StatesEnum.BATCHREQUEST_LOOP, Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
209                 searchRequestCreation ) );
210 
211         //====================================================
212         //  Transitions concerning : ABANDON REQUEST
213         //====================================================
214         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
215         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
216         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
217         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
218 
219         // State: [ABANDON_REQUEST_START_TAG] - Tag: </abandonRequest>
220         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG.ordinal()]
221             .put( new Tag( "abandonRequest", Tag.END ), new GrammarTransition(
222                 Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
223 
224         // State: [ABANDON_REQUEST_START_TAG] - Tag: <control>
225         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG.ordinal()].put( new Tag( "control", Tag.START ),
226             new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_START_TAG,
227                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG, controlCreation ) );
228 
229         // State: [ABANDON_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
230         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG.ordinal()].put(
231             new Tag( "controlValue", Tag.START ), new GrammarTransition(
232                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG,
233                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
234 
235         // State: [ABANDON_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
236         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( "control",
237             Tag.END ),
238             new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROLVALUE_END_TAG,
239                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG, null ) );
240 
241         // State: [ABANDON_REQUEST_CONTROL_START_TAG] - Tag: </control>
242         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "control",
243             Tag.END ),
244             new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG,
245                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG, null ) );
246 
247         // State: [ABANDON_REQUEST_CONTROL_END_TAG] - Tag: <control>
248         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "control",
249             Tag.START ),
250             new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG,
251                 Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_START_TAG, controlCreation ) );
252 
253         // State: [ABANDON_REQUEST_CONTROL_END_TAG] - Tag: </abandonRequest>
254         super.transitions[Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "abandonRequest",
255             Tag.END ),
256             new GrammarTransition( Dsmlv2StatesEnum.ABANDON_REQUEST_CONTROL_END_TAG,
257                 Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
258 
259         //====================================================
260         //  Transitions concerning : ADD REQUEST
261         //====================================================
262         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
263         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
264         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
265         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
266         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
267         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
268 
269         // state: [ADD_REQUEST_START_TAG] -> Tag: </addRequest>
270         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()].put( new Tag( "addRequest", Tag.END ),
271             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
272 
273         // State: [ADD_REQUEST_START_TAG] - Tag: <control>
274         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()].put( new Tag( "control", Tag.START ),
275             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_START_TAG,
276                 Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG, controlCreation ) );
277 
278         // State: [ADD_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
279         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "controlValue",
280             Tag.START ),
281             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG,
282                 Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
283 
284         // State: [ADD_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
285         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put(
286             new Tag( "control", Tag.END ),
287             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROLVALUE_END_TAG,
288                 Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG, null ) );
289 
290         // State: [ADD_REQUEST_CONTROL_START_TAG] - Tag: </control>
291         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "control", Tag.END ),
292             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG,
293                 Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG, null ) );
294 
295         // State: [ADD_REQUEST_CONTROL_END_TAG] - Tag: <control>
296         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "control", Tag.START ),
297             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG,
298                 Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_START_TAG, controlCreation ) );
299 
300         // State: [ADD_REQUEST_CONTROL_END_TAG] - Tag: </addRequest>
301         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()].put(
302             new Tag( "addRequest", Tag.END ),
303             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
304                 null ) );
305 
306         // State: [ADD_REQUEST_START_TAG] - Tag: <attr>
307         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_START_TAG.ordinal()].put( new Tag( "attr", Tag.START ),
308             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_START_TAG, Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG,
309                 addRequestAddAttribute ) );
310 
311         // State: [ADD_REQUEST_CONTROL_END_TAG] - Tag: <attr>
312         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "attr", Tag.START ),
313             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_CONTROL_END_TAG,
314                 Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG, addRequestAddAttribute ) );
315 
316         // State: [ADD_REQUEST_ATTR_END_TAG] - Tag: <attr>
317         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG.ordinal()].put( new Tag( "attr", Tag.START ),
318             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG,
319                 Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG, addRequestAddAttribute ) );
320 
321         // State: [ADD_REQUEST_ATTR_START_TAG] - Tag: </attr>
322         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG.ordinal()].put( new Tag( "attr", Tag.END ),
323             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG,
324                 Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG, null ) );
325 
326         // State: [ADD_REQUEST_ATTR_START_TAG] - Tag: <value>
327         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG.ordinal()].put( new Tag( "value", Tag.START ),
328             new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG,
329                 Dsmlv2StatesEnum.ADD_REQUEST_ATTR_START_TAG, addRequestAddValue ) );
330 
331         // State: [ADD_REQUEST_ATTR_END_TAG] - Tag: </addRequest>
332         super.transitions[Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG.ordinal()]
333             .put( new Tag( "addRequest", Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.ADD_REQUEST_ATTR_END_TAG,
334                 Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
335 
336         //====================================================
337         //  Transitions concerning : AUTH REQUEST
338         //====================================================
339         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
340         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
341         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
342         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
343 
344         // state: [AUTH_REQUEST_START_TAG] -> Tag: </authRequest>
345         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG.ordinal()].put( new Tag( "authRequest", Tag.END ),
346             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
347 
348         // State: [AUTH_REQUEST_START_TAG] - Tag: <control>
349         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG.ordinal()].put( new Tag( "control", Tag.START ),
350             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_START_TAG,
351                 Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG, controlCreation ) );
352 
353         // State: [AUTH_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
354         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "controlValue",
355             Tag.START ),
356             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG,
357                 Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
358 
359         // State: [AUTH_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
360         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( "control",
361             Tag.END ),
362             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROLVALUE_END_TAG,
363                 Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG, null ) );
364 
365         // State: [AUTH_REQUEST_CONTROL_START_TAG] - Tag: </control>
366         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG.ordinal()].put(
367             new Tag( "control", Tag.END ),
368             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG,
369                 Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG, null ) );
370 
371         // State: [AUTH_REQUEST_CONTROL_END_TAG] - Tag: <control>
372         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG.ordinal()].put(
373             new Tag( "control", Tag.START ),
374             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG,
375                 Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_START_TAG, controlCreation ) );
376 
377         // State: [AUTH_REQUEST_CONTROL_END_TAG] - Tag: </authRequest>
378         super.transitions[Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG.ordinal()].put(
379             new Tag( "authRequest", Tag.END ),
380             new GrammarTransition( Dsmlv2StatesEnum.AUTH_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
381                 null ) );
382 
383         //====================================================
384         //  Transitions concerning : COMPARE REQUEST
385         //====================================================
386         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
387         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
388         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
389         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
390         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
391         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
392         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
393 
394         // State: [COMPARE_REQUEST_START_TAG] - Tag: <control>
395         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG.ordinal()].put( new Tag( "control", Tag.START ),
396             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG,
397                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG, controlCreation ) );
398 
399         // State: [COMPARE_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
400         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG.ordinal()].put(
401             new Tag( "controlValue", Tag.START ), new GrammarTransition(
402                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG,
403                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
404 
405         // State: [COMPARE_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
406         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( "control",
407             Tag.END ),
408             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROLVALUE_END_TAG,
409                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG, null ) );
410 
411         // State: [COMPARE_REQUEST_CONTROL_START_TAG] - Tag: </control>
412         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "control",
413             Tag.END ),
414             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG,
415                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG, null ) );
416 
417         // State: [COMPARE_REQUEST_CONTROL_END_TAG] - Tag: <control>
418         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "control",
419             Tag.START ),
420             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG,
421                 Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG, controlCreation ) );
422 
423         // State: [COMPARE_REQUEST_CONTROL_END_TAG] - Tag: </compareRequest>
424         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "compareRequest",
425             Tag.END ),
426             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG,
427                 Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
428 
429         // State: [COMPARE_REQUEST_START_TAG] - Tag: <assertion>
430         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_START_TAG.ordinal()].put( new Tag( "assertion", Tag.START ),
431             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_START_TAG,
432                 Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG, compareRequestAddAssertion ) );
433 
434         // State: [COMPARE_REQUEST_CONTROL_END_TAG] - Tag: <assertion>
435         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "assertion",
436             Tag.START ),
437             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_CONTROL_END_TAG,
438                 Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG, compareRequestAddAssertion ) );
439 
440         // State: [COMPARE_REQUEST_ASSERTION_START_TAG] - Tag: <value>
441         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG.ordinal()].put( new Tag( "value",
442             Tag.START ),
443             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_START_TAG,
444                 Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG, compareRequestAddValue ) );
445 
446         //State: [COMPARE_REQUEST_VALUE_END_TAG] - Tag: </assertion>
447         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG.ordinal()].put(
448             new Tag( "assertion", Tag.END ),
449             new GrammarTransition( Dsmlv2StatesEnum.COMPARE_REQUEST_VALUE_END_TAG,
450                 Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG, null ) );
451 
452         // State: [COMPARE_REQUEST_ASSERTION_END_TAG] - Tag: </compareRequest>
453         super.transitions[Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG.ordinal()].put(
454             new Tag( "compareRequest", Tag.END ), new GrammarTransition(
455                 Dsmlv2StatesEnum.COMPARE_REQUEST_ASSERTION_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
456 
457         //====================================================
458         //  Transitions concerning : DEL REQUEST
459         //====================================================
460         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
461         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
462         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
463         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
464 
465         // State: [DEL_REQUEST_START_TAG] - Tag: </delRequest>
466         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_START_TAG.ordinal()].put( new Tag( "delRequest", Tag.END ),
467             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
468 
469         // State: [DEL_REQUEST_START_TAG] - Tag: <control>
470         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_START_TAG.ordinal()].put( new Tag( "control", Tag.START ),
471             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_START_TAG,
472                 Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG, controlCreation ) );
473 
474         // State: [DEL_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
475         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "controlValue",
476             Tag.START ),
477             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG,
478                 Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
479 
480         // State: [DEL_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
481         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put(
482             new Tag( "control", Tag.END ),
483             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROLVALUE_END_TAG,
484                 Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG, null ) );
485 
486         // State: [DEL_REQUEST_CONTROL_START_TAG] - Tag: </control>
487         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "control", Tag.END ),
488             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG,
489                 Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG, null ) );
490 
491         // State: [DEL_REQUEST_CONTROL_END_TAG] - Tag: <control>
492         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "control", Tag.START ),
493             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG,
494                 Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_START_TAG, controlCreation ) );
495 
496         // State: [DEL_REQUEST_CONTROL_END_TAG] - Tag: </delRequest>
497         super.transitions[Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG.ordinal()].put(
498             new Tag( "delRequest", Tag.END ),
499             new GrammarTransition( Dsmlv2StatesEnum.DEL_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
500                 null ) );
501 
502         //====================================================
503         //  Transitions concerning : EXTENDED REQUEST
504         //====================================================
505         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
506         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
507         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
508         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
509         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
510         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
511 
512         // State: [EXTENDED_REQUEST_START_TAG] - Tag: <control>
513         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG.ordinal()].put( new Tag( "control", Tag.START ),
514             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG,
515                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG, controlCreation ) );
516 
517         // State: [EXTENDED_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
518         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG.ordinal()].put(
519             new Tag( "controlValue", Tag.START ), new GrammarTransition(
520                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG,
521                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
522 
523         // State: [EXTENDED_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
524         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( "control",
525             Tag.END ),
526             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROLVALUE_END_TAG,
527                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG, null ) );
528 
529         // State: [EXTENDED_REQUEST_CONTROL_START_TAG] - Tag: </control>
530         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "control",
531             Tag.END ),
532             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG,
533                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG, null ) );
534 
535         // State: [EXTENDED_REQUEST_CONTROL_END_TAG] - Tag: <control>
536         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "control",
537             Tag.START ),
538             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG,
539                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_START_TAG, controlCreation ) );
540 
541         // State: [EXTENDED_REQUEST_CONTROL_END_TAG] - Tag: </extendedRequest>
542         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()].put(
543             new Tag( "extendedRequest", Tag.END ), new GrammarTransition(
544                 Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
545 
546         // State: [EXTENDED_REQUEST_START_TAG] - Tag: <requestName>
547         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG.ordinal()].put(
548             new Tag( "requestName", Tag.START ),
549             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_START_TAG,
550                 Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG, extendedRequestAddName ) );
551 
552         // State: [EXTENDED_REQUEST_CONTROL_END_TAG] - Tag: <requestName>
553         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "requestName",
554             Tag.START ),
555             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_CONTROL_END_TAG,
556                 Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG, extendedRequestAddName ) );
557 
558         // State: [EXTENDED_REQUEST_REQUESTNAME_END_TAG] - Tag: </extendedRequest>
559         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG.ordinal()].put( new Tag(
560             "extendedRequest",
561             Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG,
562             Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
563 
564         // State: [EXTENDED_REQUEST_REQUESTNAME_END_TAG] - Tag: <requestValue>
565         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG.ordinal()].put( new Tag(
566             "requestValue",
567             Tag.START ), new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTNAME_END_TAG,
568             Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG, extendedRequestAddValue ) );
569 
570         // State: [EXTENDED_REQUEST_REQUESTVALUE_END_TAG] - Tag: </requestRequest>
571         super.transitions[Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG.ordinal()].put( new Tag(
572             "extendedRequest",
573             Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_REQUEST_REQUESTVALUE_END_TAG,
574             Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
575 
576         //====================================================
577         //  Transitions concerning : MODIFY Dn REQUEST
578         //====================================================
579         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
580         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
581         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
582         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
583 
584         // State: [MODIFY_DN_REQUEST_START_TAG] - Tag: </modDNRequest>
585         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG.ordinal()].put(
586             new Tag( "modDNRequest", Tag.END ),
587             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
588                 null ) );
589 
590         // State: [MODIFY_DN_REQUEST_START_TAG] - Tag: <control>
591         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG.ordinal()].put( new Tag( "control", Tag.START ),
592             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_START_TAG,
593                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG, controlCreation ) );
594 
595         // State: [MODIFY_DN_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
596         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG.ordinal()].put(
597             new Tag( "controlValue", Tag.START ), new GrammarTransition(
598                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG,
599                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
600 
601         // State: [MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
602         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( "control",
603             Tag.END ),
604             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROLVALUE_END_TAG,
605                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG, null ) );
606 
607         // State: [MODIFY_DN_REQUEST_CONTROL_START_TAG] - Tag: </control>
608         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "control",
609             Tag.END ),
610             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG,
611                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG, null ) );
612 
613         // State: [MODIFY_DN_REQUEST_CONTROL_END_TAG] - Tag: <control>
614         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "control",
615             Tag.START ),
616             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG,
617                 Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_START_TAG, controlCreation ) );
618 
619         // State: [MODIFY_DN_REQUEST_CONTROL_END_TAG] - Tag: </modDNRequest>
620         super.transitions[Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "modDNRequest",
621             Tag.END ),
622             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_DN_REQUEST_CONTROL_END_TAG,
623                 Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
624 
625         //====================================================
626         //  Transitions concerning : MODIFY REQUEST
627         //====================================================
628         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
629         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
630         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
631         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
632         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
633         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
634         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
635 
636         // State: [MODIFY_REQUEST_START_TAG] - Tag: </modifyRequest>
637         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()]
638             .put( new Tag( "modifyRequest", Tag.END ), new GrammarTransition(
639                 Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
640 
641         // State: [MODIFY_REQUEST_START_TAG] - Tag: <control>
642         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()].put( new Tag( "control", Tag.START ),
643             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
644                 Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG, controlCreation ) );
645 
646         // State: [MODIFY_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
647         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "controlValue",
648             Tag.START ),
649             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG,
650                 Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
651 
652         // State: [MODIFY_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
653         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( "control",
654             Tag.END ),
655             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROLVALUE_END_TAG,
656                 Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG, null ) );
657 
658         // State: [MODIFY_REQUEST_CONTROL_START_TAG] - Tag: </control>
659         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG.ordinal()].put(
660             new Tag( "control", Tag.END ),
661             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG,
662                 Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG, null ) );
663 
664         // State: [MODIFY_REQUEST_CONTROL_END_TAG] - Tag: <control>
665         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()].put(
666             new Tag( "control", Tag.START ),
667             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG,
668                 Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_START_TAG, controlCreation ) );
669 
670         // State: [MODIFY_REQUEST_CONTROL_END_TAG] - Tag: </modifyRequest>
671         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "modifyRequest",
672             Tag.END ),
673             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
674                 null ) );
675 
676         // State: [MODIFY_REQUEST_CONTROL_END_TAG] - Tag: <modification>
677         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "modification",
678             Tag.START ),
679             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_CONTROL_END_TAG,
680                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG, modifyRequestAddModification ) );
681 
682         // State: [MODIFY_REQUEST_START_TAG] - Tag: <modification>
683         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG.ordinal()].put(
684             new Tag( "modification", Tag.START ),
685             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_START_TAG,
686                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG, modifyRequestAddModification ) );
687 
688         // State: [MODIFY_REQUEST_MODIFICATION_END_TAG] - Tag: <modification>
689         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG.ordinal()].put(
690             new Tag( "modification", Tag.START ), new GrammarTransition(
691                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG,
692                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG, modifyRequestAddModification ) );
693 
694         // State: [MODIFY_REQUEST_MODIFICATION_START_TAG] - Tag: </modification>
695         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG.ordinal()].put(
696             new Tag( "modification", Tag.END ), new GrammarTransition(
697                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG,
698                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG, null ) );
699 
700         // State: [MODIFY_REQUEST_MODIFICATION_START_TAG] - Tag: <value>
701         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG.ordinal()].put( new Tag( "value",
702             Tag.START ),
703             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_START_TAG,
704                 Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG, modifyRequestAddValue ) );
705 
706         // State: [MODIFY_REQUEST_VALUE_END_TAG] - Tag: <value>
707         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG.ordinal()].put( new Tag( "value", Tag.START ),
708             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG,
709                 Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG, modifyRequestAddValue ) );
710 
711         // State: [MODIFY_REQUEST_VALUE_END_TAG] - Tag: </modification>
712         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG.ordinal()].put( new Tag( "modification",
713             Tag.END ),
714             new GrammarTransition( Dsmlv2StatesEnum.MODIFY_REQUEST_VALUE_END_TAG,
715                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG, null ) );
716 
717         // State: [MODIFY_REQUEST_MODIFICATION_END_TAG] - Tag: </modifyRequest>
718         super.transitions[Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG.ordinal()].put(
719             new Tag( "modifyRequest", Tag.END ), new GrammarTransition(
720                 Dsmlv2StatesEnum.MODIFY_REQUEST_MODIFICATION_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP, null ) );
721 
722         //====================================================
723         //  Transitions concerning : SEARCH REQUEST
724         //====================================================
725         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
726         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
727         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
728         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
729         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
730         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
731         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
732         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
733 
734         // State: [SEARCH_REQUEST_START_TAG] - Tag: <control>
735         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG.ordinal()].put( new Tag( "control", Tag.START ),
736             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
737                 Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG, controlCreation ) );
738 
739         // State: [SEARCH_REQUEST_CONTROL_START_TAG] - Tag: <controlValue>
740         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG.ordinal()].put( new Tag( "controlValue",
741             Tag.START ),
742             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG,
743                 Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG, controlValueCreation ) );
744 
745         // State: [SEARCH_REQUEST_CONTROLVALUE_END_TAG] - Tag: </control>
746         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG.ordinal()].put( new Tag( "control",
747             Tag.END ),
748             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROLVALUE_END_TAG,
749                 Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG, null ) );
750 
751         // State: [SEARCH_REQUEST_CONTROL_START_TAG] - Tag: </control>
752         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG.ordinal()].put(
753             new Tag( "control", Tag.END ),
754             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG,
755                 Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG, null ) );
756 
757         // State: [SEARCH_REQUEST_CONTROL_END_TAG] - Tag: <control>
758         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()].put(
759             new Tag( "control", Tag.START ),
760             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG,
761                 Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_START_TAG, controlCreation ) );
762 
763         // State: [SEARCH_REQUEST_FILTER_END_TAG] - Tag: </searchRequest>
764         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()].put( new Tag( "searchRequest",
765             Tag.END ),
766             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
767                 storeFilter ) );
768 
769         // State: [SEARCH_REQUEST_ATTRIBUTES_START_TAG] - Tag: </attributes>
770         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG.ordinal()].put( new Tag( "attributes",
771             Tag.END ),
772             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG,
773                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG, null ) );
774 
775         // State: [SEARCH_REQUEST_ATTRIBUTES_START_TAG] - Tag: <attribute>
776         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG.ordinal()].put( new Tag( "attribute",
777             Tag.START ),
778             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG,
779                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG, searchRequestAddAttribute ) );
780 
781         // State: [SEARCH_REQUEST_ATTRIBUTE_START_TAG] - Tag: </attribute>
782         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG.ordinal()].put( new Tag( "attribute",
783             Tag.END ),
784             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG,
785                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG, null ) );
786 
787         // State: [SEARCH_REQUEST_ATTRIBUTE_END_TAG] - Tag: <attribute>
788         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG.ordinal()].put( new Tag( "attribute",
789             Tag.START ),
790             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG,
791                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_START_TAG, searchRequestAddAttribute ) );
792 
793         // State: [SEARCH_REQUEST_ATTRIBUTE_END_TAG] - Tag: </attributes>
794         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG.ordinal()].put( new Tag( "attributes",
795             Tag.END ),
796             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTE_END_TAG,
797                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG, null ) );
798 
799         // State: [SEARCH_REQUEST_ATTRIBUTES_END_TAG] - Tag: </searchRequest>
800         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG.ordinal()].put( new Tag( "searchRequest",
801             Tag.END ),
802             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_END_TAG,
803                 Dsmlv2StatesEnum.BATCHREQUEST_LOOP, storeFilter ) );
804 
805         //====================================================
806         //  Transitions concerning : FILTER
807         //====================================================
808         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
809         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
810         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()] = new HashMap<Tag, GrammarTransition>();
811         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
812         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
813         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
814         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
815         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
816         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
817         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
818         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
819 
820         // State: [SEARCH_REQUEST_START_TAG] - Tag: <filter>
821         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG.ordinal()].put( new Tag( "filter", Tag.START ),
822             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_START_TAG,
823                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG, null ) );
824 
825         // State: [SEARCH_REQUEST_CONTROL_END_TAG] - Tag: <filter>
826         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG.ordinal()].put(
827             new Tag( "filter", Tag.START ),
828             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_CONTROL_END_TAG,
829                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG, null ) );
830 
831         //*** AND ***
832         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <and>
833         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "and", Tag.START ),
834             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
835                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, andFilterCreation ) );
836 
837         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <and>
838         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "and", Tag.START ),
839             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
840                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, andFilterCreation ) );
841 
842         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </and>
843         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "and", Tag.END ),
844             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
845                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, connectorFilterClose ) );
846 
847         //*** OR ***
848         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <or>
849         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "or", Tag.START ),
850             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
851                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, orFilterCreation ) );
852 
853         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <or>
854         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "or", Tag.START ),
855             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
856                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, orFilterCreation ) );
857 
858         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </or>
859         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "or", Tag.END ),
860             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
861                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, connectorFilterClose ) );
862 
863         //*** NOT ***
864         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <not>
865         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "not", Tag.START ),
866             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
867                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, notFilterCreation ) );
868 
869         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <not>
870         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "not", Tag.START ),
871             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
872                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, notFilterCreation ) );
873 
874         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </not>
875         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "not", Tag.END ),
876             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
877                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, connectorFilterClose ) );
878 
879         //*** SUBSTRINGS ***
880         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <substrings>
881         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "substrings",
882             Tag.START ),
883             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
884                 Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG, substringsFilterCreation ) );
885 
886         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <substrings>
887         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put(
888             new Tag( "substrings", Tag.START ),
889             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
890                 Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG, substringsFilterCreation ) );
891 
892         //*** EQUALITY MATCH ***
893         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <equalityMatch>
894         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "equalityMatch",
895             Tag.START ),
896             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
897                 Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG, equalityMatchFilterCreation ) );
898 
899         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <equalityMatch>
900         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "equalityMatch",
901             Tag.START ),
902             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
903                 Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG, equalityMatchFilterCreation ) );
904 
905         // State: [SEARCH_REQUEST_EQUALITYMATCH_START_TAG] - Tag: <value>
906         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG.ordinal()].put( new Tag( "value",
907             Tag.START ),
908             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_EQUALITYMATCH_START_TAG,
909                 Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG, filterAddValue ) );
910 
911         // State: [SEARCH_REQUEST_VALUE_END_TAG] - Tag: </equalityMatch>
912         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()].put( new Tag( "equalityMatch",
913             Tag.END ),
914             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG,
915                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
916 
917         //*** GREATER OR EQUAL ***
918         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <greaterOrEqual>
919         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put(
920             new Tag( "greaterOrEqual", Tag.START ), new GrammarTransition(
921                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
922                 Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG, greaterOrEqualFilterCreation ) );
923 
924         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <greaterOrEqual>
925         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "greaterOrEqual",
926             Tag.START ),
927             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
928                 Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG, greaterOrEqualFilterCreation ) );
929 
930         // State: [SEARCH_REQUEST_GREATEROREQUAL_START_TAG] - Tag: <value>
931         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG.ordinal()].put( new Tag( "value",
932             Tag.START ),
933             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_GREATEROREQUAL_START_TAG,
934                 Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG, filterAddValue ) );
935 
936         // State: [SEARCH_REQUEST_VALUE_END_TAG] - Tag: </greaterOrEqual>
937         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()].put( new Tag( "greaterOrEqual",
938             Tag.END ),
939             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG,
940                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
941 
942         //*** LESS OR EQUAL ***
943         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <lessOrEqual>
944         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "lessOrEqual",
945             Tag.START ),
946             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
947                 Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG, lessOrEqualFilterCreation ) );
948 
949         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <lessOrEqual>
950         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put(
951             new Tag( "lessOrEqual", Tag.START ),
952             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
953                 Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG, lessOrEqualFilterCreation ) );
954 
955         // State: [SEARCH_REQUEST_LESSOREQUAL_START_TAG] - Tag: <value>
956         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG.ordinal()].put( new Tag( "value",
957             Tag.START ),
958             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_LESSOREQUAL_START_TAG,
959                 Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG, filterAddValue ) );
960 
961         // State: [SEARCH_REQUEST_VALUE_END_TAG] - Tag: </lessOrEqual>
962         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()].put(
963             new Tag( "lessOrEqual", Tag.END ),
964             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG,
965                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
966 
967         //*** LESS OR EQUAL ***
968         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <approxMatch>
969         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "approxMatch",
970             Tag.START ),
971             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
972                 Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG, approxMatchFilterCreation ) );
973 
974         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <approxMatch>
975         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put(
976             new Tag( "approxMatch", Tag.START ),
977             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
978                 Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG, approxMatchFilterCreation ) );
979 
980         // State: [SEARCH_REQUEST_APPROXMATCH_START_TAG] - Tag: <value>
981         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG.ordinal()].put( new Tag( "value",
982             Tag.START ),
983             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_APPROXMATCH_START_TAG,
984                 Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG, filterAddValue ) );
985 
986         // State: [SEARCH_REQUEST_VALUE_END_TAG] - Tag: </approxMatch>
987         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG.ordinal()].put(
988             new Tag( "approxMatch", Tag.END ),
989             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_VALUE_END_TAG,
990                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
991 
992         //*** PRESENT ***
993         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <present>
994         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put( new Tag( "present",
995             Tag.START ),
996             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
997                 Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG, presentFilterCreation ) );
998 
999         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <present>
1000         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "present", Tag.START ),
1001             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
1002                 Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG, presentFilterCreation ) );
1003 
1004         // State: [SEARCH_REQUEST_PRESENT_START_TAG] - Tag: </present>
1005         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG.ordinal()].put(
1006             new Tag( "present", Tag.END ),
1007             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_PRESENT_START_TAG,
1008                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
1009 
1010         //*** EXTENSIBLE MATCH ***
1011         // State: [SEARCH_REQUEST_FILTER_START_TAG] - Tag: <extensibleMatch>
1012         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG.ordinal()].put(
1013             new Tag( "extensibleMatch", Tag.START ), new GrammarTransition(
1014                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_START_TAG,
1015                 Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG, extensibleMatchFilterCreation ) );
1016 
1017         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: <extensibleMatch>
1018         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "extensibleMatch",
1019             Tag.START ),
1020             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
1021                 Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG, extensibleMatchFilterCreation ) );
1022 
1023         // State: [SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG] - Tag: <value>
1024         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG.ordinal()].put(
1025             new Tag( "value", Tag.START ), new GrammarTransition(
1026                 Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_START_TAG,
1027                 Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG, extensibleMatchAddValue ) );
1028 
1029         // State: [SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG] - Tag: </extensibleMatch>
1030         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG.ordinal()].put( new Tag(
1031             "extensibleMatch", Tag.END ), new GrammarTransition(
1032             Dsmlv2StatesEnum.SEARCH_REQUEST_EXTENSIBLEMATCH_VALUE_END_TAG, Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
1033             null ) );
1034 
1035         //*** Filter (end) ***
1036         // State: [SEARCH_REQUEST_FILTER_LOOP] - Tag: </filter>
1037         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP.ordinal()].put( new Tag( "filter", Tag.END ),
1038             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP,
1039                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG, null ) );
1040 
1041         // State: [SEARCH_REQUEST_FILTER_END_TAG] - Tag: <attributes>
1042         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG.ordinal()].put( new Tag( "attributes",
1043             Tag.START ),
1044             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG,
1045                 Dsmlv2StatesEnum.SEARCH_REQUEST_ATTRIBUTES_START_TAG, null ) );
1046 
1047         // State: [SEARCH_REQUEST_FILTER_END_TAG] - Tag: </searchRequest>
1048         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG.ordinal()].put( new Tag( "searchRequest",
1049             Tag.END ),
1050             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_END_TAG, Dsmlv2StatesEnum.BATCHREQUEST_LOOP,
1051                 storeFilter ) );
1052 
1053         //====================================================
1054         //  Transitions concerning : SUBSTRING FILTER
1055         //====================================================
1056         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
1057         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
1058         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
1059         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
1060         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
1061 
1062         // State: [SEARCH_REQUEST_SUBSTRINGS_START_TAG] - Tag: </substrings>
1063         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG.ordinal()].put( new Tag( "substrings",
1064             Tag.END ),
1065             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG,
1066                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, null ) );
1067 
1068         // State: [SEARCH_REQUEST_SUBSTRINGS_START_TAG] - Tag: <initial>
1069         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG.ordinal()].put( new Tag( "initial",
1070             Tag.START ),
1071             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG,
1072                 Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG, substringsFilterSetInitial ) );
1073 
1074         // State: [SEARCH_REQUEST_INITIAL_END_TAG] - Tag: <any>
1075         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG.ordinal()].put( new Tag( "any", Tag.START ),
1076             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG,
1077                 Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG, substringsFilterAddAny ) );
1078 
1079         // State: [SEARCH_REQUEST_INITIAL_END_TAG] - Tag: <final>
1080         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG.ordinal()].put(
1081             new Tag( "final", Tag.START ),
1082             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG,
1083                 Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG, substringsFilterSetFinal ) );
1084 
1085         // State: [SEARCH_REQUEST_INITIAL_END_TAG] - Tag: </substrings>
1086         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG.ordinal()].put( new Tag( "substrings",
1087             Tag.END ),
1088             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_INITIAL_END_TAG,
1089                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, substringsFilterClose ) );
1090 
1091         // State: [SEARCH_REQUEST_SUBSTRINGS_START_TAG] - Tag: <any>
1092         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG.ordinal()].put( new Tag( "any",
1093             Tag.START ),
1094             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG,
1095                 Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG, substringsFilterAddAny ) );
1096 
1097         // State: [SEARCH_REQUEST_ANY_END_TAG] - Tag: </any>
1098         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG.ordinal()].put( new Tag( "any", Tag.START ),
1099             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG,
1100                 Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG, substringsFilterAddAny ) );
1101 
1102         // State: [SEARCH_REQUEST_ANY_END_TAG] - Tag: <final>
1103         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG.ordinal()].put( new Tag( "final", Tag.START ),
1104             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG,
1105                 Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG, substringsFilterSetFinal ) );
1106 
1107         // State: [SEARCH_REQUEST_ANY_END_TAG] - Tag: </substrings>
1108         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG.ordinal()].put( new Tag( "substrings", Tag.END ),
1109             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_ANY_END_TAG,
1110                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, substringsFilterClose ) );
1111 
1112         // State: [SEARCH_REQUEST_SUBSTRINGS_START_TAG] - Tag: <final>
1113         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG.ordinal()].put( new Tag( "final",
1114             Tag.START ),
1115             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_SUBSTRINGS_START_TAG,
1116                 Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG, substringsFilterSetFinal ) );
1117 
1118         // State: [SEARCH_REQUEST_FINAL_END_TAG] - Tag: </substrings>
1119         super.transitions[Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG.ordinal()].put(
1120             new Tag( "substrings", Tag.END ),
1121             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_REQUEST_FINAL_END_TAG,
1122                 Dsmlv2StatesEnum.SEARCH_REQUEST_FILTER_LOOP, substringsFilterClose ) );
1123 
1124         //------------------------------------------ handle SOAP envelopes --------------------------
1125         super.transitions[Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
1126         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
1127         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
1128         super.transitions[Dsmlv2StatesEnum.SOAP_BODY_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
1129         super.transitions[Dsmlv2StatesEnum.SOAP_BODY_END_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
1130 
1131         super.transitions[Dsmlv2StatesEnum.GRAMMAR_END.ordinal()] = new HashMap<Tag, GrammarTransition>();
1132 
1133         // State: [INIT_GRAMMAR_STATE] - Tag: <envelope>
1134         super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE.ordinal()].put( new Tag( "envelope", Tag.START ),
1135             new GrammarTransition( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE, Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG,
1136                 null ) );
1137 
1138         // state: [SOAP_ENVELOPE_START_TAG] -> Tag: <header>
1139         super.transitions[Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG.ordinal()].put( new Tag( "header", Tag.START ),
1140             new GrammarTransition( Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG, Dsmlv2StatesEnum.SOAP_HEADER_START_TAG,
1141                 ParserUtils.readSoapHeader ) );
1142 
1143         // state: [SOAP_HEADER_START_TAG] -> Tag: </header>
1144         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_START_TAG.ordinal()]
1145             .put( new Tag( "header", Tag.END ),
1146                 new GrammarTransition( Dsmlv2StatesEnum.SOAP_HEADER_START_TAG, Dsmlv2StatesEnum.SOAP_HEADER_END_TAG,
1147                     null ) );
1148 
1149         // state: [SOAP_HEADER_END_TAG] -> Tag: <body>
1150         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_END_TAG.ordinal()].put( new Tag( "body", Tag.START ),
1151             new GrammarTransition( Dsmlv2StatesEnum.SOAP_HEADER_END_TAG, Dsmlv2StatesEnum.SOAP_BODY_START_TAG, null ) );
1152 
1153         // state: [SOAP_BODY_START_TAG] -> Tag: <batchRequest>
1154         super.transitions[Dsmlv2StatesEnum.SOAP_BODY_START_TAG.ordinal()].put( new Tag( "batchRequest", Tag.START ),
1155             new GrammarTransition( Dsmlv2StatesEnum.SOAP_BODY_START_TAG, Dsmlv2StatesEnum.BATCHREQUEST_START_TAG,
1156                 batchRequestCreation ) );
1157 
1158         // the optional transition if no soap header is present
1159         // state: [SOAP_ENVELOPE_START_TAG] -> Tag: <body>
1160         super.transitions[Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG.ordinal()]
1161             .put( new Tag( "body", Tag.START ),
1162                 new GrammarTransition( Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG, Dsmlv2StatesEnum.SOAP_BODY_START_TAG,
1163                     null ) );
1164 
1165         // the below two transitions are a bit unconventional, technically the container's state is set to GRAMMAR_END
1166         // when the </batchRequest> tag is encountered by the parser and the corresponding action gets executed but in
1167         // a SOAP envelop we still have two more end tags(</body> and </envelope>) are left so we set those corresponding
1168         // current and next transition states always to GRAMMAR_END
1169         super.transitions[Dsmlv2StatesEnum.GRAMMAR_END.ordinal()].put( new Tag( "body", Tag.END ),
1170             new GrammarTransition( Dsmlv2StatesEnum.GRAMMAR_END, Dsmlv2StatesEnum.GRAMMAR_END, null ) );
1171 
1172         super.transitions[Dsmlv2StatesEnum.GRAMMAR_END.ordinal()].put( new Tag( "envelope", Tag.END ),
1173             new GrammarTransition( Dsmlv2StatesEnum.GRAMMAR_END, Dsmlv2StatesEnum.GRAMMAR_END, null ) );
1174 
1175         //------------------------------------------
1176 
1177     } // End of the constructor
1178 
1179 
1180     /**
1181      * @return The LDAP codec service.
1182      */
1183     public LdapApiService getLdapCodecService()
1184     {
1185         return codec;
1186     }
1187 
1188     //*************************
1189     //*    GRAMMAR ACTIONS    *
1190     //*************************
1191 
1192     /**
1193      * GrammarAction that creates a Batch Request
1194      */
1195     private final GrammarAction batchRequestCreation = new GrammarAction( "Create Batch Request" )
1196     {
1197         public void action( Dsmlv2Container container ) throws XmlPullParserException
1198         {
1199             BatchRequestDsml batchRequest = new BatchRequestDsml();
1200 
1201             container.setBatchRequest( batchRequest );
1202 
1203             XmlPullParser xpp = container.getParser();
1204 
1205             // Checking and adding the batchRequest's attributes
1206             String attributeValue;
1207             // requestID
1208             attributeValue = xpp.getAttributeValue( "", "requestID" );
1209 
1210             if ( attributeValue != null )
1211             {
1212                 batchRequest.setRequestID( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1213             }
1214             // processing
1215             attributeValue = xpp.getAttributeValue( "", "processing" );
1216 
1217             if ( attributeValue != null )
1218             {
1219                 if ( "sequential".equals( attributeValue ) )
1220                 {
1221                     batchRequest.setProcessing( Processing.SEQUENTIAL );
1222                 }
1223                 else if ( "parallel".equals( attributeValue ) )
1224                 {
1225                     batchRequest.setProcessing( Processing.PARALLEL );
1226                 }
1227                 else
1228                 {
1229                     throw new XmlPullParserException( I18n.err( I18n.ERR_03013 ), xpp, null );
1230                 }
1231             }
1232             else
1233             {
1234                 batchRequest.setProcessing( Processing.SEQUENTIAL );
1235             }
1236 
1237             // onError
1238             attributeValue = xpp.getAttributeValue( "", "onError" );
1239 
1240             if ( attributeValue != null )
1241             {
1242                 if ( "resume".equals( attributeValue ) )
1243                 {
1244                     batchRequest.setOnError( OnError.RESUME );
1245                 }
1246                 else if ( "exit".equals( attributeValue ) )
1247                 {
1248                     batchRequest.setOnError( OnError.EXIT );
1249                 }
1250                 else
1251                 {
1252                     throw new XmlPullParserException( I18n.err( I18n.ERR_03014 ), xpp, null );
1253                 }
1254             }
1255             else
1256             {
1257                 batchRequest.setOnError( OnError.EXIT );
1258             }
1259 
1260             // responseOrder
1261             attributeValue = xpp.getAttributeValue( "", "responseOrder" );
1262 
1263             if ( attributeValue != null )
1264             {
1265                 if ( "sequential".equals( attributeValue ) )
1266                 {
1267                     batchRequest.setResponseOrder( ResponseOrder.SEQUENTIAL );
1268                 }
1269                 else if ( "unordered".equals( attributeValue ) )
1270                 {
1271                     batchRequest.setResponseOrder( ResponseOrder.UNORDERED );
1272                 }
1273                 else
1274                 {
1275                     throw new XmlPullParserException( I18n.err( I18n.ERR_03015 ), xpp, null );
1276                 }
1277             }
1278             else
1279             {
1280                 batchRequest.setResponseOrder( ResponseOrder.SEQUENTIAL );
1281             }
1282         }
1283     };
1284 
1285     /**
1286      * GrammarAction that creates an Abandon Request
1287      */
1288     private final GrammarAction abandonRequestCreation = new GrammarAction( "Create Abandon Request" )
1289     {
1290         public void action( Dsmlv2Container container ) throws XmlPullParserException
1291         {
1292             AbandonRequestDsml abandonRequest = new AbandonRequestDsml( codec, new AbandonRequestImpl() );
1293             container.getBatchRequest().addRequest( abandonRequest );
1294 
1295             XmlPullParser xpp = container.getParser();
1296 
1297             // Checking and adding the request's attributes
1298             String attributeValue;
1299             // requestID
1300             attributeValue = xpp.getAttributeValue( "", "requestID" );
1301             if ( attributeValue != null )
1302             {
1303                 abandonRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1304             }
1305             else
1306             {
1307                 if ( ParserUtils.isRequestIdNeeded( container ) )
1308                 {
1309                     throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
1310                 }
1311             }
1312             // abandonID
1313             attributeValue = xpp.getAttributeValue( "", "abandonID" );
1314             if ( attributeValue != null )
1315             {
1316                 try
1317                 {
1318                     abandonRequest.setAbandoned( Integer.parseInt( attributeValue ) );
1319                 }
1320                 catch ( NumberFormatException e )
1321                 {
1322                     throw new XmlPullParserException( I18n.err( I18n.ERR_03017 ), xpp, null );
1323                 }
1324             }
1325             else
1326             {
1327                 throw new XmlPullParserException( I18n.err( I18n.ERR_03018 ), xpp, null );
1328             }
1329         }
1330     };
1331 
1332     /**
1333      * GrammarAction that creates an Add Request
1334      */
1335     private final GrammarAction addRequestCreation = new GrammarAction( "Create Add Request" )
1336     {
1337         public void action( Dsmlv2Container container ) throws XmlPullParserException
1338         {
1339             AddRequestDsml addRequest = new AddRequestDsml( codec, new AddRequestImpl() );
1340             container.getBatchRequest().addRequest( addRequest );
1341 
1342             XmlPullParser xpp = container.getParser();
1343 
1344             // Checking and adding the request's attributes
1345             String attributeValue;
1346             // requestID
1347             attributeValue = xpp.getAttributeValue( "", "requestID" );
1348             if ( attributeValue != null )
1349             {
1350                 addRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1351             }
1352             else
1353             {
1354                 if ( ParserUtils.isRequestIdNeeded( container ) )
1355                 {
1356                     throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
1357                 }
1358             }
1359             // dn
1360             attributeValue = xpp.getAttributeValue( "", "dn" );
1361             if ( attributeValue != null )
1362             {
1363                 try
1364                 {
1365                     addRequest.setEntryDn( new Dn( attributeValue ) );
1366                 }
1367                 catch ( LdapInvalidDnException e )
1368                 {
1369                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
1370                 }
1371             }
1372             else
1373             {
1374                 throw new XmlPullParserException( I18n.err( I18n.ERR_03019 ), xpp, null );
1375             }
1376         }
1377     };
1378 
1379     /**
1380      * GrammarAction that adds an attribute to an Add Request
1381      */
1382     private final GrammarAction addRequestAddAttribute = new GrammarAction( "Add Attribute to Add Request" )
1383     {
1384         public void action( Dsmlv2Container container ) throws XmlPullParserException
1385         {
1386             AddRequestDsml addRequest = ( AddRequestDsml )
1387                 container.getBatchRequest().getCurrentRequest();
1388 
1389             XmlPullParser xpp = container.getParser();
1390 
1391             // Checking and adding the request's attributes
1392             String attributeValue;
1393             // name
1394             attributeValue = xpp.getAttributeValue( "", "name" );
1395 
1396             if ( attributeValue != null )
1397             {
1398                 try
1399                 {
1400                     addRequest.addAttributeType( attributeValue );
1401                 }
1402                 catch ( LdapException e )
1403                 {
1404                     throw new XmlPullParserException( I18n.err( I18n.ERR_03020 ), xpp, e );
1405                 }
1406             }
1407             else
1408             {
1409                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
1410             }
1411         }
1412     };
1413 
1414     /**
1415      * GrammarAction that adds a Value to an Attribute of an Add Request
1416      */
1417     private final GrammarAction addRequestAddValue = new GrammarAction( "Add Value to Attribute" )
1418     {
1419         public void action( Dsmlv2Container container ) throws XmlPullParserException
1420         {
1421             AddRequestDsml addRequest = ( AddRequestDsml )
1422                 container.getBatchRequest().getCurrentRequest();
1423 
1424             XmlPullParser xpp = container.getParser();
1425 
1426             try
1427             {
1428                 // We have to catch the type Attribute Value before going to the next Text node
1429                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1430 
1431                 // Getting the value
1432                 String nextText = xpp.nextText();
1433                 if ( !nextText.equals( "" ) )
1434                 {
1435                     try
1436                     {
1437                         if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1438                         {
1439                             addRequest.addAttributeValue( Base64.decode( nextText.trim().toCharArray() ) );
1440                         }
1441                         else
1442                         {
1443                             addRequest.addAttributeValue( nextText.trim() );
1444                         }
1445                     }
1446                     catch ( LdapException le )
1447                     {
1448                         throw new XmlPullParserException( le.getMessage() );
1449                     }
1450                 }
1451             }
1452             catch ( IOException e )
1453             {
1454                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
1455             }
1456         }
1457     };
1458 
1459     /**
1460      * GrammarAction that creates an Auth Request
1461      */
1462     private final GrammarAction authRequestCreation = new GrammarAction( "Create Auth Request" )
1463     {
1464         public void action( Dsmlv2Container container ) throws XmlPullParserException
1465         {
1466             BindRequestDsml authRequest = new BindRequestDsml( codec, new BindRequestImpl() );
1467             container.getBatchRequest().addRequest( authRequest );
1468 
1469             authRequest.setSimple( true );
1470             authRequest.setVersion3( true );
1471 
1472             XmlPullParser xpp = container.getParser();
1473 
1474             // Checking and adding the request's attributes
1475             String attributeValue;
1476             // requestID
1477             attributeValue = xpp.getAttributeValue( "", "requestID" );
1478 
1479             if ( attributeValue != null )
1480             {
1481                 authRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1482             }
1483             else
1484             {
1485                 if ( ParserUtils.isRequestIdNeeded( container ) )
1486                 {
1487                     throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
1488                 }
1489             }
1490             // principal
1491             attributeValue = xpp.getAttributeValue( "", "principal" );
1492 
1493             if ( attributeValue != null )
1494             {
1495                 authRequest.setName( attributeValue );
1496             }
1497             else
1498             {
1499                 throw new XmlPullParserException( I18n.err( I18n.ERR_03021 ), xpp, null );
1500             }
1501         }
1502     };
1503 
1504     /**
1505      * GrammarAction that creates an Compare Request
1506      */
1507     private final GrammarAction compareRequestCreation = new GrammarAction( "Create Compare Request" )
1508     {
1509         public void action( Dsmlv2Container container ) throws XmlPullParserException
1510         {
1511             CompareRequestDsml compareRequest = new CompareRequestDsml( codec, new CompareRequestImpl() );
1512             container.getBatchRequest().addRequest( compareRequest );
1513 
1514             XmlPullParser xpp = container.getParser();
1515 
1516             // Checking and adding the request's attributes
1517             String attributeValue;
1518             // requestID
1519             attributeValue = xpp.getAttributeValue( "", "requestID" );
1520 
1521             if ( attributeValue != null )
1522             {
1523                 compareRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1524             }
1525             else
1526             {
1527                 if ( ParserUtils.isRequestIdNeeded( container ) )
1528                 {
1529                     throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
1530                 }
1531             }
1532 
1533             // dn
1534             attributeValue = xpp.getAttributeValue( "", "dn" );
1535 
1536             if ( attributeValue != null )
1537             {
1538                 try
1539                 {
1540                     compareRequest.setName( new Dn( attributeValue ) );
1541                 }
1542                 catch ( LdapInvalidDnException e )
1543                 {
1544                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
1545                 }
1546             }
1547             else
1548             {
1549                 throw new XmlPullParserException( I18n.err( I18n.ERR_03019 ), xpp, null );
1550             }
1551         }
1552     };
1553 
1554     /**
1555      * GrammarAction that adds an Assertion to a Compare Request
1556      */
1557     private final GrammarAction compareRequestAddAssertion = new GrammarAction( "Add Assertion to Compare Request" )
1558     {
1559         public void action( Dsmlv2Container container ) throws XmlPullParserException
1560         {
1561             CompareRequest compareRequest = ( CompareRequest ) container.getBatchRequest().getCurrentRequest();
1562 
1563             XmlPullParser xpp = container.getParser();
1564 
1565             // Checking and adding the request's attributes
1566             String attributeId;
1567 
1568             // name
1569             attributeId = xpp.getAttributeValue( "", "name" );
1570 
1571             if ( attributeId != null )
1572             {
1573                 compareRequest.setAttributeId( attributeId );
1574             }
1575             else
1576             {
1577                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
1578             }
1579         }
1580     };
1581 
1582     /**
1583      * GrammarAction that adds a Value to a Compare Request
1584      */
1585     private final GrammarAction compareRequestAddValue = new GrammarAction( "Add Value to Compare Request" )
1586     {
1587         public void action( Dsmlv2Container container ) throws XmlPullParserException
1588         {
1589             CompareRequest compareRequest = ( CompareRequest ) container.getBatchRequest().getCurrentRequest();
1590 
1591             XmlPullParser xpp = container.getParser();
1592 
1593             try
1594             {
1595                 // We have to catch the type Attribute Value before going to the next Text node
1596                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1597 
1598                 // Getting the value
1599                 String nextText = xpp.nextText();
1600 
1601                 if ( !nextText.equals( "" ) )
1602                 {
1603                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1604                     {
1605                         compareRequest.setAssertionValue( Base64.decode( nextText.trim().toCharArray() ) );
1606                     }
1607                     else
1608                     {
1609                         compareRequest.setAssertionValue( nextText.trim() );
1610                     }
1611                 }
1612             }
1613             catch ( IOException e )
1614             {
1615                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
1616             }
1617         }
1618     };
1619 
1620     /**
1621      * GrammarAction that creates a Del Request
1622      */
1623     private final GrammarAction delRequestCreation = new GrammarAction( "Create Del Request" )
1624     {
1625         public void action( Dsmlv2Container container ) throws XmlPullParserException
1626         {
1627             DelRequestDsml delRequest = new DelRequestDsml( codec, new DeleteRequestImpl() );
1628             container.getBatchRequest().addRequest( delRequest );
1629 
1630             XmlPullParser xpp = container.getParser();
1631 
1632             // Checking and adding the request's attributes
1633             String attributeValue;
1634             // requestID
1635             attributeValue = xpp.getAttributeValue( "", "requestID" );
1636 
1637             if ( attributeValue != null )
1638             {
1639                 delRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1640             }
1641             else
1642             {
1643                 if ( ParserUtils.isRequestIdNeeded( container ) )
1644                 {
1645                     throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
1646                 }
1647             }
1648 
1649             // dn
1650             attributeValue = xpp.getAttributeValue( "", "dn" );
1651 
1652             if ( attributeValue != null )
1653             {
1654                 try
1655                 {
1656                     delRequest.setName( new Dn( attributeValue ) );
1657                 }
1658                 catch ( LdapInvalidDnException e )
1659                 {
1660                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
1661                 }
1662             }
1663             else
1664             {
1665                 throw new XmlPullParserException( I18n.err( I18n.ERR_03019 ), xpp, null );
1666             }
1667         }
1668     };
1669 
1670     /**
1671      * GrammarAction that creates an Extended Request
1672      */
1673     private final GrammarAction extendedRequestCreation = new GrammarAction( "Create Extended Request" )
1674     {
1675         public void action( Dsmlv2Container container ) throws XmlPullParserException
1676         {
1677             ExtendedRequestDsml<?, ?> extendedRequest =
1678                 new ExtendedRequestDsml<ExtendedRequest, ExtendedResponse>( codec,
1679                     new ExtendedRequestImpl() );
1680             container.getBatchRequest().addRequest( extendedRequest );
1681 
1682             XmlPullParser xpp = container.getParser();
1683 
1684             // Checking and adding the request's attributes
1685             String attributeValue;
1686             // requestID
1687             attributeValue = xpp.getAttributeValue( "", "requestID" );
1688 
1689             if ( attributeValue != null )
1690             {
1691                 extendedRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1692             }
1693             else
1694             {
1695                 if ( ParserUtils.isRequestIdNeeded( container ) )
1696                 {
1697                     throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
1698                 }
1699             }
1700         }
1701     };
1702 
1703     /**
1704      * GrammarAction that adds a Name to an Extended Request
1705      */
1706     private final GrammarAction extendedRequestAddName = new GrammarAction( "Add Name to Extended Request" )
1707     {
1708         public void action( Dsmlv2Container container ) throws XmlPullParserException
1709         {
1710             ExtendedRequestDsml<?, ?> extendedRequest = ( ExtendedRequestDsml<?, ?> )
1711                 container.getBatchRequest().getCurrentRequest();
1712 
1713             XmlPullParser xpp = container.getParser();
1714 
1715             try
1716             {
1717                 String nextText = xpp.nextText();
1718 
1719                 if ( nextText.equals( "" ) )
1720                 {
1721                     throw new XmlPullParserException( I18n.err( I18n.ERR_03022 ), xpp, null );
1722                 }
1723                 else
1724                 {
1725                     String oid = nextText.trim();
1726 
1727                     if ( Oid.isOid( oid ) )
1728                     {
1729                         extendedRequest.setRequestName( nextText.trim() );
1730                     }
1731                     else
1732                     {
1733                         throw new XmlPullParserException( "Bad oid : " + oid, xpp, null );
1734                     }
1735                 }
1736             }
1737             catch ( IOException e )
1738             {
1739                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
1740             }
1741         }
1742     };
1743 
1744     /**
1745      * GrammarAction that adds a Value to an Extended Request
1746      */
1747     private final GrammarAction extendedRequestAddValue = new GrammarAction( "Add Value to Extended Request" )
1748     {
1749         public void action( Dsmlv2Container container ) throws XmlPullParserException
1750         {
1751             ExtendedRequestDsml<?, ?> extendedRequest = ( ExtendedRequestDsml<?, ?> )
1752                 container.getBatchRequest().getCurrentRequest();
1753 
1754             XmlPullParser xpp = container.getParser();
1755 
1756             try
1757             {
1758                 // We have to catch the type Attribute Value before going to the next Text node
1759                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1760 
1761                 // Getting the value
1762                 String nextText = xpp.nextText();
1763 
1764                 if ( !nextText.equals( "" ) )
1765                 {
1766                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1767                     {
1768                         extendedRequest.setRequestValue( Base64.decode( nextText.trim().toCharArray() ) );
1769                     }
1770                     else
1771                     {
1772                         extendedRequest.setRequestValue( nextText.trim().getBytes() );
1773                     }
1774                 }
1775             }
1776             catch ( IOException e )
1777             {
1778                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
1779             }
1780         }
1781     };
1782 
1783     /**
1784      * GrammarAction that creates a Modify Dn Request
1785      */
1786     private final GrammarAction modDNRequestCreation = new GrammarAction( "Create Modify Dn Request" )
1787     {
1788         public void action( Dsmlv2Container container ) throws XmlPullParserException
1789         {
1790             ModifyDNRequestDsml modifyDNRequest = new ModifyDNRequestDsml( codec, new ModifyDnRequestImpl() );
1791             container.getBatchRequest().addRequest( modifyDNRequest );
1792 
1793             XmlPullParser xpp = container.getParser();
1794 
1795             // Checking and adding the request's attributes
1796             String attributeValue;
1797             // requestID
1798             attributeValue = xpp.getAttributeValue( "", "requestID" );
1799 
1800             if ( attributeValue != null )
1801             {
1802                 modifyDNRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1803             }
1804             else
1805             {
1806                 if ( ParserUtils.isRequestIdNeeded( container ) )
1807                 {
1808                     throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
1809                 }
1810             }
1811 
1812             // dn
1813             attributeValue = xpp.getAttributeValue( "", "dn" );
1814 
1815             if ( attributeValue != null )
1816             {
1817                 try
1818                 {
1819                     modifyDNRequest.setName( new Dn( attributeValue ) );
1820                 }
1821                 catch ( LdapInvalidDnException e )
1822                 {
1823                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
1824                 }
1825             }
1826             else
1827             {
1828                 throw new XmlPullParserException( I18n.err( I18n.ERR_03019 ), xpp, null );
1829             }
1830 
1831             // newrdn
1832             attributeValue = xpp.getAttributeValue( "", "newrdn" );
1833 
1834             if ( attributeValue != null )
1835             {
1836                 try
1837                 {
1838                     modifyDNRequest.setNewRdn( new Rdn( attributeValue ) );
1839                 }
1840                 catch ( LdapInvalidDnException e )
1841                 {
1842                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
1843                 }
1844             }
1845             else
1846             {
1847                 throw new XmlPullParserException( I18n.err( I18n.ERR_03023 ), xpp, null );
1848             }
1849 
1850             // deleteoldrdn
1851             attributeValue = xpp.getAttributeValue( "", "deleteoldrdn" );
1852 
1853             if ( attributeValue != null )
1854             {
1855                 if ( ( attributeValue.equalsIgnoreCase( "true" ) ) || ( attributeValue.equals( "1" ) ) )
1856                 {
1857                     modifyDNRequest.setDeleteOldRdn( true );
1858                 }
1859                 else if ( ( attributeValue.equalsIgnoreCase( "false" ) ) || ( attributeValue.equals( "0" ) ) )
1860                 {
1861                     modifyDNRequest.setDeleteOldRdn( false );
1862                 }
1863                 else
1864                 {
1865                     throw new XmlPullParserException( I18n.err( I18n.ERR_03024 ), xpp, null );
1866                 }
1867             }
1868             else
1869             {
1870                 modifyDNRequest.setDeleteOldRdn( true );
1871             }
1872 
1873             // newsuperior
1874             attributeValue = xpp.getAttributeValue( "", "newSuperior" );
1875 
1876             if ( attributeValue != null )
1877             {
1878                 try
1879                 {
1880                     modifyDNRequest.setNewSuperior( new Dn( attributeValue ) );
1881                 }
1882                 catch ( LdapInvalidDnException e )
1883                 {
1884                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
1885                 }
1886             }
1887         }
1888     };
1889 
1890     /**
1891      * GrammarAction that creates a Modify Request
1892      */
1893     private final GrammarAction modifyRequestCreation = new GrammarAction( "Create Modify Request" )
1894     {
1895         public void action( Dsmlv2Container container ) throws XmlPullParserException
1896         {
1897             ModifyRequestDsml modifyRequest = new ModifyRequestDsml( codec, new ModifyRequestImpl() );
1898             container.getBatchRequest().addRequest( modifyRequest );
1899 
1900             XmlPullParser xpp = container.getParser();
1901 
1902             // Checking and adding the request's attributes
1903             String attributeValue;
1904             // requestID
1905             attributeValue = xpp.getAttributeValue( "", "requestID" );
1906 
1907             if ( attributeValue != null )
1908             {
1909                 modifyRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1910             }
1911             else
1912             {
1913                 if ( ParserUtils.isRequestIdNeeded( container ) )
1914                 {
1915                     throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
1916                 }
1917             }
1918 
1919             // dn
1920             attributeValue = xpp.getAttributeValue( "", "dn" );
1921 
1922             if ( attributeValue != null )
1923             {
1924                 try
1925                 {
1926                     modifyRequest.setName( new Dn( attributeValue ) );
1927                 }
1928                 catch ( LdapInvalidDnException e )
1929                 {
1930                     throw new XmlPullParserException( "" + e.getLocalizedMessage(), xpp, null );
1931                 }
1932             }
1933             else
1934             {
1935                 throw new XmlPullParserException( "dn attribute is required", xpp, null );
1936             }
1937         }
1938     };
1939 
1940     /**
1941      * GrammarAction that adds a Modification to a Modify Request
1942      */
1943     private final GrammarAction modifyRequestAddModification = new GrammarAction( "Adds Modification to Modify Request" )
1944     {
1945         public void action( Dsmlv2Container container ) throws XmlPullParserException
1946         {
1947             ModifyRequestDsml modifyRequest = ( ModifyRequestDsml )
1948                 container.getBatchRequest().getCurrentRequest();
1949 
1950             XmlPullParser xpp = container.getParser();
1951 
1952             // Checking and adding the request's attributes
1953             String attributeValue;
1954             // operation
1955             attributeValue = xpp.getAttributeValue( "", "operation" );
1956 
1957             if ( attributeValue != null )
1958             {
1959                 if ( "add".equals( attributeValue ) )
1960                 {
1961                     modifyRequest.setCurrentOperation( LdapConstants.OPERATION_ADD );
1962                 }
1963                 else if ( "delete".equals( attributeValue ) )
1964                 {
1965                     modifyRequest.setCurrentOperation( LdapConstants.OPERATION_DELETE );
1966                 }
1967                 else if ( "replace".equals( attributeValue ) )
1968                 {
1969                     modifyRequest.setCurrentOperation( LdapConstants.OPERATION_REPLACE );
1970                 }
1971                 else
1972                 {
1973                     throw new XmlPullParserException(
1974                         "unknown operation. Operation can be 'add', 'delete' or 'replace'.", xpp, null );
1975                 }
1976             }
1977             else
1978             {
1979                 throw new XmlPullParserException( I18n.err( I18n.ERR_03025 ), xpp, null );
1980             }
1981 
1982             // name
1983             attributeValue = xpp.getAttributeValue( "", "name" );
1984 
1985             if ( attributeValue != null )
1986             {
1987                 modifyRequest.addAttributeTypeAndValues( attributeValue );
1988             }
1989             else
1990             {
1991                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
1992             }
1993         }
1994     };
1995 
1996     /**
1997      * GrammarAction that adds a Value to a Modification of a Modify Request
1998      */
1999     private final GrammarAction modifyRequestAddValue = new GrammarAction(
2000         "Add Value to Modification of Modify Request" )
2001     {
2002         public void action( Dsmlv2Container container ) throws XmlPullParserException
2003         {
2004             ModifyRequestDsml modifyRequest = ( ModifyRequestDsml )
2005                 container.getBatchRequest().getCurrentRequest();
2006 
2007             XmlPullParser xpp = container.getParser();
2008 
2009             try
2010             {
2011                 // We have to catch the type Attribute Value before going to the next Text node
2012                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
2013 
2014                 // Getting the value
2015                 String nextText = xpp.nextText();
2016                 // We are testing if nextText equals "" since a modification can be "".
2017 
2018                 try
2019                 {
2020                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
2021                     {
2022                         modifyRequest.addAttributeValue( Base64.decode( nextText.trim().toCharArray() ) );
2023                     }
2024                     else
2025                     {
2026                         modifyRequest.addAttributeValue( nextText.trim() );
2027                     }
2028                 }
2029                 catch ( LdapException le )
2030                 {
2031                     throw new XmlPullParserException( le.getMessage() );
2032                 }
2033             }
2034             catch ( IOException e )
2035             {
2036                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
2037             }
2038         }
2039     };
2040 
2041     /**
2042      * GrammarAction that creates a Search Request
2043      */
2044     private final GrammarAction searchRequestCreation = new GrammarAction( "Create Search Request" )
2045     {
2046         public void action( Dsmlv2Container container ) throws XmlPullParserException
2047         {
2048             SearchRequestDsml searchRequest = new SearchRequestDsml( codec, new SearchRequestImpl() );
2049             container.getBatchRequest().addRequest( searchRequest );
2050 
2051             XmlPullParser xpp = container.getParser();
2052 
2053             // Checking and adding the request's attributes
2054             String attributeValue;
2055             // requestID
2056             attributeValue = xpp.getAttributeValue( "", "requestID" );
2057 
2058             if ( attributeValue != null )
2059             {
2060                 searchRequest.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
2061             }
2062             else
2063             {
2064                 if ( ParserUtils.isRequestIdNeeded( container ) )
2065                 {
2066                     throw new XmlPullParserException( I18n.err( I18n.ERR_03016 ), xpp, null );
2067                 }
2068             }
2069 
2070             // dn
2071             attributeValue = xpp.getAttributeValue( "", "dn" );
2072 
2073             if ( attributeValue != null )
2074             {
2075                 try
2076                 {
2077                     searchRequest.setBase( new Dn( attributeValue ) );
2078                 }
2079                 catch ( LdapInvalidDnException e )
2080                 {
2081                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
2082                 }
2083             }
2084             else
2085             {
2086                 throw new XmlPullParserException( I18n.err( I18n.ERR_03019 ), xpp, null );
2087             }
2088 
2089             // scope
2090             attributeValue = xpp.getAttributeValue( "", "scope" );
2091 
2092             if ( attributeValue != null )
2093             {
2094                 if ( "baseObject".equals( attributeValue ) )
2095                 {
2096                     searchRequest.setScope( SearchScope.OBJECT );
2097                 }
2098                 else if ( "singleLevel".equals( attributeValue ) )
2099                 {
2100                     searchRequest.setScope( SearchScope.ONELEVEL );
2101                 }
2102                 else if ( "wholeSubtree".equals( attributeValue ) )
2103                 {
2104                     searchRequest.setScope( SearchScope.SUBTREE );
2105                 }
2106                 else
2107                 {
2108                     throw new XmlPullParserException( I18n.err( I18n.ERR_03026 ), xpp, null );
2109                 }
2110             }
2111             else
2112             {
2113                 throw new XmlPullParserException( I18n.err( I18n.ERR_03027 ), xpp, null );
2114             }
2115 
2116             // derefAliases
2117             attributeValue = xpp.getAttributeValue( "", "derefAliases" );
2118 
2119             if ( attributeValue != null )
2120             {
2121                 if ( "neverDerefAliases".equals( attributeValue ) )
2122                 {
2123                     searchRequest.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
2124                 }
2125                 else if ( "derefInSearching".equals( attributeValue ) )
2126                 {
2127                     searchRequest.setDerefAliases( AliasDerefMode.DEREF_IN_SEARCHING );
2128                 }
2129                 else if ( "derefFindingBaseObj".equals( attributeValue ) )
2130                 {
2131                     searchRequest.setDerefAliases( AliasDerefMode.DEREF_FINDING_BASE_OBJ );
2132                 }
2133                 else if ( "derefAlways".equals( attributeValue ) )
2134                 {
2135                     searchRequest.setDerefAliases( AliasDerefMode.DEREF_ALWAYS );
2136                 }
2137                 else
2138                 {
2139                     throw new XmlPullParserException( I18n.err( I18n.ERR_03028 ), xpp, null );
2140                 }
2141             }
2142             else
2143             {
2144                 throw new XmlPullParserException( I18n.err( I18n.ERR_03029 ), xpp, null );
2145             }
2146 
2147             // sizeLimit
2148             attributeValue = xpp.getAttributeValue( "", "sizeLimit" );
2149 
2150             if ( attributeValue != null )
2151             {
2152                 try
2153                 {
2154                     searchRequest.setSizeLimit( Long.parseLong( attributeValue ) );
2155                 }
2156                 catch ( NumberFormatException e )
2157                 {
2158                     throw new XmlPullParserException( I18n.err( I18n.ERR_03030 ), xpp, null );
2159                 }
2160             }
2161             else
2162             {
2163                 searchRequest.setSizeLimit( 0L );
2164             }
2165 
2166             // timeLimit
2167             attributeValue = xpp.getAttributeValue( "", "timeLimit" );
2168 
2169             if ( attributeValue != null )
2170             {
2171                 try
2172                 {
2173                     searchRequest.setTimeLimit( Integer.parseInt( attributeValue ) );
2174                 }
2175                 catch ( NumberFormatException e )
2176                 {
2177                     throw new XmlPullParserException( I18n.err( I18n.ERR_03031 ), xpp, null );
2178                 }
2179             }
2180             else
2181             {
2182                 searchRequest.setTimeLimit( 0 );
2183             }
2184 
2185             // typesOnly
2186             attributeValue = xpp.getAttributeValue( "", "typesOnly" );
2187 
2188             if ( attributeValue != null )
2189             {
2190                 if ( ( attributeValue.equals( "true" ) ) || ( attributeValue.equals( "1" ) ) )
2191                 {
2192                     searchRequest.setTypesOnly( true );
2193                 }
2194                 else if ( ( attributeValue.equals( "false" ) ) || ( attributeValue.equals( "0" ) ) )
2195                 {
2196                     searchRequest.setTypesOnly( false );
2197                 }
2198                 else
2199                 {
2200                     throw new XmlPullParserException( I18n.err( I18n.ERR_03032 ), xpp, null );
2201                 }
2202             }
2203             else
2204             {
2205                 searchRequest.setTypesOnly( false );
2206             }
2207         }
2208     };
2209 
2210     /**
2211      * GrammarAction that adds an Attribute to a Search Request
2212      */
2213     private final GrammarAction searchRequestAddAttribute = new GrammarAction(
2214         "Add Value to Modification of Modify Request" )
2215     {
2216         public void action( Dsmlv2Container container ) throws XmlPullParserException
2217         {
2218             SearchRequest searchRequest = ( SearchRequest ) container.getBatchRequest().getCurrentRequest();
2219 
2220             XmlPullParser xpp = container.getParser();
2221 
2222             // Checking and adding the request's attribute name
2223             String attributeName = xpp.getAttributeValue( "", "name" );
2224 
2225             if ( attributeName != null )
2226             {
2227                 searchRequest.addAttributes( attributeName );
2228             }
2229             else
2230             {
2231                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
2232             }
2233         }
2234     };
2235 
2236     /**
2237      * GrammarAction that create a Substring Filter
2238      */
2239     private final GrammarAction substringsFilterCreation = new GrammarAction( "Create Substring Filter" )
2240     {
2241         public void action( Dsmlv2Container container ) throws XmlPullParserException
2242         {
2243             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2244                 container.getBatchRequest().getCurrentRequest();
2245 
2246             XmlPullParser xpp = container.getParser();
2247 
2248             SubstringFilter filter = new SubstringFilter();
2249 
2250             // Adding the filter to the Search Filter
2251             try
2252             {
2253                 searchRequestDecorator.addCurrentFilter( filter );
2254             }
2255             catch ( DecoderException e )
2256             {
2257                 throw new XmlPullParserException( e.getMessage(), xpp, null );
2258             }
2259 
2260             searchRequestDecorator.setTerminalFilter( filter );
2261 
2262             // Checking and adding the filter's attributes
2263             String attributeValue;
2264             // name
2265             attributeValue = xpp.getAttributeValue( "", "name" );
2266 
2267             if ( attributeValue != null )
2268             {
2269                 filter.setType( attributeValue );
2270             }
2271             else
2272             {
2273                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
2274             }
2275         }
2276     };
2277 
2278     /**
2279      * GrammarAction that sets the Initial value to a Substring Filter
2280      */
2281     private final GrammarAction substringsFilterSetInitial = new GrammarAction( "Set Initial value to Substring Filter" )
2282     {
2283         public void action( Dsmlv2Container container ) throws XmlPullParserException
2284         {
2285             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2286                 container.getBatchRequest().getCurrentRequest();
2287 
2288             SubstringFilter substringFilter = ( SubstringFilter )
2289                 searchRequestDecorator.getTerminalFilter();
2290 
2291             XmlPullParser xpp = container.getParser();
2292 
2293             try
2294             {
2295                 // We have to catch the type Attribute Value before going to the next Text node
2296                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
2297 
2298                 // Getting the value
2299                 String nextText = xpp.nextText();
2300 
2301                 if ( !nextText.equals( "" ) )
2302                 {
2303                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
2304                     {
2305                         substringFilter
2306                             .setInitialSubstrings( new String( Base64.decode( nextText.trim().toCharArray() ) ) );
2307                     }
2308                     else
2309                     {
2310                         substringFilter.setInitialSubstrings( nextText.trim() );
2311                     }
2312                 }
2313             }
2314             catch ( IOException e )
2315             {
2316                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
2317             }
2318         }
2319     };
2320 
2321     /**
2322      * GrammarAction that adds a Any value to a Substring Filter
2323      */
2324     private final GrammarAction substringsFilterAddAny = new GrammarAction( "Add Any value to Substring Filter" )
2325     {
2326         public void action( Dsmlv2Container container ) throws XmlPullParserException
2327         {
2328             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2329                 container.getBatchRequest().getCurrentRequest();
2330 
2331             SubstringFilter substringFilter = ( SubstringFilter ) searchRequestDecorator.getTerminalFilter();
2332 
2333             XmlPullParser xpp = container.getParser();
2334 
2335             try
2336             {
2337                 // We have to catch the type Attribute Value before going to the next Text node
2338                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
2339 
2340                 // Getting the value
2341                 String nextText = xpp.nextText();
2342 
2343                 if ( !nextText.equals( "" ) )
2344                 {
2345                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
2346                     {
2347                         substringFilter.addAnySubstrings( new String( Base64.decode( nextText.trim().toCharArray() ) ) );
2348                     }
2349                     else
2350                     {
2351                         substringFilter.addAnySubstrings( nextText.trim() );
2352                     }
2353                 }
2354             }
2355             catch ( IOException e )
2356             {
2357                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
2358             }
2359         }
2360     };
2361 
2362     /**
2363      * GrammarAction that sets the Final value to a Substring Filter
2364      */
2365     private final GrammarAction substringsFilterSetFinal = new GrammarAction( "Set Final value to Substring Filter" )
2366     {
2367         public void action( Dsmlv2Container container ) throws XmlPullParserException
2368         {
2369             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2370                 container.getBatchRequest().getCurrentRequest();
2371 
2372             SubstringFilter substringFilter = ( SubstringFilter ) searchRequestDecorator.getTerminalFilter();
2373 
2374             XmlPullParser xpp = container.getParser();
2375 
2376             try
2377             {
2378                 // We have to catch the type Attribute Value before going to the next Text node
2379                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
2380 
2381                 // Getting the value
2382                 String nextText = xpp.nextText();
2383 
2384                 if ( !nextText.equals( "" ) )
2385                 {
2386                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
2387                     {
2388                         substringFilter
2389                             .setFinalSubstrings( new String( Base64.decode( nextText.trim().toCharArray() ) ) );
2390                     }
2391                     else
2392                     {
2393                         substringFilter.setFinalSubstrings( nextText.trim() );
2394                     }
2395                 }
2396             }
2397             catch ( IOException e )
2398             {
2399                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
2400             }
2401         }
2402     };
2403 
2404     /**
2405      * GrammarAction that closes a Substring Filter
2406      */
2407     private final GrammarAction substringsFilterClose = new GrammarAction( "Close Substring Filter" )
2408     {
2409         public void action( Dsmlv2Container container ) throws XmlPullParserException
2410         {
2411             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2412                 container.getBatchRequest().getCurrentRequest();
2413 
2414             searchRequestDecorator.setTerminalFilter( null );
2415         }
2416     };
2417 
2418     /**
2419      * GrammarAction that create a And Filter
2420      */
2421     private final GrammarAction andFilterCreation = new GrammarAction( "Create And Filter" )
2422     {
2423         public void action( Dsmlv2Container container ) throws XmlPullParserException
2424         {
2425             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2426                 container.getBatchRequest().getCurrentRequest();
2427 
2428             XmlPullParser xpp = container.getParser();
2429 
2430             AndFilter filter = new AndFilter();
2431 
2432             // Adding the filter to the Search Filter
2433             try
2434             {
2435                 searchRequestDecorator.addCurrentFilter( filter );
2436             }
2437             catch ( DecoderException e )
2438             {
2439                 throw new XmlPullParserException( e.getMessage(), xpp, null );
2440             }
2441         }
2442     };
2443 
2444     /**
2445      * GrammarAction that closes a Connector Filter (And, Or, Not)
2446      */
2447     private final GrammarAction connectorFilterClose = new GrammarAction( "Close Connector Filter" )
2448     {
2449         public void action( Dsmlv2Container container ) throws XmlPullParserException
2450         {
2451             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2452                 container.getBatchRequest().getCurrentRequest();
2453 
2454             searchRequestDecorator.endCurrentConnectorFilter();
2455         }
2456     };
2457 
2458     /**
2459      * GrammarAction that create a Or Filter
2460      */
2461     private final GrammarAction orFilterCreation = new GrammarAction( "Create Or Filter" )
2462     {
2463         public void action( Dsmlv2Container container ) throws XmlPullParserException
2464         {
2465             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2466                 container.getBatchRequest().getCurrentRequest();
2467 
2468             XmlPullParser xpp = container.getParser();
2469 
2470             OrFilter filter = new OrFilter();
2471 
2472             // Adding the filter to the Search Filter
2473             try
2474             {
2475                 searchRequestDecorator.addCurrentFilter( filter );
2476             }
2477             catch ( DecoderException e )
2478             {
2479                 throw new XmlPullParserException( e.getMessage(), xpp, null );
2480             }
2481         }
2482     };
2483 
2484     /**
2485      * GrammarAction that create a Not Filter
2486      */
2487     private final GrammarAction notFilterCreation = new GrammarAction( "Create Not Filter" )
2488     {
2489         public void action( Dsmlv2Container container ) throws XmlPullParserException
2490         {
2491             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2492                 container.getBatchRequest().getCurrentRequest();
2493 
2494             XmlPullParser xpp = container.getParser();
2495 
2496             NotFilter filter = new NotFilter();
2497 
2498             // Adding the filter to the Search Filter
2499             try
2500             {
2501                 searchRequestDecorator.addCurrentFilter( filter );
2502             }
2503             catch ( DecoderException e )
2504             {
2505                 throw new XmlPullParserException( e.getMessage(), xpp, null );
2506             }
2507         }
2508     };
2509 
2510     /**
2511      * GrammarAction that create a Equality Match Filter
2512      */
2513     private final GrammarAction equalityMatchFilterCreation = new GrammarAction( "Create Equality Match Filter" )
2514     {
2515         public void action( Dsmlv2Container container ) throws XmlPullParserException
2516         {
2517             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2518                 container.getBatchRequest().getCurrentRequest();
2519 
2520             XmlPullParser xpp = container.getParser();
2521 
2522             AttributeValueAssertion assertion = new AttributeValueAssertion();
2523 
2524             // Checking and adding the filter's attributes
2525             String attributeName = xpp.getAttributeValue( "", "name" );
2526 
2527             if ( attributeName != null )
2528             {
2529                 assertion.setAttributeDesc( attributeName );
2530             }
2531             else
2532             {
2533                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
2534             }
2535 
2536             AttributeValueAssertionFilter filter = new AttributeValueAssertionFilter(
2537                 LdapConstants.EQUALITY_MATCH_FILTER );
2538 
2539             filter.setAssertion( assertion );
2540 
2541             // Adding the filter to the Search Filter
2542             try
2543             {
2544                 searchRequestDecorator.addCurrentFilter( filter );
2545             }
2546             catch ( DecoderException e )
2547             {
2548                 throw new XmlPullParserException( e.getMessage(), xpp, null );
2549             }
2550 
2551             searchRequestDecorator.setTerminalFilter( filter );
2552         }
2553     };
2554 
2555     /**
2556      * GrammarAction that create a Greater Or Equal Filter
2557      */
2558     private final GrammarAction greaterOrEqualFilterCreation = new GrammarAction( "Create Greater Or Equal Filter" )
2559     {
2560         public void action( Dsmlv2Container container ) throws XmlPullParserException
2561         {
2562             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2563                 container.getBatchRequest().getCurrentRequest();
2564 
2565             XmlPullParser xpp = container.getParser();
2566 
2567             AttributeValueAssertion assertion = new AttributeValueAssertion();
2568 
2569             // Checking and adding the filter's attributes
2570             String attributeName = xpp.getAttributeValue( "", "name" );
2571 
2572             if ( attributeName != null )
2573             {
2574                 assertion.setAttributeDesc( attributeName );
2575             }
2576             else
2577             {
2578                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
2579             }
2580 
2581             AttributeValueAssertionFilter filter = new AttributeValueAssertionFilter(
2582                 LdapConstants.GREATER_OR_EQUAL_FILTER );
2583 
2584             filter.setAssertion( assertion );
2585 
2586             // Adding the filter to the Search Filter
2587             try
2588             {
2589                 searchRequestDecorator.addCurrentFilter( filter );
2590             }
2591             catch ( DecoderException e )
2592             {
2593                 throw new XmlPullParserException( e.getMessage(), xpp, null );
2594             }
2595 
2596             searchRequestDecorator.setTerminalFilter( filter );
2597         }
2598     };
2599 
2600     /**
2601      * GrammarAction that create a Less Or Equal Filter
2602      */
2603     private final GrammarAction lessOrEqualFilterCreation = new GrammarAction( "Create Less Or Equal Filter" )
2604     {
2605         public void action( Dsmlv2Container container ) throws XmlPullParserException
2606         {
2607             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2608                 container.getBatchRequest().getCurrentRequest();
2609 
2610             XmlPullParser xpp = container.getParser();
2611 
2612             AttributeValueAssertion assertion = new AttributeValueAssertion();
2613 
2614             // Checking and adding the filter's attributes
2615             String attributeValue;
2616             // name
2617             attributeValue = xpp.getAttributeValue( "", "name" );
2618 
2619             if ( attributeValue != null )
2620             {
2621                 assertion.setAttributeDesc( new String( attributeValue.getBytes() ) );
2622             }
2623             else
2624             {
2625                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
2626             }
2627 
2628             AttributeValueAssertionFilter filter = new AttributeValueAssertionFilter(
2629                 LdapConstants.LESS_OR_EQUAL_FILTER );
2630 
2631             filter.setAssertion( assertion );
2632 
2633             // Adding the filter to the Search Filter
2634             try
2635             {
2636                 searchRequestDecorator.addCurrentFilter( filter );
2637             }
2638             catch ( DecoderException e )
2639             {
2640                 throw new XmlPullParserException( e.getMessage(), xpp, null );
2641             }
2642 
2643             searchRequestDecorator.setTerminalFilter( filter );
2644         }
2645     };
2646 
2647     /**
2648      * GrammarAction that create an Approx Match Filter
2649      */
2650     private final GrammarAction approxMatchFilterCreation = new GrammarAction( "Create Approx Match Filter" )
2651     {
2652         public void action( Dsmlv2Container container ) throws XmlPullParserException
2653         {
2654             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2655                 container.getBatchRequest().getCurrentRequest();
2656 
2657             XmlPullParser xpp = container.getParser();
2658 
2659             AttributeValueAssertion assertion = new AttributeValueAssertion();
2660 
2661             // Checking and adding the filter's attributes
2662             String attributeName = xpp.getAttributeValue( "", "name" );
2663 
2664             if ( attributeName != null )
2665             {
2666                 assertion.setAttributeDesc( attributeName );
2667             }
2668             else
2669             {
2670                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
2671             }
2672 
2673             AttributeValueAssertionFilter filter = new AttributeValueAssertionFilter( LdapConstants.APPROX_MATCH_FILTER );
2674 
2675             filter.setAssertion( assertion );
2676 
2677             // Adding the filter to the Search Filter
2678             try
2679             {
2680                 searchRequestDecorator.addCurrentFilter( filter );
2681             }
2682             catch ( DecoderException e )
2683             {
2684                 throw new XmlPullParserException( e.getMessage(), xpp, null );
2685             }
2686 
2687             searchRequestDecorator.setTerminalFilter( filter );
2688         }
2689     };
2690 
2691     /**
2692      * GrammarAction that adds a Value to a Filter
2693      */
2694     private final GrammarAction filterAddValue = new GrammarAction( "Adds Value to Filter" )
2695     {
2696         public void action( Dsmlv2Container container ) throws XmlPullParserException
2697         {
2698             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2699                 container.getBatchRequest().getCurrentRequest();
2700             AttributeValueAssertionFilter filter = ( AttributeValueAssertionFilter ) searchRequestDecorator
2701                 .getTerminalFilter();
2702             AttributeValueAssertion assertion = filter.getAssertion();
2703 
2704             XmlPullParser xpp = container.getParser();
2705 
2706             try
2707             {
2708                 // We have to catch the type Attribute Value before going to the next Text node
2709                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
2710 
2711                 // Getting the value
2712                 String nextText = xpp.nextText();
2713 
2714                 if ( !nextText.equals( "" ) )
2715                 {
2716                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
2717                     {
2718                         Value<byte[]> value = new BinaryValue( Base64.decode( nextText.trim().toCharArray() ) );
2719                         assertion.setAssertionValue( value );
2720                     }
2721                     else
2722                     {
2723                         Value<String> value = new StringValue( nextText.trim() );
2724                         assertion.setAssertionValue( value );
2725                     }
2726                 }
2727             }
2728             catch ( IOException e )
2729             {
2730                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
2731             }
2732         }
2733     };
2734 
2735     /**
2736      * GrammarAction that creates a Present Filter
2737      */
2738     private final GrammarAction presentFilterCreation = new GrammarAction( "Create Present Filter" )
2739     {
2740         public void action( Dsmlv2Container container ) throws XmlPullParserException
2741         {
2742             PresentFilter presentFilter = new PresentFilter();
2743 
2744             XmlPullParser xpp = container.getParser();
2745 
2746             // Adding the filter to the Search Filter
2747             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2748                 container.getBatchRequest().getCurrentRequest();
2749 
2750             try
2751             {
2752                 searchRequestDecorator.addCurrentFilter( presentFilter );
2753             }
2754             catch ( DecoderException e )
2755             {
2756                 throw new XmlPullParserException( e.getMessage(), xpp, null );
2757             }
2758 
2759             // Checking and adding the filter's attributes
2760             String attributeValue;
2761             // name
2762             attributeValue = xpp.getAttributeValue( "", "name" );
2763 
2764             if ( attributeValue != null )
2765             {
2766                 presentFilter.setAttributeDescription( new String( attributeValue.getBytes() ) );
2767             }
2768             else
2769             {
2770                 throw new XmlPullParserException( "name attribute is required", xpp, null );
2771             }
2772         }
2773     };
2774 
2775     /**
2776      * GrammarAction that store the Filter into the searchRequest
2777      */
2778     private final GrammarAction storeFilter = new GrammarAction( "Store Filter" )
2779     {
2780         public void action( Dsmlv2Container container ) throws XmlPullParserException
2781         {
2782             // Adding the filter to the Search Filter
2783             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2784                 container.getBatchRequest().getCurrentRequest();
2785             SearchRequest searchRequest = searchRequestDecorator.getDecorated();
2786 
2787             if ( searchRequestDecorator.getFilterNode() == null )
2788             {
2789                 throw new IllegalStateException( "No filter element present in the DSML search request" );
2790             }
2791 
2792             searchRequest.setFilter( searchRequestDecorator.getFilterNode() );
2793         }
2794     };
2795 
2796     /**
2797      * GrammarAction that creates an Extensible Match Filter
2798      */
2799     private final GrammarAction extensibleMatchFilterCreation = new GrammarAction( "Create Extensible Match Filter" )
2800     {
2801         public void action( Dsmlv2Container container ) throws XmlPullParserException
2802         {
2803             ExtensibleMatchFilter extensibleMatchFilter = new ExtensibleMatchFilter();
2804 
2805             XmlPullParser xpp = container.getParser();
2806 
2807             // Adding the filter to the Search Filter
2808             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2809                 container.getBatchRequest().getCurrentRequest();
2810 
2811             try
2812             {
2813                 searchRequestDecorator.addCurrentFilter( extensibleMatchFilter );
2814             }
2815             catch ( DecoderException e )
2816             {
2817                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
2818             }
2819 
2820             searchRequestDecorator.setTerminalFilter( extensibleMatchFilter );
2821 
2822             // Checking and adding the filter's attributes
2823             String attributeValue;
2824             // dnAttributes
2825             attributeValue = xpp.getAttributeValue( "", "dnAttributes" );
2826 
2827             if ( attributeValue != null )
2828             {
2829                 if ( ( attributeValue.equals( "true" ) ) || ( attributeValue.equals( "1" ) ) )
2830                 {
2831                     extensibleMatchFilter.setDnAttributes( true );
2832                 }
2833                 else if ( ( attributeValue.equals( "false" ) ) || ( attributeValue.equals( "0" ) ) )
2834                 {
2835                     extensibleMatchFilter.setDnAttributes( false );
2836                 }
2837                 else
2838                 {
2839                     throw new XmlPullParserException( I18n.err( I18n.ERR_03033 ), xpp, null );
2840                 }
2841             }
2842             else
2843             {
2844                 extensibleMatchFilter.setDnAttributes( false );
2845             }
2846 
2847             // matchingRule
2848             attributeValue = xpp.getAttributeValue( "", "matchingRule" );
2849 
2850             if ( attributeValue != null )
2851             {
2852                 extensibleMatchFilter.setMatchingRule( attributeValue );
2853             }
2854 
2855             // name
2856             attributeValue = xpp.getAttributeValue( "", "name" );
2857 
2858             if ( attributeValue != null )
2859             {
2860                 extensibleMatchFilter.setType( attributeValue );
2861             }
2862         }
2863     };
2864 
2865     /**
2866      * GrammarAction that adds a Value to an Extensible Match Filter
2867      */
2868     private final GrammarAction extensibleMatchAddValue = new GrammarAction( "Adds Value to Extensible MatchFilter" )
2869     {
2870         public void action( Dsmlv2Container container ) throws XmlPullParserException
2871         {
2872             SearchRequestDsml searchRequestDecorator = ( SearchRequestDsml )
2873                 container.getBatchRequest().getCurrentRequest();
2874             ExtensibleMatchFilter filter = ( ExtensibleMatchFilter ) searchRequestDecorator.getTerminalFilter();
2875 
2876             XmlPullParser xpp = container.getParser();
2877 
2878             try
2879             {
2880                 // We have to catch the type Attribute Value before going to the next Text node
2881                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
2882 
2883                 // Getting the value
2884                 String nextText = xpp.nextText();
2885                 if ( !nextText.equals( "" ) )
2886                 {
2887                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
2888                     {
2889                         filter.setMatchValue( new BinaryValue( Base64.decode( nextText.trim().toCharArray() ) ) );
2890                     }
2891                     else
2892                     {
2893                         filter.setMatchValue( new StringValue( nextText.trim() ) );
2894                     }
2895                 }
2896             }
2897             catch ( IOException e )
2898             {
2899                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
2900             }
2901         }
2902     };
2903 
2904     /**
2905      * GrammarAction that creates a Control
2906      */
2907     private final GrammarAction controlCreation = new GrammarAction( "Create Control" )
2908     {
2909         public void action( Dsmlv2Container container ) throws XmlPullParserException
2910         {
2911             XmlPullParser xpp = container.getParser();
2912             CodecControl<? extends Control> control;
2913 
2914             // Checking and adding the Control's attributes
2915             String attributeValue;
2916             // TYPE
2917             attributeValue = xpp.getAttributeValue( "", "type" );
2918 
2919             if ( attributeValue != null )
2920             {
2921                 if ( !Oid.isOid( attributeValue ) )
2922                 {
2923                     throw new XmlPullParserException( I18n.err( I18n.ERR_03034 ), xpp, null );
2924                 }
2925 
2926                 control = codec.newControl( codec.newControl( attributeValue ) );
2927                 ( ( Request ) container.getBatchRequest().getCurrentRequest() ).addControl( control );
2928             }
2929             else
2930             {
2931                 throw new XmlPullParserException( I18n.err( I18n.ERR_03035 ), xpp, null );
2932             }
2933 
2934             // CRITICALITY
2935             attributeValue = xpp.getAttributeValue( "", "criticality" );
2936 
2937             if ( attributeValue != null )
2938             {
2939                 if ( attributeValue.equals( "true" ) )
2940                 {
2941                     control.setCritical( true );
2942                 }
2943                 else if ( attributeValue.equals( "false" ) )
2944                 {
2945                     control.setCritical( false );
2946                 }
2947                 else
2948                 {
2949                     throw new XmlPullParserException( I18n.err( I18n.ERR_03007 ), xpp, null );
2950                 }
2951             }
2952         }
2953     };
2954 
2955     /**
2956      * GrammarAction that adds a Value to a Control
2957      */
2958     private final GrammarAction controlValueCreation = new GrammarAction( "Add ControlValue to Control" )
2959     {
2960         public void action( Dsmlv2Container container ) throws XmlPullParserException
2961         {
2962             AbstractRequestDsml<? extends Request> request =
2963                 ( AbstractRequestDsml<? extends Request> ) container.getBatchRequest().getCurrentRequest();
2964             DsmlControl<? extends Control> control = request.getCurrentControl();
2965 
2966             XmlPullParser xpp = container.getParser();
2967 
2968             try
2969             {
2970                 // We have to catch the type Attribute Value before going to the next Text node
2971                 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
2972 
2973                 // Getting the value
2974                 String nextText = xpp.nextText();
2975 
2976                 if ( !nextText.equals( "" ) )
2977                 {
2978                     if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
2979                     {
2980                         control.setValue( Base64.decode( nextText.trim().toCharArray() ) );
2981                     }
2982                     else
2983                     {
2984                         control.setValue( nextText.trim().getBytes() );
2985                     }
2986                 }
2987             }
2988             catch ( IOException e )
2989             {
2990                 throw new XmlPullParserException( I18n.err( I18n.ERR_03008, e.getMessage() ), xpp, null );
2991             }
2992         }
2993     };
2994 }