KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > dsmlv2 > reponse > Dsmlv2ResponseGrammar


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.ldapstudio.dsmlv2.reponse;
22
23
24 import java.io.IOException JavaDoc;
25 import java.lang.reflect.Array JavaDoc;
26 import java.util.HashMap JavaDoc;
27 import java.util.HashSet JavaDoc;
28 import java.util.Set JavaDoc;
29
30 import javax.naming.InvalidNameException JavaDoc;
31
32 import org.apache.directory.ldapstudio.dsmlv2.AbstractGrammar;
33 import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2Container;
34 import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2StatesEnum;
35 import org.apache.directory.ldapstudio.dsmlv2.GrammarAction;
36 import org.apache.directory.ldapstudio.dsmlv2.GrammarTransition;
37 import org.apache.directory.ldapstudio.dsmlv2.IGrammar;
38 import org.apache.directory.ldapstudio.dsmlv2.ParserUtils;
39 import org.apache.directory.ldapstudio.dsmlv2.Tag;
40 import org.apache.directory.ldapstudio.dsmlv2.reponse.ErrorResponse.ErrorResponseType;
41 import org.apache.directory.shared.asn1.codec.DecoderException;
42 import org.apache.directory.shared.asn1.primitives.OID;
43 import org.apache.directory.shared.ldap.codec.Control;
44 import org.apache.directory.shared.ldap.codec.LdapMessage;
45 import org.apache.directory.shared.ldap.codec.LdapResponse;
46 import org.apache.directory.shared.ldap.codec.LdapResult;
47 import org.apache.directory.shared.ldap.codec.add.AddResponse;
48 import org.apache.directory.shared.ldap.codec.bind.BindResponse;
49 import org.apache.directory.shared.ldap.codec.compare.CompareResponse;
50 import org.apache.directory.shared.ldap.codec.del.DelResponse;
51 import org.apache.directory.shared.ldap.codec.extended.ExtendedResponse;
52 import org.apache.directory.shared.ldap.codec.modify.ModifyResponse;
53 import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNResponse;
54 import org.apache.directory.shared.ldap.codec.search.SearchResultDone;
55 import org.apache.directory.shared.ldap.codec.search.SearchResultEntry;
56 import org.apache.directory.shared.ldap.codec.search.SearchResultReference;
57 import org.apache.directory.shared.ldap.codec.util.LdapURL;
58 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
59 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
60 import org.apache.directory.shared.ldap.name.LdapDN;
61 import org.apache.directory.shared.ldap.util.Base64;
62 import org.xmlpull.v1.XmlPullParser;
63 import org.xmlpull.v1.XmlPullParserException;
64
65
66 /**
67  * This Class represents the DSMLv2 Response Grammar
68  *
69  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
70  * @version $Rev$, $Date$
71  */

