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