1 20 21 package org.apache.directory.ldapstudio.dsmlv2.reponse; 22 23 24 import java.io.IOException ; 25 import java.lang.reflect.Array ; 26 import java.util.HashMap ; 27 import java.util.HashSet ; 28 import java.util.Set ; 29 30 import javax.naming.InvalidNameException ; 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 72 public class Dsmlv2ResponseGrammar extends AbstractGrammar implements IGrammar 73 { 74 75 private static Dsmlv2ResponseGrammar instance = new Dsmlv2ResponseGrammar(); 76 77 private static Set <String > DSMLV2_DESCR_TAGS = null; 79 static 80 { 81 DSMLV2_DESCR_TAGS = new HashSet <String >(); 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 ("unchecked") 125 private Dsmlv2ResponseGrammar() 126 { 127 name = Dsmlv2ResponseGrammar.class.getName(); 128 statesEnum = Dsmlv2StatesEnum.getInstance(); 129 130 super.transitions = ( HashMap <Tag, GrammarTransition>[] ) Array.newInstance( HashMap .class, 300 );; 133 super.transitions[Dsmlv2StatesEnum.INIT_GRAMMAR_STATE] = new HashMap <Tag, GrammarTransition>(); 137 138 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 super.transitions[Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP] = new HashMap <Tag, GrammarTransition>(); 148 149 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 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 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 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 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 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 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 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 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 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 super.transitions[Dsmlv2StatesEnum.ERROR_RESPONSE] = new HashMap <Tag, GrammarTransition>(); 202 super.transitions[Dsmlv2StatesEnum.MESSAGE_END] = new HashMap <Tag, GrammarTransition>(); 203 super.transitions[Dsmlv2StatesEnum.DETAIL_START] = new HashMap <Tag, GrammarTransition>(); 204 super.transitions[Dsmlv2StatesEnum.DETAIL_END] = new HashMap <Tag, GrammarTransition>(); 205 206 super.transitions[Dsmlv2StatesEnum.ERROR_RESPONSE].put( new Tag( "message", Tag.START ), new GrammarTransition( 208 Dsmlv2StatesEnum.ERROR_RESPONSE, Dsmlv2StatesEnum.MESSAGE_END, errorResponseAddMessage ) ); 209 210 super.transitions[Dsmlv2StatesEnum.ERROR_RESPONSE].put( new Tag( "detail", Tag.START ), new GrammarTransition( 212 Dsmlv2StatesEnum.ERROR_RESPONSE, Dsmlv2StatesEnum.DETAIL_START, errorResponseAddDetail ) ); 213 214 super.transitions[Dsmlv2StatesEnum.MESSAGE_END].put( new Tag( "errorResponse", Tag.END ), 216 new GrammarTransition( Dsmlv2StatesEnum.MESSAGE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) ); 217 218 super.transitions[Dsmlv2StatesEnum.MESSAGE_END].put( new Tag( "detail", Tag.START ), new GrammarTransition( 220 Dsmlv2StatesEnum.MESSAGE_END, Dsmlv2StatesEnum.DETAIL_START, errorResponseAddDetail ) ); 221 222 super.transitions[Dsmlv2StatesEnum.DETAIL_START].put( new Tag( "detail", Tag.END ), new GrammarTransition( 224 Dsmlv2StatesEnum.DETAIL_START, Dsmlv2StatesEnum.DETAIL_END, null ) ); 225 226 super.transitions[Dsmlv2StatesEnum.DETAIL_END].put( new Tag( "detail", Tag.END ), new GrammarTransition( 228 Dsmlv2StatesEnum.DETAIL_END, Dsmlv2StatesEnum.DETAIL_END, errorResponseAddDetail ) ); 229 230 super.transitions[Dsmlv2StatesEnum.ERROR_RESPONSE].put( new Tag( "errorResponse", Tag.END ), 232 new GrammarTransition( Dsmlv2StatesEnum.ERROR_RESPONSE, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) ); 233 234 super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE] = new HashMap <Tag, GrammarTransition>(); 238 super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_START] = new HashMap <Tag, GrammarTransition>(); 239 super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_END] = new HashMap <Tag, GrammarTransition>(); 240 super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_CONTROL_VALUE_END] = new HashMap <Tag, GrammarTransition>(); 241 super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_START] = new HashMap <Tag, GrammarTransition>(); 242 super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_RESULT_CODE_END] = new HashMap <Tag, GrammarTransition>(); 243 super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END] = new HashMap <Tag, GrammarTransition>(); 244 super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END] = new HashMap <Tag, GrammarTransition>(); 245 super.transitions[Dsmlv2StatesEnum.RESPONSE_NAME_END] = new HashMap <Tag, GrammarTransition>(); 246 super.transitions[Dsmlv2StatesEnum.RESPONSE_END] = new HashMap <Tag, GrammarTransition>(); 247 248 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 super.transitions[Dsmlv2StatesEnum.RESPONSE_END].put( new Tag( "extendedResponse", Tag.END ), 367 new GrammarTransition( Dsmlv2StatesEnum.RESPONSE_END, Dsmlv2StatesEnum.BATCH_RESPONSE_LOOP, null ) ); 368 369 super.transitions[Dsmlv2StatesEnum.LDAP_RESULT] = new HashMap <Tag, GrammarTransition>(); 373 super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_START] = new HashMap <Tag, GrammarTransition>(); 374 super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_END] = new HashMap <Tag, GrammarTransition>(); 375 super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_CONTROL_VALUE_END] = new HashMap <Tag, GrammarTransition>(); 376 super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_START] = new HashMap <Tag, GrammarTransition>(); 377 super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_RESULT_CODE_END] = new HashMap <Tag, GrammarTransition>(); 378 super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_ERROR_MESSAGE_END] = new HashMap <Tag, GrammarTransition>(); 379 super.transitions[Dsmlv2StatesEnum.LDAP_RESULT_REFERRAL_END] = new HashMap <Tag, GrammarTransition>(); 380 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_DONE_END] = new HashMap <Tag, GrammarTransition>(); 381 382 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 super.transitions[Dsmlv2StatesEnum.SEARCH_RESPONSE] = new HashMap <Tag, GrammarTransition>(); 554 555 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 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 super.transitions[Dsmlv2StatesEnum.SEARCH_RESPONSE].put( new Tag( "searchResultDone", Tag.START ), 567 new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESPONSE, Dsmlv2StatesEnum.LDAP_RESULT, 568 searchResultDoneCreation ) ); 569 570 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY] = new HashMap <Tag, GrammarTransition>(); 574 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_START] = new HashMap <Tag, GrammarTransition>(); 575 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_END] = new HashMap <Tag, GrammarTransition>(); 576 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_CONTROL_VALUE_END] = new HashMap <Tag, GrammarTransition>(); 577 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_START] = new HashMap <Tag, GrammarTransition>(); 578 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_ATTR_END] = new HashMap <Tag, GrammarTransition>(); 579 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_VALUE_END] = new HashMap <Tag, GrammarTransition>(); 580 581 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_ENTRY_LOOP] = new HashMap <Tag, GrammarTransition>(); 661 662 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 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 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 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE] = new HashMap <Tag, GrammarTransition>(); 682 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_START] = new HashMap <Tag, GrammarTransition>(); 683 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_END] = new HashMap <Tag, GrammarTransition>(); 684 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_CONTROL_VALUE_END] = new HashMap <Tag, GrammarTransition>(); 685 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_REF_END] = new HashMap <Tag, GrammarTransition>(); 686 687 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 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 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 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 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 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 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 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 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 super.transitions[Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_LOOP] = new HashMap <Tag, GrammarTransition>(); 737 738 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 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 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 String attributeValue; 764 attributeValue = xpp.getAttributeValue( "", "requestID" ); 766 if ( attributeValue != null ) 767 { 768 batchResponse.setRequestID( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 769 } 770 } 771 }; 772 773 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 String attributeValue; 792 attributeValue = xpp.getAttributeValue( "", "requestID" ); 794 if ( attributeValue != null ) 795 { 796 addResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 797 } 798 attributeValue = xpp.getAttributeValue( "", "matchedDN" ); 800 if ( attributeValue != null ) 801 { 802 try 803 { 804 ldapResult.setMatchedDN( new LdapDN( attributeValue ) ); 805 } 806 catch ( InvalidNameException e ) 807 { 808 throw new XmlPullParserException( "" + e.getMessage(), xpp, null ); 809 } 810 } 811 } 812 }; 813 814 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 String attributeValue; 833 attributeValue = xpp.getAttributeValue( "", "requestID" ); 835 if ( attributeValue != null ) 836 { 837 bindResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 838 839 } 840 attributeValue = xpp.getAttributeValue( "", "matchedDN" ); 842 if ( attributeValue != null ) 843 { 844 try 845 { 846 ldapResult.setMatchedDN( new LdapDN( attributeValue ) ); 847 } 848 catch ( InvalidNameException e ) 849 { 850 throw new XmlPullParserException( "" + e.getMessage(), xpp, null ); 851 } 852 } 853 } 854 }; 855 856 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 String attributeValue; 875 attributeValue = xpp.getAttributeValue( "", "requestID" ); 877 if ( attributeValue != null ) 878 { 879 compareResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 880 } 881 attributeValue = xpp.getAttributeValue( "", "matchedDN" ); 883 if ( attributeValue != null ) 884 { 885 try 886 { 887 ldapResult.setMatchedDN( new LdapDN( attributeValue ) ); 888 } 889 catch ( InvalidNameException e ) 890 { 891 throw new XmlPullParserException( "" + e.getMessage(), xpp, null ); 892 } 893 } 894 } 895 }; 896 897 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 String attributeValue; 916 attributeValue = xpp.getAttributeValue( "", "requestID" ); 918 if ( attributeValue != null ) 919 { 920 delResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 921 } 922 attributeValue = xpp.getAttributeValue( "", "matchedDN" ); 924 if ( attributeValue != null ) 925 { 926 try 927 { 928 ldapResult.setMatchedDN( new LdapDN( attributeValue ) ); 929 } 930 catch ( InvalidNameException e ) 931 { 932 throw new XmlPullParserException( "" + e.getMessage(), xpp, null ); 933 } 934 } 935 } 936 }; 937 938 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 String attributeValue; 957 attributeValue = xpp.getAttributeValue( "", "requestID" ); 959 if ( attributeValue != null ) 960 { 961 modifyResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 962 } 963 attributeValue = xpp.getAttributeValue( "", "matchedDN" ); 965 if ( attributeValue != null ) 966 { 967 try 968 { 969 ldapResult.setMatchedDN( new LdapDN( attributeValue ) ); 970 } 971 catch ( InvalidNameException e ) 972 { 973 throw new XmlPullParserException( "" + e.getMessage(), xpp, null ); 974 } 975 } 976 } 977 }; 978 979 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 String attributeValue; 998 attributeValue = xpp.getAttributeValue( "", "requestID" ); 1000 if ( attributeValue != null ) 1001 { 1002 modifyDNResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 1003 } 1004 attributeValue = xpp.getAttributeValue( "", "matchedDN" ); 1006 if ( attributeValue != null ) 1007 { 1008 try 1009 { 1010 ldapResult.setMatchedDN( new LdapDN( attributeValue ) ); 1011 } 1012 catch ( InvalidNameException e ) 1013 { 1014 throw new XmlPullParserException( "" + e.getMessage(), xpp, null ); 1015 } 1016 } 1017 } 1018 }; 1019 1020 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 String attributeValue; 1039 attributeValue = xpp.getAttributeValue( "", "requestID" ); 1041 if ( attributeValue != null ) 1042 { 1043 extendedResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 1044 } 1045 attributeValue = xpp.getAttributeValue( "", "matchedDN" ); 1047 if ( attributeValue != null ) 1048 { 1049 try 1050 { 1051 ldapResult.setMatchedDN( new LdapDN( attributeValue ) ); 1052 } 1053 catch ( InvalidNameException e ) 1054 { 1055 throw new XmlPullParserException( "" + e.getMessage(), xpp, null ); 1056 } 1057 } 1058 } 1059 }; 1060 1061 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 String attributeValue; 1076 attributeValue = xpp.getAttributeValue( "", "requestID" ); 1078 if ( attributeValue != null ) 1079 { 1080 errorResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 1081 } 1082 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 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 nextText = xpp.nextText(); 1144 if ( !nextText.equals( "" ) ) 1145 { 1146 errorResponse.setMessage( nextText.trim() ); 1147 } 1148 } 1149 catch ( IOException e ) 1150 { 1151 throw new XmlPullParserException( e.getMessage(), xpp, null ); 1152 } 1153 } 1154 }; 1155 1156 1159 private final GrammarAction errorResponseAddDetail = null; 1161 1162 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 String attributeValue; 1178 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 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 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 if ( ldapResponse instanceof SearchResponse ) 1221 { 1222 ldapResponse = ( ( SearchResponse ) ldapResponse ).getSearchResultDone(); 1223 } 1224 1225 createAndAddControl( container, ldapResponse ); 1226 } 1227 }; 1228 1229 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 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 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 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp ); 1274 1275 String 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 e ) 1290 { 1291 throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null ); 1292 } 1293 } 1294 1295 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 if ( ldapResponse instanceof SearchResponse ) 1306 { 1307 ldapResponse = ( ( SearchResponse ) ldapResponse ).getSearchResultDone(); 1308 } 1309 1310 createAndAddControlValue( container, ldapResponse ); 1311 } 1312 }; 1313 1314 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 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 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 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 String attributeValue; 1369 attributeValue = xpp.getAttributeValue( "", "code" ); 1371 if ( attributeValue != null ) 1372 { 1373 try 1374 { 1375 ldapResult.setResultCode( ResultCodeEnum.getResultCode( Integer.parseInt( attributeValue ) ) ); 1376 } 1377 catch ( NumberFormatException 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 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 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 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 nextText = xpp.nextText(); 1427 if ( !nextText.equals( "" ) ) 1428 { 1429 ldapResult.setErrorMessage( nextText.trim() ); 1430 } 1431 } 1432 catch ( IOException e ) 1433 { 1434 throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null ); 1435 } 1436 } 1437 }; 1438 1439 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 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 if ( ldapResult.getReferrals() == null ) 1464 { 1465 ldapResult.initReferrals(); 1466 } 1467 1468 XmlPullParser xpp = container.getParser(); 1469 try 1470 { 1471 String 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 e ) 1485 { 1486 throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null ); 1487 } 1488 } 1489 }; 1490 1491 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 String attributeValue; 1506 attributeValue = xpp.getAttributeValue( "", "requestID" ); 1508 if ( attributeValue != null ) 1509 { 1510 searchResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 1511 } 1512 } 1513 }; 1514 1515 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 String attributeValue; 1533 attributeValue = xpp.getAttributeValue( "", "requestID" ); 1535 if ( attributeValue != null ) 1536 { 1537 searchResultEntry.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 1538 } 1539 attributeValue = xpp.getAttributeValue( "", "dn" ); 1541 if ( attributeValue != null ) 1542 { 1543 try 1544 { 1545 searchResultEntry.setObjectName( new LdapDN( attributeValue ) ); 1546 } 1547 catch ( InvalidNameException 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 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 String attributeValue; 1577 attributeValue = xpp.getAttributeValue( "", "requestID" ); 1579 if ( attributeValue != null ) 1580 { 1581 searchResultReference.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 1582 } 1583 } 1584 }; 1585 1586 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 String attributeValue; 1606 attributeValue = xpp.getAttributeValue( "", "requestID" ); 1608 if ( attributeValue != null ) 1609 { 1610 searchResultDone.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) ); 1611 } 1612 attributeValue = xpp.getAttributeValue( "", "matchedDN" ); 1614 if ( attributeValue != null ) 1615 { 1616 try 1617 { 1618 searchResultDone.getLdapResult().setMatchedDN( new LdapDN( attributeValue ) ); 1619 } 1620 catch ( InvalidNameException e ) 1621 { 1622 throw new XmlPullParserException( "" + e.getMessage(), xpp, null ); 1623 } 1624 } 1625 } 1626 }; 1627 1628 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 String attributeValue; 1643 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 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 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp ); 1672 1673 String 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 e ) 1685 { 1686 throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null ); 1687 } 1688 } 1689 }; 1690 1691 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 nextText = xpp.nextText(); 1706 if ( !nextText.equals( "" ) ) 1707 { 1708 searchResultReference.addSearchResultReference( new LdapURL( nextText ) ); 1709 } 1710 } 1711 catch ( IOException 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 1725 private final GrammarAction extendedResponseAddResultCode = ldapResultAddResultCode; 1726 1727 1730 private final GrammarAction extendedResponseAddErrorMessage = ldapResultAddErrorMessage; 1731 1732 1735 private final GrammarAction extendedResponseAddReferral = ldapResultAddReferral; 1736 1737 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 nextText = xpp.nextText(); 1751 if ( !nextText.equals( "" ) ) 1752 { 1753 extendedResponse.setResponseName( new OID( nextText.trim() ) ); 1754 } 1755 1756 } 1757 catch ( IOException 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 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 String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp ); 1782 1783 String 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 e ) 1795 { 1796 throw new XmlPullParserException( "An unexpected error ocurred : " + e.getMessage(), xpp, null ); 1797 } 1798 } 1799 }; 1800 1801 1802 1808 public static Dsmlv2ResponseGrammar getInstance() 1809 { 1810 return instance; 1811 } 1812} 1813 | Popular Tags |