72 public class Dsmlv2ResponseGrammar extends AbstractGrammar implements IGrammar
73 {
74     /** The instance of grammar. Dsmlv2ResponseGrammar is a singleton */
75     private static Dsmlv2ResponseGrammar instance = new Dsmlv2ResponseGrammar();
76
77     // Initializing DESCR_TAGS
78
private static Set JavaDoc<String JavaDoc> DSMLV2_DESCR_TAGS = null;
79     static
80     {
81         DSMLV2_DESCR_TAGS = new HashSet JavaDoc<String JavaDoc>();
82         DSMLV2_DESCR_TAGS.add( "success" );
83         DSMLV2_DESCR_TAGS.add( "operationsError" );
84         DSMLV2_DESCR_TAGS.add( "protocolError" );
85         DSMLV2_DESCR_TAGS.add( "timeLimitExceeded" );
86         DSMLV2_DESCR_TAGS.add( "sizeLimitExceeded" );
87         DSMLV2_DESCR_TAGS.add( "compareFalse" );
88         DSMLV2_DESCR_TAGS.add( "compareTrue" );
89         DSMLV2_DESCR_TAGS.add( "authMethodNotSupported" );
90         DSMLV2_DESCR_TAGS.add( "strongAuthRequired" );
91         DSMLV2_DESCR_TAGS.add( "referral" );
92         DSMLV2_DESCR_TAGS.add( "adminLimitExceeded" );
93         DSMLV2_DESCR_TAGS.add( "unavailableCriticalExtension" );
94         DSMLV2_DESCR_TAGS.add( "confidentialityRequired" );
95         DSMLV2_DESCR_TAGS.add( "saslBindInProgress" );
96         DSMLV2_DESCR_TAGS.add( "noSuchAttribute" );
97         DSMLV2_DESCR_TAGS.add( "undefinedAttributeType" );
98         DSMLV2_DESCR_TAGS.add( "inappropriateMatching" );
99         DSMLV2_DESCR_TAGS.add( "constraintViolation" );
100         DSMLV2_DESCR_TAGS.add( "attributeOrValueExists" );
101         DSMLV2_DESCR_TAGS.add( "invalidAttributeSyntax" );
102         DSMLV2_DESCR_TAGS.add( "noSuchObject" );
103         DSMLV2_DESCR_TAGS.add( "aliasProblem" );
104         DSMLV2_DESCR_TAGS.add( "invalidDNSyntax" );
105         DSMLV2_DESCR_TAGS.add( "aliasDereferencingProblem" );
106         DSMLV2_DESCR_TAGS.add( "inappropriateAuthentication" );
107         DSMLV2_DESCR_TAGS.add( "invalidCredentials" );
108         DSMLV2_DESCR_TAGS.add( "insufficientAccessRights" );
109         DSMLV2_DESCR_TAGS.add( "busy" );
110         DSMLV2_DESCR_TAGS.add( "unavailable" );
111         DSMLV2_DESCR_TAGS.add( "unwillingToPerform" );
112         DSMLV2_DESCR_TAGS.add( "loopDetect" );
113         DSMLV2_DESCR_TAGS.add( "namingViolation" );
114         DSMLV2_DESCR_TAGS.add( "objectClassViolation" );
115         DSMLV2_DESCR_TAGS.add( "notAllowedOnNonLeaf" );
116         DSMLV2_DESCR_TAGS.add( "notAllowedOnRDN" );
117         DSMLV2_DESCR_TAGS.add( "entryAlreadyExists" );
118         DSMLV2_DESCR_TAGS.add( "objectClassModsProhibited" );
119         DSMLV2_DESCR_TAGS.add( "affectMultipleDSAs" );
120         DSMLV2_DESCR_TAGS.add( "other" );
121     }
122
123
124     @SuppressWarnings JavaDoc("unchecked")
125     private Dsmlv2ResponseGrammar()
126     {
127         name = Dsmlv2ResponseGrammar.class.getName();
128         statesEnum = Dsmlv2StatesEnum.getInstance();
129
130         // Create the transitions table
131
super.transitions = ( HashMap JavaDoc<Tag, GrammarTransition>[] ) Array.newInstance( HashMap JavaDoc.class, 300 );; // TODO Change this value
132

133         //====================================================
134
// Transitions concerning : BATCH RESPONSE
135
//====================================================
136
super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE] = new HashMap JavaDoc<Tag, GrammarTransition>();
137
138         // ** OPEN BATCH Reponse **
139
// State: [INIT_GRAMMAR_STATE] - Tag: <batchResponse>
140
super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE].put( new Tag( "batchResponse", Tag.START ),
141             new GrammarTransition( Dsmlv2StatesEnum.INIT_GRAMMAR_STATE, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
142                 batchResponseCreation ) );
143
144         //====================================================
145
// Transitions concerning : BATCH RESPONSE LOOP
146
//====================================================
147
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP] = new HashMap JavaDoc<Tag, GrammarTransition>();
148
149         // State: [BATCH_RESPONSE_LOOP] - Tag: <addResponse>
150
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP].put( new Tag( "addResponse", Tag.START ),
151             new GrammarTransition( Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, Dsmlv2StatesEnum.LDAP_RESULT,
152                 addResponseCreation ) );
153
154         // State: [BATCH_RESPONSE_LOOP] - Tag: <authResponse>
155
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP].put( new Tag( "authResponse", Tag.START ),
156             new GrammarTransition( Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, Dsmlv2StatesEnum.LDAP_RESULT,
157                 authResponseCreation ) );
158
159         // State: [BATCH_RESPONSE_LOOP] - Tag: <compareResponse>
160
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP].put( new Tag( "compareResponse", Tag.START ),
161             new GrammarTransition( Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, Dsmlv2StatesEnum.LDAP_RESULT,
162                 compareResponseCreation ) );
163
164         // State: [BATCH_RESPONSE_LOOP] - Tag: <delResponse>
165
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP].put( new Tag( "delResponse", Tag.START ),
166             new GrammarTransition( Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, Dsmlv2StatesEnum.LDAP_RESULT,
167                 delResponseCreation ) );
168
169         // State: [BATCH_RESPONSE_LOOP] - Tag: <modifyResponse>
170
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP].put( new Tag( "modifyResponse", Tag.START ),
171             new GrammarTransition( Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, Dsmlv2StatesEnum.LDAP_RESULT,
172                 modifyResponseCreation ) );
173
174         // State: [BATCH_RESPONSE_LOOP] - Tag: <modDNResponse>
175
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP].put( new Tag( "modDNResponse", Tag.START ),
176             new GrammarTransition( Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, Dsmlv2StatesEnum.LDAP_RESULT,
177                 modDNResponseCreation ) );
178
179         // State: [BATCH_RESPONSE_LOOP] - Tag: <extendedResponse>
180
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP].put( new Tag( "extendedResponse", Tag.START ),
181             new GrammarTransition( Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, Dsmlv2StatesEnum.EXTENDED_RESPONSE,
182                 extendedResponseCreation ) );
183
184         // State: [BATCH_RESPONSE_LOOP] - Tag: <errorResponse>
185
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP].put( new Tag( "errorResponse", Tag.START ),
186             new GrammarTransition( Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, Dsmlv2StatesEnum.ERROR_RESPONSE,
187                 errorResponseCreation ) );
188
189         // State: [BATCH_RESPONSE_LOOP] - Tag: <searchReponse>
190
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP].put( new Tag( "searchResponse", Tag.START ),
191             new GrammarTransition( Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, Dsmlv2StatesEnum.SEARCH_RESPONSE,
192                 searchResponseCreation ) );
193
194         // State: [BATCH_RESPONSE_LOOP] - Tag: </batchResponse>
195
super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP].put( new Tag( "batchResponse", Tag.END ),
196             new GrammarTransition( Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, Dsmlv2StatesEnum.GRAMMAR_END, null ) );
197
198         //====================================================
199
// Transitions concerning : ERROR RESPONSE
200
//====================================================
201
super.transitions[Dsmlv2StatesEnum.ERROR_RESPONSE] = new HashMap JavaDoc<Tag, GrammarTransition>();
202         super.transitions[Dsmlv2StatesEnum.MESSAGE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
203         super.transitions[Dsmlv2StatesEnum.DETAIL_START] = new HashMap JavaDoc<Tag, GrammarTransition>();
204         super.transitions[Dsmlv2StatesEnum.DETAIL_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
205
206         // State: [ERROR_RESPONSE] - Tag: <message>
207
super.transitions[Dsmlv2StatesEnum.ERROR_RESPONSE].put( new Tag( "message", Tag.START ), new GrammarTransition(
208             Dsmlv2StatesEnum.ERROR_RESPONSE, Dsmlv2StatesEnum.MESSAGE_END, errorResponseAddMessage ) );
209
210         // State: [ERROR_RESPONSE] - Tag: <detail>
211
super.transitions[Dsmlv2StatesEnum.ERROR_RESPONSE].put( new Tag( "detail", Tag.START ), new GrammarTransition(
212             Dsmlv2StatesEnum.ERROR_RESPONSE, Dsmlv2StatesEnum.DETAIL_START, errorResponseAddDetail ) );
213
214         // State: [MESSAGE_END] - Tag: </errorResponse>
215
super.transitions[Dsmlv2StatesEnum.MESSAGE_END].put( new Tag( "errorResponse", Tag.END ),
216             new GrammarTransition( Dsmlv2StatesEnum.MESSAGE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
217
218         // State: [MESSAGE_END] - Tag: <detail>
219
super.transitions[Dsmlv2StatesEnum.MESSAGE_END].put( new Tag( "detail", Tag.START ), new GrammarTransition(
220             Dsmlv2StatesEnum.MESSAGE_END, Dsmlv2StatesEnum.DETAIL_START, errorResponseAddDetail ) );
221
222         // State: [DETAIL_START] - Tag: </detail>
223
super.transitions[Dsmlv2StatesEnum.DETAIL_START].put( new Tag( "detail", Tag.END ), new GrammarTransition(
224             Dsmlv2StatesEnum.DETAIL_START, Dsmlv2StatesEnum.DETAIL_END, null ) );
225
226         // State: [DETAIL_END] - Tag: <detail>
227
super.transitions[Dsmlv2StatesEnum.DETAIL_END].put( new Tag( "detail", Tag.END ), new GrammarTransition(
228             Dsmlv2StatesEnum.DETAIL_END, Dsmlv2StatesEnum.DETAIL_END, errorResponseAddDetail ) );
229
230         // State: [ERROR_RESPONSE] - Tag: </errorResponse>
231
super.transitions[Dsmlv2StatesEnum.ERROR_RESPONSE].put( new Tag( "errorResponse", Tag.END ),
232             new GrammarTransition( Dsmlv2StatesEnum.ERROR_RESPONSE, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
233
234         //====================================================
235
// Transitions concerning : EXTENDED RESPONSE
236
//====================================================
237
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE] = new HashMap JavaDoc<Tag, GrammarTransition>();
238         super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_START] = new HashMap JavaDoc<Tag, GrammarTransition>();
239         super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
240         super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_VALUE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
241         super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_START] = new HashMap JavaDoc<Tag, GrammarTransition>();
242         super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
243         super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
244         super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
245         super.transitions[Dsmlv2StatesEnum.RESPONSE_NAME_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
246         super.transitions[Dsmlv2StatesEnum.RESPONSE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
247
248         // State: [EXTENDED_RESPONSE] - Tag: <control>
249
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE].put( new Tag( "control", Tag.START ),
250             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE,
251                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_START, ldapResultControlCreation ) );
252
253         // State: [EXTENDED_RESPONSE_CONTROL_START] - Tag: <controlValue>
254
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_START].put( new Tag( "controlValue", Tag.START ),
255             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_START,
256                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_VALUE_END, ldapResultControlValueCreation ) );
257
258         // State: [EXTENDED_RESPONSE_CONTROL_VALUE_END] - Tag: </control>
259
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_VALUE_END].put( new Tag( "control", Tag.END ),
260             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_VALUE_END,
261                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_END, null ) );
262
263         // State: [EXTENDED_RESPONSE_CONTROL_START] - Tag: </control>
264
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_START].put( new Tag( "control", Tag.END ),
265             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_START,
266                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_END, null ) );
267
268         // State: [EXTENDED_RESPONSE_CONTROL_END] - Tag: <control>
269
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_END].put( new Tag( "control", Tag.START ),
270             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_END,
271                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_START, ldapResultControlCreation ) );
272
273         // State: [EXTENDED_RESPONSE_CONTROL_END] - Tag: <resultCode>
274
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_END].put( new Tag( "resultCode", Tag.START ),
275             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_END,
276                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_START, extendedResponseAddResultCode ) );
277
278         // State: [EXTENDED_RESPONSE] - Tag: <resultCode>
279
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE].put( new Tag( "resultCode", Tag.START ),
280             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE,
281                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_START, extendedResponseAddResultCode ) );
282
283         // State: [EXTENDED_RESPONSE_RESULT_CODE_START] - Tag: </resultCode>
284
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_START].put( new Tag( "resultCode", Tag.END ),
285             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_START,
286                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END, null ) );
287
288         // State: [EXTENDED_RESPONSE_RESULT_CODE_END] - Tag: <errorMessage>
289
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END].put(
290             new Tag( "errorMessage", Tag.START ), new GrammarTransition(
291                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END,
292                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END, extendedResponseAddErrorMessage ) );
293
294         // State: [EXTENDED_RESPONSE_RESULT_CODE_END] - Tag: <referral>
295
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END].put( new Tag( "referral", Tag.START ),
296             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END,
297                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END, extendedResponseAddReferral ) );
298
299         // State: [EXTENDED_RESPONSE_RESULT_CODE_END] - Tag: <responseName>
300
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END].put(
301             new Tag( "responseName", Tag.START ), new GrammarTransition(
302                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END, Dsmlv2StatesEnum.RESPONSE_NAME_END,
303                 extendedResponseAddResponseName ) );
304
305         // State: [EXTENDED_RESPONSE_RESULT_CODE_END] - Tag: <response>
306
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END].put( new Tag( "response", Tag.START ),
307             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END, Dsmlv2StatesEnum.RESPONSE_END,
308                 extendedResponseAddResponse ) );
309
310         // State: [EXTENDED_RESPONSE_RESULT_CODE_END] - Tag: </extendedResponse>
311
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END].put(
312             new Tag( "extendedResponse", Tag.END ), new GrammarTransition(
313                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
314
315         // State: [EXTENDED_RESPONSE_ERROR_MESSAGE_END] - Tag: <referral>
316
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END].put( new Tag( "referral", Tag.START ),
317             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END,
318                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END, extendedResponseAddReferral ) );
319
320         // State: [EXTENDED_RESPONSE_ERROR_MESSAGE_END] - Tag: <responseName>
321
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END].put(
322             new Tag( "responseName", Tag.START ), new GrammarTransition(
323                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END, Dsmlv2StatesEnum.RESPONSE_NAME_END,
324                 extendedResponseAddResponseName ) );
325
326         // State: [EXTENDED_RESPONSE_ERROR_MESSAGE_END] - Tag: <response>
327
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END].put( new Tag( "response", Tag.START ),
328             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END,
329                 Dsmlv2StatesEnum.RESPONSE_END, extendedResponseAddResponse ) );
330
331         // State: [EXTENDED_RESPONSE_ERROR_MESSAGE_END] - Tag: </extendedResponse>
332
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END].put( new Tag( "extendedResponse",
333             Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END,
334             Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
335
336         // State: [EXTENDED_RESPONSE_REFERRAL_END] - Tag: <referral>
337
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END].put( new Tag( "referral", Tag.START ),
338             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END,
339                 Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END, extendedResponseAddReferral ) );
340
341         // State: [EXTENDED_RESPONSE_REFERRAL_END] - Tag: <responseName>
342
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END].put( new Tag( "responseName", Tag.START ),
343             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END,
344                 Dsmlv2StatesEnum.RESPONSE_NAME_END, extendedResponseAddResponseName ) );
345
346         // State: [EXTENDED_RESPONSE_REFERRAL_END] - Tag: <reponse>
347
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END].put( new Tag( "reponse", Tag.START ),
348             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END, Dsmlv2StatesEnum.RESPONSE_END,
349                 extendedResponseAddResponse ) );
350
351         // State: [EXTENDED_RESPONSE_REFERRAL_END] - Tag: </extendedResponse>
352
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END].put( new Tag( "extendedResponse", Tag.END ),
353             new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END,
354                 Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
355
356         // State: [RESPONSE_NAME_END] - Tag: <response>
357
super.transitions[Dsmlv2StatesEnum.RESPONSE_NAME_END].put( new Tag( "response", Tag.START ),
358             new GrammarTransition( Dsmlv2StatesEnum.RESPONSE_NAME_END, Dsmlv2StatesEnum.RESPONSE_END,
359                 extendedResponseAddResponse ) );
360
361         // State: [RESPONSE_NAME_END] - Tag: </extendedResponse>
362
super.transitions[Dsmlv2StatesEnum.RESPONSE_NAME_END].put( new Tag( "extendedResponse", Tag.END ),
363             new GrammarTransition( Dsmlv2StatesEnum.RESPONSE_NAME_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
364
365         // State: [RESPONSE_END] - Tag: </extendedResponse>
366
super.transitions[Dsmlv2StatesEnum.RESPONSE_END].put( new Tag( "extendedResponse", Tag.END ),
367             new GrammarTransition( Dsmlv2StatesEnum.RESPONSE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
368
369         //====================================================
370
// Transitions concerning : LDAP RESULT
371
//====================================================
372
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT] = new HashMap JavaDoc<Tag, GrammarTransition>();
373         super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_START] = new HashMap JavaDoc<Tag, GrammarTransition>();
374         super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
375         super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_VALUE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
376         super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_START] = new HashMap JavaDoc<Tag, GrammarTransition>();
377         super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
378         super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
379         super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
380         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_DONE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
381
382         // State: [LDAP_RESULT] - Tag: <control>
383
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT].put( new Tag( "control", Tag.START ), new GrammarTransition(
384             Dsmlv2StatesEnum.LDAP_RESULT, Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_START, ldapResultControlCreation ) );
385
386         // State: [LDAP_RESULT] - Tag: <resultCode>
387
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT].put( new Tag( "resultCode", Tag.START ), new GrammarTransition(
388             Dsmlv2StatesEnum.LDAP_RESULT, Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_START, ldapResultAddResultCode ) );
389
390         // State: [LDAP_RESULT_CONTROL_START] - Tag: <controlValue>
391
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_START].put( new Tag( "controlValue", Tag.START ),
392             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_START,
393                 Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_VALUE_END, ldapResultControlValueCreation ) );
394
395         // State: [LDAP_RESULT_CONTROL_VALUE_END] - Tag: </control>
396
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_VALUE_END].put( new Tag( "control", Tag.END ),
397             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_VALUE_END,
398                 Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_END, null ) );
399
400         // State: [LDAP_RESULT_CONTROL_START] - Tag: </control>
401
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_START].put( new Tag( "control", Tag.END ),
402             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_START,
403                 Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_END, null ) );
404
405         // State: [LDAP_RESULT_CONTROL_END] - Tag: <control>
406
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_END].put( new Tag( "control", Tag.START ),
407             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_END,
408                 Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_START, ldapResultControlCreation ) );
409
410         // State: [LDAP_RESULT_CONTROL_END] - Tag: <resultCode>
411
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_END].put( new Tag( "resultCode", Tag.START ),
412             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_END,
413                 Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_START, ldapResultAddResultCode ) );
414
415         // State: [LDAP_RESULT_RESULT_CODE_START] - Tag: </resultCode>
416
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_START].put( new Tag( "resultCode", Tag.END ),
417             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_START,
418                 Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END, null ) );
419
420         // State: [LDAP_RESULT_RESULT_CODE_END] - Tag: <errorMessage>
421
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END].put( new Tag( "errorMessage", Tag.START ),
422             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END,
423                 Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END, ldapResultAddErrorMessage ) );
424
425         // State: [LDAP_RESULT_RESULT_CODE_END] - Tag: <referral>
426
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END].put( new Tag( "referral", Tag.START ),
427             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END,
428                 Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END, ldapResultAddReferral ) );
429
430         // State: [LDAP_RESULT_RESULT_CODE_END] - Tag: </addResponse>
431
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END].put( new Tag( "addResponse", Tag.END ),
432             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
433                 null ) );
434
435         // State: [LDAP_RESULT_RESULT_CODE_END] - Tag: </authResponse>
436
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END].put( new Tag( "authResponse", Tag.END ),
437             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
438                 null ) );
439
440         // State: [LDAP_RESULT_RESULT_CODE_END] - Tag: </compareResponse>
441
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END].put( new Tag( "compareResponse", Tag.END ),
442             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
443                 null ) );
444
445         // State: [LDAP_RESULT_RESULT_CODE_END] - Tag: </delResponse>
446
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END].put( new Tag( "delResponse", Tag.END ),
447             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
448                 null ) );
449
450         // State: [LDAP_RESULT_RESULT_CODE_END] - Tag: </modifyResponse>
451
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END].put( new Tag( "modifyResponse", Tag.END ),
452             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
453                 null ) );
454
455         // State: [LDAP_RESULT_RESULT_CODE_END] - Tag: </modDNResponse>
456
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END].put( new Tag( "modDNResponse", Tag.END ),
457             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
458                 null ) );
459
460         // State: [LDAP_RESULT_RESULT_CODE_END] - Tag: </searchResultDone>
461
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END].put( new Tag( "searchResultDone", Tag.END ),
462             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END,
463                 Dsmlv2StatesEnum.SEARCH_RESULT_DONE_END, null ) );
464
465         // State: [SEARCH_RESULT_DONE_END] - Tag: </searchResponse>
466
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_DONE_END]
467             .put( new Tag( "searchResponse", Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_DONE_END,
468                 Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
469
470         // State: [LDAP_RESULT_ERROR_MESSAGE_END] - Tag: <referral>
471
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END].put( new Tag( "referral", Tag.START ),
472             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END,
473                 Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END, ldapResultAddReferral ) );
474
475         // State: [LDAP_RESULT_ERROR_MESSAGE_END] - Tag: </addResponse>
476
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END].put( new Tag( "addResponse", Tag.END ),
477             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END,
478                 Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
479
480         // State: [LDAP_RESULT_ERROR_MESSAGE_END] - Tag: </authResponse>
481
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END].put( new Tag( "authResponse", Tag.END ),
482             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END,
483                 Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
484
485         // State: [LDAP_RESULT_ERROR_MESSAGE_END] - Tag: </compareResponse>
486
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END].put( new Tag( "compareResponse", Tag.END ),
487             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END,
488                 Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
489
490         // State: [LDAP_RESULT_ERROR_MESSAGE_END] - Tag: </delResponse>
491
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END].put( new Tag( "delResponse", Tag.END ),
492             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END,
493                 Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
494
495         // State: [LDAP_RESULT_ERROR_MESSAGE_END] - Tag: </modifyResponse>
496
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END].put( new Tag( "modifyResponse", Tag.END ),
497             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END,
498                 Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
499
500         // State: [LDAP_RESULT_ERROR_MESSAGE_END] - Tag: </modDNResponse>
501
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END].put( new Tag( "modDNResponse", Tag.END ),
502             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END,
503                 Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) );
504
505         // State: [LDAP_RESULT_ERROR_MESSAGE_END] - Tag: </searchResultDone>
506
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END].put( new Tag( "searchResultDone", Tag.END ),
507             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END,
508                 Dsmlv2StatesEnum.SEARCH_RESULT_DONE_END, null ) );
509
510         // State: [LDAP_RESULT_REFERRAL_END] - Tag: <referral>
511
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END].put( new Tag( "referral", Tag.START ),
512             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END,
513                 Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END, ldapResultAddReferral ) );
514
515         // State: [LDAP_RESULT_REFERRAL_END] - Tag: </addResponse>
516
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END].put( new Tag( "addResponse", Tag.END ),
517             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
518                 null ) );
519
520         // State: [LDAP_RESULT_REFERRAL_END] - Tag: </authResponse>
521
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END].put( new Tag( "authResponse", Tag.END ),
522             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
523                 null ) );
524
525         // State: [LDAP_RESULT_REFERRAL_END] - Tag: </compareResponse>
526
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END].put( new Tag( "compareResponse", Tag.END ),
527             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
528                 null ) );
529
530         // State: [LDAP_RESULT_REFERRAL_END] - Tag: </delResponse>
531
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END].put( new Tag( "delResponse", Tag.END ),
532             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
533                 null ) );
534
535         // State: [LDAP_RESULT_REFERRAL_END] - Tag: </modifyResponse>
536
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END].put( new Tag( "modifyResponse", Tag.END ),
537             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
538                 null ) );
539
540         // State: [LDAP_RESULT_REFERRAL_END] - Tag: </modDNResponse>
541
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END].put( new Tag( "modDNResponse", Tag.END ),
542             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP,
543                 null ) );
544
545         // State: [LDAP_RESULT_REFERRAL_END] - Tag: </searchResultDone>
546
super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END].put( new Tag( "searchResultDone", Tag.END ),
547             new GrammarTransition( Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END, Dsmlv2StatesEnum.SEARCH_RESULT_DONE_END,
548                 null ) );
549
550         //====================================================
551
// Transitions concerning : SEARCH RESPONSE
552
//====================================================
553
super.transitions[Dsmlv2StatesEnum.SEARCH_RESPONSE] = new HashMap JavaDoc<Tag, GrammarTransition>();
554
555         // State: [SEARCH_REPONSE] - Tag: <searchResultEntry>
556
super.transitions[Dsmlv2StatesEnum.SEARCH_RESPONSE].put( new Tag( "searchResultEntry", Tag.START ),
557             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESPONSE, Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY,
558                 searchResultEntryCreation ) );
559
560         // State: [SEARCH_REPONSE] - Tag: <searchResultReference>
561
super.transitions[Dsmlv2StatesEnum.SEARCH_RESPONSE].put( new Tag( "searchResultReference", Tag.START ),
562             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESPONSE, Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE,
563                 searchResultReferenceCreation ) );
564
565         // State: [SEARCH_REPONSE] - Tag: <searchResultDone>
566
super.transitions[Dsmlv2StatesEnum.SEARCH_RESPONSE].put( new Tag( "searchResultDone", Tag.START ),
567             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESPONSE, Dsmlv2StatesEnum.LDAP_RESULT,
568                 searchResultDoneCreation ) );
569
570         //====================================================
571
// Transitions concerning : SEARCH RESULT ENTRY
572
//====================================================
573
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY] = new HashMap JavaDoc<Tag, GrammarTransition>();
574         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_START] = new HashMap JavaDoc<Tag, GrammarTransition>();
575         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
576         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_VALUE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
577         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_START] = new HashMap JavaDoc<Tag, GrammarTransition>();
578         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
579         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_VALUE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
580
581         // State: [SEARCH_RESULT_ENTRY] - Tag: <control>
582
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY].put( new Tag( "control", Tag.START ),
583             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY,
584                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_START, searchResultEntryControlCreation ) );
585
586         // State: [SEARCH_RESULT_ENTRY] - Tag: <attr>
587
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY].put( new Tag( "attr", Tag.START ),
588             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY,
589                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_START, searchResultEntryAddAttr ) );
590
591         // State: [SEARCH_RESULT_ENTRY] - Tag: </searchResultEntry>
592
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY].put( new Tag( "searchResultEntry", Tag.END ),
593             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY, Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP,
594                 null ) );
595
596         // State: [SEARCH_RESULT_ENTRY_CONTROL_START] - Tag: <controlValue>
597
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_START].put(
598             new Tag( "controlValue", Tag.START ), new GrammarTransition(
599                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_START,
600                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_VALUE_END, searchResultEntryControlValueCreation ) );
601
602         // State: [SEARCH_RESULT_ENTRY_CONTROL_VALUE_END] - Tag: </control>
603
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_VALUE_END].put( new Tag( "control", Tag.END ),
604             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_VALUE_END,
605                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_END, null ) );
606
607         // State: [SEARCH_RESULT_ENTRY_CONTROL_START] - Tag: </control>
608
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_START].put( new Tag( "control", Tag.END ),
609             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_START,
610                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_END, null ) );
611
612         // State: [SEARCH_RESULT_ENTRY_CONTROL_END] - Tag: <control>
613
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_END].put( new Tag( "control", Tag.START ),
614             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_END,
615                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_START, searchResultEntryControlCreation ) );
616
617         // State: [SEARCH_RESULT_ENTRY_CONTROL_END] - Tag: </searchResultEntry>
618
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_END].put(
619             new Tag( "searchResultEntry", Tag.END ), new GrammarTransition(
620                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_END, Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP, null ) );
621
622         // State: [SEARCH_RESULT_ENTRY_CONTROL_END] - Tag: <attr>
623
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_END].put( new Tag( "attr", Tag.START ),
624             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_END,
625                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_START, null ) );
626
627         // State: [SEARCH_RESULT_ENTRY_ATTR_START] - Tag: </attr>
628
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_START].put( new Tag( "attr", Tag.END ),
629             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_START,
630                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_END, null ) );
631
632         // State: [SEARCH_RESULT_ENTRY_ATTR_START] - Tag: <value>
633
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_START].put( new Tag( "value", Tag.START ),
634             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_START,
635                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_VALUE_END, searchResultEntryAddValue ) );
636
637         // State: [SEARCH_RESULT_ENTRY_ATTR_END] - Tag: <attr>
638
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_END].put( new Tag( "attr", Tag.START ),
639             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_END,
640                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_START, searchResultEntryAddAttr ) );
641
642         // State: [SEARCH_RESULT_ENTRY_ATTR_END] - Tag: </searchResultEntry>
643
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_END].put( new Tag( "searchResultEntry", Tag.END ),
644             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_END,
645                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP, null ) );
646
647         // State: [SEARCH_RESULT_ENTRY_VALUE_END] - Tag: <value>
648
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_VALUE_END].put( new Tag( "value", Tag.START ),
649             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_VALUE_END,
650                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_VALUE_END, searchResultEntryAddValue ) );
651
652         // State: [SEARCH_RESULT_ENTRY_VALUE_END] - Tag: </attr>
653
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_VALUE_END].put( new Tag( "attr", Tag.END ),
654             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_VALUE_END,
655                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_END, null ) );
656
657         //====================================================
658
// Transitions concerning : SEARCH RESULT ENTRY LOOP
659
//====================================================
660
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP] = new HashMap JavaDoc<Tag, GrammarTransition>();
661
662         // State: [SEARCH_RESULT_ENTRY_LOOP] - Tag: <searchResultEntry>
663
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP].put( new Tag( "searchResultEntry", Tag.START ),
664             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP, Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY,
665                 searchResultEntryCreation ) );
666
667         // State: [SEARCH_RESULT_ENTRY_LOOP] - Tag: <searchResultReference>
668
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP].put(
669             new Tag( "searchResultReference", Tag.START ), new GrammarTransition(
670                 Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP, Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE,
671                 searchResultReferenceCreation ) );
672
673         // State: [SEARCH_RESULT_ENTRY_LOOP] - Tag: <searchResultDone>
674
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP].put( new Tag( "searchResultDone", Tag.START ),
675             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP, Dsmlv2StatesEnum.LDAP_RESULT,
676                 searchResultDoneCreation ) );
677
678         //====================================================
679
// Transitions concerning : SEARCH RESULT REFERENCE
680
//====================================================
681
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE] = new HashMap JavaDoc<Tag, GrammarTransition>();
682         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_START] = new HashMap JavaDoc<Tag, GrammarTransition>();
683         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
684         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_VALUE_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
685         super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_REF_END] = new HashMap JavaDoc<Tag, GrammarTransition>();
686
687         // State: [SEARCH_RESULT_REFERENCE] - Tag: <control>
688
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE].put( new Tag( "control", Tag.START ),
689             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE,
690                 Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_START, searchResultReferenceControlCreation ) );
691
692         // State: [SEARCH_RESULT_REFERENCE] - Tag: <ref>
693
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE].put( new Tag( "ref", Tag.START ),
694             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE,
695                 Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_REF_END, searchResultReferenceAddRef ) );
696
697         // State: [SEARCH_RESULT_REFERENCE_CONTROL_START] - Tag: <controlValue>
698
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_START].put( new Tag( "controlValue",
699             Tag.START ), new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_START,
700             Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_VALUE_END, searchResultReferenceControlValueCreation ) );
701
702         // State: [sEARCH_RESULT_REFERENCE_CONTROL_VALUE_END] - Tag: </control>
703
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_VALUE_END].put(
704             new Tag( "control", Tag.END ), new GrammarTransition(
705                 Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_VALUE_END,
706                 Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_END, null ) );
707
708         // State: [SEARCH_RESULT_REFERENCE_CONTROL_START] - Tag: </control>
709
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_START].put( new Tag( "control", Tag.END ),
710             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_START,
711                 Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_END, null ) );
712
713         // State: [SEARCH_RESULT_REFERENCE_CONTROL_END] - Tag: <control>
714
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_END].put( new Tag( "control", Tag.START ),
715             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_END,
716                 Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_START, searchResultReferenceControlCreation ) );
717
718         // State: [SEARCH_RESULT_REFERENCE_CONTROL_END] - Tag: <ref>
719
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_END].put( new Tag( "ref", Tag.START ),
720             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_END,
721                 Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_REF_END, searchResultReferenceAddRef ) );
722
723         // State: [SEARCH_RESULT_REFERENCE_REF_END] - Tag: <ref>
724
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_REF_END].put( new Tag( "ref", Tag.START ),
725             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_REF_END,
726                 Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_REF_END, searchResultReferenceAddRef ) );
727
728         // State: [SEARCH_RESULT_REFERENCE_REF_END] - Tag: </searchResultReference>
729
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_REF_END].put( new Tag( "searchResultReference",
730             Tag.END ), new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_REF_END,
731             Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_LOOP, null ) );
732
733         //==========================================================
734
// Transitions concerning : SEARCH RESULT REFERENCE LOOP
735
//==========================================================
736
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_LOOP] = new HashMap JavaDoc<Tag, GrammarTransition>();
737
738         // State: [SEARCH_RESULT_REFERENCE_LOOP] - Tag: <searchResultReference>
739
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_LOOP].put( new Tag( "searchResultReference",
740             Tag.START ), new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_LOOP,
741             Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE, searchResultReferenceCreation ) );
742
743         // State: [SEARCH_RESULT_REFERENCE_LOOP] - Tag: <searchResultDone>
744
super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_LOOP].put( new Tag( "searchResultDone", Tag.START ),
745             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_LOOP, Dsmlv2StatesEnum.LDAP_RESULT,
746                 searchResultDoneCreation ) );
747     }
748
749     /**
750      * GrammarAction that creates the Batch Response
751      */

752     private final GrammarAction batchResponseCreation = new GrammarAction( "Create Batch Response" )
753     {
754         public void action( Dsmlv2Container container ) throws XmlPullParserException
755         {
756             BatchResponse batchResponse = new BatchResponse();
757
758             container.setBatchResponse( batchResponse );
759
760             XmlPullParser xpp = container.getParser();
761
762             // Checking and adding the batchRequest's attributes
763
String JavaDoc attributeValue;
764             // requestID
765
attributeValue = xpp.getAttributeValue( "", "requestID" );
766             if ( attributeValue != null )
767             {
768                 batchResponse.setRequestID( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
769             }
770         }
771     };
772
773     /**
774      * GrammarAction that creates the Add Response
775      */

776     private final GrammarAction addResponseCreation = new GrammarAction( "Create Add Response" )
777     {
778         public void action( Dsmlv2Container container ) throws XmlPullParserException
779         {
780             AddResponse addResponse = new AddResponse();
781
782             container.getBatchResponse().addResponse( addResponse );
783
784             LdapResult ldapResult = new LdapResult();
785
786             addResponse.setLdapResult( ldapResult );
787
788             XmlPullParser xpp = container.getParser();
789
790             // Checking and adding the batchRequest's attributes
791
String JavaDoc attributeValue;
792             // requestID
793
attributeValue = xpp.getAttributeValue( "", "requestID" );
794             if ( attributeValue != null )
795             {
796                 addResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
797             }
798             // MatchedDN
799
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
800             if ( attributeValue != null )
801             {
802                 try
803                 {
804                     ldapResult.setMatchedDN( new LdapDN( attributeValue ) );
805                 }
806                 catch ( InvalidNameException JavaDoc e )
807                 {
808                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
809                 }
810             }
811         }
812     };
813
814     /**
815      * GrammarAction that creates the Auth Response
816      */

817     private final GrammarAction authResponseCreation = new GrammarAction( "Create Auth Response" )
818     {
819         public void action( Dsmlv2Container container ) throws XmlPullParserException
820         {
821             BindResponse bindResponse = new BindResponse();
822
823             container.getBatchResponse().addResponse( bindResponse );
824
825             LdapResult ldapResult = new LdapResult();
826
827             bindResponse.setLdapResult( ldapResult );
828
829             XmlPullParser xpp = container.getParser();
830
831             // Checking and adding the batchRequest's attributes
832
String JavaDoc attributeValue;
833             // requestID
834
attributeValue = xpp.getAttributeValue( "", "requestID" );
835             if ( attributeValue != null )
836             {
837                 bindResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
838                
839             }
840             // MatchedDN
841
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
842             if ( attributeValue != null )
843             {
844                 try
845                 {
846                     ldapResult.setMatchedDN( new LdapDN( attributeValue ) );
847                 }
848                 catch ( InvalidNameException JavaDoc e )
849                 {
850                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
851                 }
852             }
853         }
854     };
855
856     /**
857      * GrammarAction that creates the Compare Response
858      */

859     private final GrammarAction compareResponseCreation = new GrammarAction( "Create Compare Response" )
860     {
861         public void action( Dsmlv2Container container ) throws XmlPullParserException
862         {
863             CompareResponse compareResponse = new CompareResponse();
864
865             container.getBatchResponse().addResponse( compareResponse );
866
867             LdapResult ldapResult = new LdapResult();
868
869             compareResponse.setLdapResult( ldapResult );
870
871             XmlPullParser xpp = container.getParser();
872
873             // Checking and adding the batchRequest's attributes
874
String JavaDoc attributeValue;
875             // requestID
876
attributeValue = xpp.getAttributeValue( "", "requestID" );
877             if ( attributeValue != null )
878             {
879                 compareResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
880             }
881             // MatchedDN
882
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
883             if ( attributeValue != null )
884             {
885                 try
886                 {
887                     ldapResult.setMatchedDN( new LdapDN( attributeValue ) );
888                 }
889                 catch ( InvalidNameException JavaDoc e )
890                 {
891                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
892                 }
893             }
894         }
895     };
896
897     /**
898      * GrammarAction that creates the Del Response
899      */

900     private final GrammarAction delResponseCreation = new GrammarAction( "Create Del Response" )
901     {
902         public void action( Dsmlv2Container container ) throws XmlPullParserException
903         {
904             DelResponse delResponse = new DelResponse();
905
906             container.getBatchResponse().addResponse( delResponse );
907
908             LdapResult ldapResult = new LdapResult();
909
910             delResponse.setLdapResult( ldapResult );
911
912             XmlPullParser xpp = container.getParser();
913
914             // Checking and adding the batchRequest's attributes
915
String JavaDoc attributeValue;
916             // requestID
917
attributeValue = xpp.getAttributeValue( "", "requestID" );
918             if ( attributeValue != null )
919             {
920                 delResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
921             }
922             // MatchedDN
923
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
924             if ( attributeValue != null )
925             {
926                 try
927                 {
928                     ldapResult.setMatchedDN( new LdapDN( attributeValue ) );
929                 }
930                 catch ( InvalidNameException JavaDoc e )
931                 {
932                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
933                 }
934             }
935         }
936     };
937
938     /**
939      * GrammarAction that creates the Modify Response
940      */

941     private final GrammarAction modifyResponseCreation = new GrammarAction( "Create Modify Response" )
942     {
943         public void action( Dsmlv2Container container ) throws XmlPullParserException
944         {
945             ModifyResponse modifyResponse = new ModifyResponse();
946
947             container.getBatchResponse().addResponse( modifyResponse );
948
949             LdapResult ldapResult = new LdapResult();
950
951             modifyResponse.setLdapResult( ldapResult );
952
953             XmlPullParser xpp = container.getParser();
954
955             // Checking and adding the batchRequest's attributes
956
String JavaDoc attributeValue;
957             // requestID
958
attributeValue = xpp.getAttributeValue( "", "requestID" );
959             if ( attributeValue != null )
960             {
961                 modifyResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
962             }
963             // MatchedDN
964
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
965             if ( attributeValue != null )
966             {
967                 try
968                 {
969                     ldapResult.setMatchedDN( new LdapDN( attributeValue ) );
970                 }
971                 catch ( InvalidNameException JavaDoc e )
972                 {
973                     throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
974                 }
975             }
976         }
977     };
978
979     /**
980      * GrammarAction that creates the Mod DN Response
981      */

982     private final GrammarAction modDNResponseCreation = new GrammarAction( "Create Mod DN Response" )
983     {
984         public void action( Dsmlv2Container container ) throws XmlPullParserException
985         {
986             ModifyDNResponse modifyDNResponse = new ModifyDNResponse();
987
988             container.getBatchResponse().addResponse( modifyDNResponse );
989
990             LdapResult ldapResult = new LdapResult();
991
992             modifyDNResponse.setLdapResult( ldapResult );
993
994             XmlPullParser xpp = container.getParser();
995
996             // Checking and adding the batchRequest's attributes
997
String JavaDoc attributeValue;
998             // requestID
999
attributeValue = xpp.getAttributeValue( "", "requestID" );
1000            if ( attributeValue != null )
1001            {
1002                modifyDNResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1003            }
1004            // MatchedDN
1005
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
1006            if ( attributeValue != null )
1007            {
1008                try
1009                {
1010                    ldapResult.setMatchedDN( new LdapDN( attributeValue ) );
1011                }
1012                catch ( InvalidNameException JavaDoc e )
1013                {
1014                    throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
1015                }
1016            }
1017        }
1018    };
1019
1020    /**
1021     * GrammarAction that creates the Extended Response
1022     */

1023    private final GrammarAction extendedResponseCreation = new GrammarAction( "Create Extended Response" )
1024    {
1025        public void action( Dsmlv2Container container ) throws XmlPullParserException
1026        {
1027            ExtendedResponse extendedResponse = new ExtendedResponse();
1028
1029            container.getBatchResponse().addResponse( extendedResponse );
1030
1031            LdapResult ldapResult = new LdapResult();
1032
1033            extendedResponse.setLdapResult( ldapResult );
1034
1035            XmlPullParser xpp = container.getParser();
1036
1037            // Checking and adding the batchRequest's attributes
1038
String JavaDoc attributeValue;
1039            // requestID
1040
attributeValue = xpp.getAttributeValue( "", "requestID" );
1041            if ( attributeValue != null )
1042            {
1043                extendedResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1044            }
1045            // MatchedDN
1046
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
1047            if ( attributeValue != null )
1048            {
1049                try
1050                {
1051                    ldapResult.setMatchedDN( new LdapDN( attributeValue ) );
1052                }
1053                catch ( InvalidNameException JavaDoc e )
1054                {
1055                    throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
1056                }
1057            }
1058        }
1059    };
1060
1061    /**
1062     * GrammarAction that creates the Error Response
1063     */

1064    private final GrammarAction errorResponseCreation = new GrammarAction( "Create Error Response" )
1065    {
1066        public void action( Dsmlv2Container container ) throws XmlPullParserException
1067        {
1068            ErrorResponse errorResponse = new ErrorResponse();
1069
1070            container.getBatchResponse().addResponse( errorResponse );
1071
1072            XmlPullParser xpp = container.getParser();
1073
1074            // Checking and adding the batchRequest's attributes
1075
String JavaDoc attributeValue;
1076            // requestID
1077
attributeValue = xpp.getAttributeValue( "", "requestID" );
1078            if ( attributeValue != null )
1079            {
1080                errorResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1081            }
1082            // type
1083
attributeValue = xpp.getAttributeValue( "", "type" );
1084            if ( attributeValue != null )
1085            {
1086                if ( attributeValue.equals( errorResponse.getTypeDescr( ErrorResponseType.NOT_ATTEMPTED ) ) )
1087                {
1088                    errorResponse.setType( ErrorResponseType.NOT_ATTEMPTED );
1089                }
1090                else if ( attributeValue.equals( errorResponse.getTypeDescr( ErrorResponseType.COULD_NOT_CONNECT ) ) )
1091                {
1092                    errorResponse.setType( ErrorResponseType.COULD_NOT_CONNECT );
1093                }
1094                else if ( attributeValue.equals( errorResponse.getTypeDescr( ErrorResponseType.CONNECTION_CLOSED ) ) )
1095                {
1096                    errorResponse.setType( ErrorResponseType.CONNECTION_CLOSED );
1097                }
1098                else if ( attributeValue.equals( errorResponse.getTypeDescr( ErrorResponseType.MALFORMED_REQUEST ) ) )
1099                {
1100                    errorResponse.setType( ErrorResponseType.MALFORMED_REQUEST );
1101                }
1102                else if ( attributeValue
1103                    .equals( errorResponse.getTypeDescr( ErrorResponseType.GATEWAY_INTERNAL_ERROR ) ) )
1104                {
1105                    errorResponse.setType( ErrorResponseType.GATEWAY_INTERNAL_ERROR );
1106                }
1107                else if ( attributeValue.equals( errorResponse.getTypeDescr( ErrorResponseType.AUTHENTICATION_FAILED ) ) )
1108                {
1109                    errorResponse.setType( ErrorResponseType.AUTHENTICATION_FAILED );
1110                }
1111                else if ( attributeValue.equals( errorResponse.getTypeDescr( ErrorResponseType.UNRESOLVABLE_URI ) ) )
1112                {
1113                    errorResponse.setType( ErrorResponseType.UNRESOLVABLE_URI );
1114                }
1115                else if ( attributeValue.equals( errorResponse.getTypeDescr( ErrorResponseType.OTHER ) ) )
1116                {
1117                    errorResponse.setType( ErrorResponseType.OTHER );
1118                }
1119                else
1120                {
1121                    throw new XmlPullParserException( "Unknown type", xpp, null );
1122                }
1123            }
1124            else
1125            {
1126                throw new XmlPullParserException( "type attribute is required", xpp, null );
1127            }
1128        }
1129    };
1130
1131    /**
1132     * GrammarAction that adds Message to an Error Response
1133     */

1134    private final GrammarAction errorResponseAddMessage = new GrammarAction( "Add Message to Error Response" )
1135    {
1136        public void action( Dsmlv2Container container ) throws XmlPullParserException
1137        {
1138            ErrorResponse errorResponse = ( ErrorResponse ) container.getBatchResponse().getCurrentResponse();
1139            
1140            XmlPullParser xpp = container.getParser();
1141            try
1142            {
1143                String JavaDoc nextText = xpp.nextText();
1144                if ( !nextText.equals( "" ) )
1145                {
1146                    errorResponse.setMessage( nextText.trim() );
1147                }
1148            }
1149            catch ( IOException JavaDoc e )
1150            {
1151                throw new XmlPullParserException( e.getMessage(), xpp, null );
1152            }
1153        }
1154    };
1155
1156    /**
1157     * GrammarAction that adds Detail to an Error Response
1158     */

1159    private final GrammarAction errorResponseAddDetail = null; // TODO Look for documentation about this Detail element (the DSML documentation doesn't give enough information)
1160

1161
1162    /**
1163     * Creates a Control parsing the current node and adds it to the given parent
1164     * @param container the DSMLv2Container
1165     * @param parent the parent
1166     * @throws XmlPullParserException
1167     */

1168    private void createAndAddControl( Dsmlv2Container container, LdapMessage parent ) throws XmlPullParserException
1169    {
1170        Control control = new Control();
1171
1172        parent.addControl( control );
1173
1174        XmlPullParser xpp = container.getParser();
1175
1176        // Checking and adding the Control's attributes
1177
String JavaDoc attributeValue;
1178        // TYPE
1179
attributeValue = xpp.getAttributeValue( "", "type" );
1180        if ( attributeValue != null )
1181        {
1182            if ( !OID.isOID( attributeValue ) )
1183            {
1184                throw new XmlPullParserException( "Incorrect value for 'type' attribute. This is not an OID.", xpp, null );
1185            }
1186            control.setControlType( attributeValue );
1187        }
1188        else
1189        {
1190            throw new XmlPullParserException( "type attribute is required", xpp, null );
1191        }
1192        // CRITICALITY
1193
attributeValue = xpp.getAttributeValue( "", "criticality" );
1194        if ( attributeValue != null )
1195        {
1196            if ( attributeValue.equals( "true" ) )
1197            {
1198                control.setCriticality( true );
1199            }
1200            else if ( attributeValue.equals( "false" ) )
1201            {
1202                control.setCriticality( false );
1203            }
1204            else
1205            {
1206                throw new XmlPullParserException( "Incorrect value for 'criticality' attribute", xpp, null );
1207            }
1208        }
1209    }
1210
1211    /**
1212     * GrammarAction that creates a Control for LDAP Result
1213     */

1214    private final GrammarAction ldapResultControlCreation = new GrammarAction( "Create Control for LDAP Result" )
1215    {
1216        public void action( Dsmlv2Container container ) throws XmlPullParserException
1217        {
1218            LdapResponse ldapResponse = container.getBatchResponse().getCurrentResponse();
1219            // Search Response is a special case
1220
if ( ldapResponse instanceof SearchResponse )
1221            {
1222                ldapResponse = ( ( SearchResponse ) ldapResponse ).getSearchResultDone();
1223            }
1224
1225            createAndAddControl( container, ldapResponse );
1226        }
1227    };
1228
1229    /**
1230     * GrammarAction that creates a Control for Search Result Entry
1231     */

1232    private final GrammarAction searchResultEntryControlCreation = new GrammarAction(
1233        "Create Control for Search Result Entry" )
1234    {
1235        public void action( Dsmlv2Container container ) throws XmlPullParserException
1236        {
1237            LdapMessage ldapMessage = ( ( SearchResponse ) container.getBatchResponse().getCurrentResponse() )
1238                .getCurrentSearchResultEntry();
1239            createAndAddControl( container, ldapMessage );
1240        }
1241    };
1242
1243    /**
1244     * GrammarAction that creates a Control for Search Result Entry
1245     */

1246    private final GrammarAction searchResultReferenceControlCreation = new GrammarAction(
1247        "Create Control for Search Result Reference" )
1248    {
1249        public void action( Dsmlv2Container container ) throws XmlPullParserException
1250        {
1251            LdapMessage ldapMessage = ( ( SearchResponse ) container.getBatchResponse().getCurrentResponse() )
1252                .getCurrentSearchResultReference();
1253            createAndAddControl( container, ldapMessage );
1254        }
1255    };
1256
1257
1258    /**
1259     * Creates a Control Value parsing the current node and adds it to the given parent
1260     * @param container the DSMLv2Container
1261     * @param parent the parent
1262     * @throws XmlPullParserException
1263     */

1264    private void createAndAddControlValue( Dsmlv2Container container, LdapMessage parent )
1265        throws XmlPullParserException
1266    {
1267        Control control = parent.getCurrentControl();
1268
1269        XmlPullParser xpp = container.getParser();
1270        try
1271        {
1272            // We have to catch the type Attribute Value before going to the next Text node
1273
String JavaDoc typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1274            
1275            // Getting the value
1276
String JavaDoc nextText = xpp.nextText();
1277            if ( !nextText.equals( "" ) )
1278            {
1279                if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1280                {
1281                    control.setControlValue( Base64.decode( nextText.trim().toCharArray() ) );
1282                }
1283                else
1284                {
1285                    control.setControlValue( nextText.trim() );
1286                }
1287            }
1288        }
1289        catch ( IOException JavaDoc e )
1290        {
1291            throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null );
1292        }
1293    }
1294
1295    /**
1296     * GrammarAction that creates a Control Value for LDAP Result
1297     */

1298    private final GrammarAction ldapResultControlValueCreation = new GrammarAction(
1299        "Add ControlValue to Control for LDAP Result" )
1300    {
1301        public void action( Dsmlv2Container container ) throws XmlPullParserException
1302        {
1303            LdapResponse ldapResponse = container.getBatchResponse().getCurrentResponse();
1304            // Search Response is a special case
1305
if ( ldapResponse instanceof SearchResponse )
1306            {
1307                ldapResponse = ( ( SearchResponse ) ldapResponse ).getSearchResultDone();
1308            }
1309
1310            createAndAddControlValue( container, ldapResponse );
1311        }
1312    };
1313
1314    /**
1315     * GrammarAction that creates a Control Value for Search Result Entry
1316     */

1317    private final GrammarAction searchResultEntryControlValueCreation = new GrammarAction(
1318        "Add ControlValue to Control for Search Result Entry" )
1319    {
1320        public void action( Dsmlv2Container container ) throws XmlPullParserException
1321        {
1322            LdapMessage ldapMessage = ( ( SearchResponse ) container.getBatchResponse().getCurrentResponse() )
1323                .getCurrentSearchResultEntry();
1324            createAndAddControlValue( container, ldapMessage );
1325        }
1326    };
1327
1328    /**
1329     * GrammarAction that creates a Control Value for Search Result Reference
1330     */

1331    private final GrammarAction searchResultReferenceControlValueCreation = new GrammarAction(
1332        "Add ControlValue to Control for Search Result Entry" )
1333    {
1334        public void action( Dsmlv2Container container ) throws XmlPullParserException
1335        {
1336            LdapMessage ldapMessage = ( ( SearchResponse ) container.getBatchResponse().getCurrentResponse() )
1337                .getCurrentSearchResultReference();
1338            createAndAddControlValue( container, ldapMessage );
1339        }
1340    };
1341
1342    /**
1343     * GrammarAction that adds a Result Code to a LDAP Result
1344     */

1345    private final GrammarAction ldapResultAddResultCode = new GrammarAction( "Add ResultCode to LDAP Result" )
1346    {
1347        public void action( Dsmlv2Container container ) throws XmlPullParserException
1348        {
1349            LdapResponse ldapResponse = container.getBatchResponse().getCurrentResponse();
1350
1351            LdapResult ldapResult = null;
1352
1353            // Search Response is a special case
1354
// ResultCode can only occur in a case of Search Result Done in a Search Response
1355
if ( ldapResponse instanceof SearchResponse )
1356            {
1357                SearchResponse searchResponse = ( SearchResponse ) ldapResponse;
1358                ldapResult = searchResponse.getSearchResultDone().getLdapResult();
1359            }
1360            else
1361            {
1362                ldapResult = ldapResponse.getLdapResult();
1363            }
1364
1365            XmlPullParser xpp = container.getParser();
1366
1367            // Checking and adding the request's attributes
1368
String JavaDoc attributeValue;
1369            // code
1370
attributeValue = xpp.getAttributeValue( "", "code" );
1371            if ( attributeValue != null )
1372            {
1373                try
1374                {
1375                    ldapResult.setResultCode( ResultCodeEnum.getResultCode( Integer.parseInt( attributeValue ) ) );
1376                }
1377                catch ( NumberFormatException JavaDoc e )
1378                {
1379                    throw new XmlPullParserException( "the given resultCode is not an integer", xpp, null );
1380                }
1381            }
1382            else
1383            {
1384                throw new XmlPullParserException( "code attribute is required", xpp, null );
1385            }
1386            // descr
1387
attributeValue = xpp.getAttributeValue( "", "descr" );
1388            if ( attributeValue != null )
1389            {
1390                if ( DSMLV2_DESCR_TAGS.contains( attributeValue ) == false )
1391                {
1392                    throw new XmlPullParserException( "descr ('" + attributeValue
1393                        + "') doesn't match with the possible values", xpp, null );
1394                }
1395
1396            }
1397        }
1398    };
1399
1400    /**
1401     * GrammarAction that adds a Error Message to a LDAP Result
1402     */

1403    private final GrammarAction ldapResultAddErrorMessage = new GrammarAction( "Add Error Message to LDAP Result" )
1404    {
1405        public void action( Dsmlv2Container container ) throws XmlPullParserException
1406        {
1407            LdapResponse ldapResponse = container.getBatchResponse().getCurrentResponse();
1408
1409            LdapResult ldapResult = null;
1410
1411            // Search Response is a special case
1412
// ResultCode can only occur in a case of Search Result Done in a Search Response
1413
if ( ldapResponse instanceof SearchResponse )
1414            {
1415                SearchResponse searchResponse = ( SearchResponse ) ldapResponse;
1416                ldapResult = searchResponse.getSearchResultDone().getLdapResult();
1417            }
1418            else
1419            {
1420                ldapResult = ldapResponse.getLdapResult();
1421            }
1422
1423            XmlPullParser xpp = container.getParser();
1424            try
1425            {
1426                String JavaDoc nextText = xpp.nextText();
1427                if ( !nextText.equals( "" ) )
1428                {
1429                    ldapResult.setErrorMessage( nextText.trim() );
1430                }
1431            }
1432            catch ( IOException JavaDoc e )
1433            {
1434                throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null );
1435            }
1436        }
1437    };
1438
1439    /**
1440     * GrammarAction that adds a Referral to a LDAP Result
1441     */

1442    private final GrammarAction ldapResultAddReferral = new GrammarAction( "Add Referral to LDAP Result" )
1443    {
1444        public void action( Dsmlv2Container container ) throws XmlPullParserException
1445        {
1446            LdapResponse ldapResponse = container.getBatchResponse().getCurrentResponse();
1447
1448            LdapResult ldapResult = null;
1449
1450            // Search Response is a special case
1451
// ResultCode can only occur in a case of Search Result Done in a Search Response
1452
if ( ldapResponse instanceof SearchResponse )
1453            {
1454                SearchResponse searchResponse = ( SearchResponse ) ldapResponse;
1455                ldapResult = searchResponse.getSearchResultDone().getLdapResult();
1456            }
1457            else
1458            {
1459                ldapResult = ldapResponse.getLdapResult();
1460            }
1461
1462            // Initialization of the Referrals if needed
1463
if ( ldapResult.getReferrals() == null )
1464            {
1465                ldapResult.initReferrals();
1466            }
1467
1468            XmlPullParser xpp = container.getParser();
1469            try
1470            {
1471                String JavaDoc nextText = xpp.nextText();
1472                if ( !nextText.equals( "" ) )
1473                {
1474                    try
1475                    {
1476                        ldapResult.addReferral( new LdapURL( nextText.trim() ) );
1477                    }
1478                    catch ( LdapURLEncodingException e )
1479                    {
1480                        throw new XmlPullParserException( e.getMessage(), xpp, null );
1481                    }
1482                }
1483            }
1484            catch ( IOException JavaDoc e )
1485            {
1486                throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null );
1487            }
1488        }
1489    };
1490
1491    /**
1492     * GrammarAction that creates the Search Response
1493     */

1494    private final GrammarAction searchResponseCreation = new GrammarAction( "Create Search Response" )
1495    {
1496        public void action( Dsmlv2Container container ) throws XmlPullParserException
1497        {
1498            SearchResponse searchResponse = new SearchResponse();
1499
1500            container.getBatchResponse().addResponse( searchResponse );
1501
1502            XmlPullParser xpp = container.getParser();
1503
1504            // Checking and adding the batchRequest's attributes
1505
String JavaDoc attributeValue;
1506            // requestID
1507
attributeValue = xpp.getAttributeValue( "", "requestID" );
1508            if ( attributeValue != null )
1509            {
1510                searchResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1511            }
1512        }
1513    };
1514
1515    /**
1516     * GrammarAction that creates a Search Result Entry
1517     */

1518    private final GrammarAction searchResultEntryCreation = new GrammarAction(
1519        "Add Search Result Entry to Search Response" )
1520    {
1521        public void action( Dsmlv2Container container ) throws XmlPullParserException
1522        {
1523            SearchResultEntry searchResultEntry = new SearchResultEntry();
1524
1525            SearchResponse searchResponse = ( SearchResponse ) container.getBatchResponse().getCurrentResponse();
1526
1527            searchResponse.addSearchResultEntry( searchResultEntry );
1528
1529            XmlPullParser xpp = container.getParser();
1530
1531            // Checking and adding the request's attributes
1532
String JavaDoc attributeValue;
1533            // requestID
1534
attributeValue = xpp.getAttributeValue( "", "requestID" );
1535            if ( attributeValue != null )
1536            {
1537                searchResultEntry.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1538            }
1539            // dn
1540
attributeValue = xpp.getAttributeValue( "", "dn" );
1541            if ( attributeValue != null )
1542            {
1543                try
1544                {
1545                    searchResultEntry.setObjectName( new LdapDN( attributeValue ) );
1546                }
1547                catch ( InvalidNameException JavaDoc e )
1548                {
1549                    throw new XmlPullParserException( e.getMessage(), xpp, null );
1550                }
1551            }
1552            else
1553            {
1554                throw new XmlPullParserException( "dn attribute is required", xpp, null );
1555            }
1556        }
1557    };
1558
1559    /**
1560     * GrammarAction that creates a Search Result Reference
1561     */

1562    private final GrammarAction searchResultReferenceCreation = new GrammarAction(
1563        "Add Search Result Reference to Search Response" )
1564    {
1565        public void action( Dsmlv2Container container ) throws XmlPullParserException
1566        {
1567            SearchResultReference searchResultReference = new SearchResultReference();
1568
1569            SearchResponse searchResponse = ( SearchResponse ) container.getBatchResponse().getCurrentResponse();
1570
1571            searchResponse.addSearchResultReference( searchResultReference );
1572
1573            XmlPullParser xpp = container.getParser();
1574
1575            // Checking and adding the request's attributes
1576
String JavaDoc attributeValue;
1577            // requestID
1578
attributeValue = xpp.getAttributeValue( "", "requestID" );
1579            if ( attributeValue != null )
1580            {
1581                searchResultReference.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1582            }
1583        }
1584    };
1585
1586    /**
1587     * GrammarAction that creates a Search Result Done
1588     */

1589    private final GrammarAction searchResultDoneCreation = new GrammarAction(
1590        "Add Search Result Done to Search Response" )
1591    {
1592        public void action( Dsmlv2Container container ) throws XmlPullParserException
1593        {
1594            SearchResultDone searchResultDone = new SearchResultDone();
1595
1596            searchResultDone.setLdapResult( new LdapResult() );
1597
1598            SearchResponse searchResponse = ( SearchResponse ) container.getBatchResponse().getCurrentResponse();
1599
1600            searchResponse.setSearchResultDone( searchResultDone );
1601
1602            XmlPullParser xpp = container.getParser();
1603
1604            // Checking and adding the batchRequest's attributes
1605
String JavaDoc attributeValue;
1606            // requestID
1607
attributeValue = xpp.getAttributeValue( "", "requestID" );
1608            if ( attributeValue != null )
1609            {
1610                searchResultDone.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
1611            }
1612            // MatchedDN
1613
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
1614            if ( attributeValue != null )
1615            {
1616                try
1617                {
1618                    searchResultDone.getLdapResult().setMatchedDN( new LdapDN( attributeValue ) );
1619                }
1620                catch ( InvalidNameException JavaDoc e )
1621                {
1622                    throw new XmlPullParserException( "" + e.getMessage(), xpp, null );
1623                }
1624            }
1625        }
1626    };
1627
1628    /**
1629     * GrammarAction that adds an Attr to a Search Result Entry
1630     */

1631    private final GrammarAction searchResultEntryAddAttr = new GrammarAction( "Add Attr to Search Result Entry" )
1632    {
1633        public void action( Dsmlv2Container container ) throws XmlPullParserException
1634        {
1635            SearchResponse searchResponse = ( SearchResponse ) container.getBatchResponse().getCurrentResponse();
1636
1637            SearchResultEntry searchResultEntry = searchResponse.getCurrentSearchResultEntry();
1638
1639            XmlPullParser xpp = container.getParser();
1640
1641            // Checking and adding the request's attributes
1642
String JavaDoc attributeValue;
1643            // name
1644
attributeValue = xpp.getAttributeValue( "", "name" );
1645            if ( attributeValue != null )
1646            {
1647                searchResultEntry.addAttributeValues( attributeValue );
1648            }
1649            else
1650            {
1651                throw new XmlPullParserException( "name attribute is required", xpp, null );
1652            }
1653        }
1654    };
1655
1656    /**
1657     * GrammarAction that adds a Value to an Attr of a Search Result Entry
1658     */

1659    private final GrammarAction searchResultEntryAddValue = new GrammarAction(
1660        "Add a Value to an Attr of a Search Result Entry" )
1661    {
1662        public void action( Dsmlv2Container container ) throws XmlPullParserException
1663        {
1664            SearchResponse searchResponse = ( SearchResponse ) container.getBatchResponse().getCurrentResponse();
1665            SearchResultEntry searchResultEntry = searchResponse.getCurrentSearchResultEntry();
1666
1667            XmlPullParser xpp = container.getParser();
1668            try
1669            {
1670                // We have to catch the type Attribute Value before going to the next Text node
1671
String JavaDoc typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1672                
1673                // Getting the value
1674
String JavaDoc nextText = xpp.nextText();
1675                if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1676                {
1677                    searchResultEntry.addAttributeValue( Base64.decode( nextText.toCharArray() ) );
1678                }
1679                else
1680                {
1681                    searchResultEntry.addAttributeValue( nextText );
1682                }
1683            }
1684            catch ( IOException JavaDoc e )
1685            {
1686                throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null );
1687            }
1688        }
1689    };
1690
1691    /**
1692     * GrammarAction that adds a Ref to a Search Result Reference
1693     */

1694    private final GrammarAction searchResultReferenceAddRef = new GrammarAction(
1695        "Add a Ref to a Search Result Reference" )
1696    {
1697        public void action( Dsmlv2Container container ) throws XmlPullParserException
1698        {
1699            SearchResponse searchResponse = ( SearchResponse ) container.getBatchResponse().getCurrentResponse();
1700            SearchResultReference searchResultReference = searchResponse.getCurrentSearchResultReference();
1701
1702            XmlPullParser xpp = container.getParser();
1703            try
1704            {
1705                String JavaDoc nextText = xpp.nextText();
1706                if ( !nextText.equals( "" ) )
1707                {
1708                    searchResultReference.addSearchResultReference( new LdapURL( nextText ) );
1709                }
1710            }
1711            catch ( IOException JavaDoc e )
1712            {
1713                throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null );
1714            }
1715            catch ( LdapURLEncodingException e )
1716            {
1717                throw new XmlPullParserException( e.getMessage(), xpp, null );
1718            }
1719        }
1720    };
1721
1722    /**
1723     * GrammarAction that adds Result Code to an Extended Response
1724     */

1725    private final GrammarAction extendedResponseAddResultCode = ldapResultAddResultCode;
1726
1727    /**
1728     * GrammarAction that creates the Search Response
1729     */

1730    private final GrammarAction extendedResponseAddErrorMessage = ldapResultAddErrorMessage;
1731
1732    /**
1733     * GrammarAction that adds a Referral to an Extended Response
1734     */

1735    private final GrammarAction extendedResponseAddReferral = ldapResultAddReferral;
1736
1737    /**
1738     * GrammarAction that adds a Response Name to an Extended Response
1739     */

1740    private final GrammarAction extendedResponseAddResponseName = new GrammarAction(
1741        "Add Response Name to Extended Response" )
1742    {
1743        public void action( Dsmlv2Container container ) throws XmlPullParserException
1744        {
1745            ExtendedResponse extendedResponse = ( ExtendedResponse ) container.getBatchResponse().getCurrentResponse();
1746
1747            XmlPullParser xpp = container.getParser();
1748            try
1749            {
1750                String JavaDoc nextText = xpp.nextText();
1751                if ( !nextText.equals( "" ) )
1752                {
1753                    extendedResponse.setResponseName( new OID( nextText.trim() ) );
1754                }
1755                
1756            }
1757            catch ( IOException JavaDoc e )
1758            {
1759                throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null );
1760            }
1761            catch ( DecoderException e )
1762            {
1763                throw new XmlPullParserException( e.getMessage(), xpp, null );
1764            }
1765        }
1766    };
1767
1768    /**
1769     * GrammarAction that adds a Response to an Extended Response
1770     */

1771    private final GrammarAction extendedResponseAddResponse = new GrammarAction( "Add Response to Extended Response" )
1772    {
1773        public void action( Dsmlv2Container container ) throws XmlPullParserException
1774        {
1775            ExtendedResponse extendedResponse = ( ExtendedResponse ) container.getBatchResponse().getCurrentResponse();
1776
1777            XmlPullParser xpp = container.getParser();
1778            try
1779            {
1780                // We have to catch the type Attribute Value before going to the next Text node
1781
String JavaDoc typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
1782                
1783                // Getting the value
1784
String JavaDoc nextText = xpp.nextText();
1785                if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
1786                {
1787                    extendedResponse.setResponse( Base64.decode( nextText.trim().toCharArray() ) );
1788                }
1789                else
1790                {
1791                    extendedResponse.setResponse( nextText.trim() );
1792                }
1793            }
1794            catch ( IOException JavaDoc e )
1795            {
1796                throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null );
1797            }
1798        }
1799    };
1800
1801
1802    /**
1803     * Get the instance of this grammar
1804     *
1805     * @return
1806     * an instance on this grammar
1807     */

1808    public static Dsmlv2ResponseGrammar getInstance()
1809    {
1810        return instance;
1811    }
1812}
1813
Popular Tags