001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.api.ldap.trigger; 021 022 023import org.apache.directory.api.ldap.model.name.Dn; 024 025 026/** 027 * An entity that represents a stored procedure parameter which can be 028 * specified in an LDAP Trigger Specification. 029 * 030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 031 */ 032public abstract class StoredProcedureParameter 033{ 034 /** 035 * The generic LdapContext factory 036 */ 037 public static final class Generic_LDAP_CONTEXT extends StoredProcedureParameter 038 { 039 private Dn ctxName; 040 041 042 private Generic_LDAP_CONTEXT( Dn ctxName ) 043 { 044 super( "$ldapContext" ); 045 this.ctxName = ctxName; 046 } 047 048 049 /** 050 * Creates a new instance of StoredProcedureParameter 051 * 052 * @param ctxName The context name 053 * @return A new instance of StoredProcedureParameter 054 */ 055 public static StoredProcedureParameter instance( Dn ctxName ) 056 { 057 return new Generic_LDAP_CONTEXT( ctxName ); 058 } 059 060 061 /** 062 * @return The context name 063 */ 064 public Dn getCtxName() 065 { 066 return ctxName; 067 } 068 069 070 /** 071 * @see Object#toString() 072 */ 073 @Override 074 public String toString() 075 { 076 return name + " \"" + ctxName.getName() + "\""; 077 } 078 } 079 080 081 /** 082 * The generic Operation Principal factory 083 */ 084 public static final class Generic_OPERATION_PRINCIPAL extends StoredProcedureParameter 085 { 086 private static Generic_OPERATION_PRINCIPAL instance = new Generic_OPERATION_PRINCIPAL( "$operationPrincipal" ); 087 088 089 private Generic_OPERATION_PRINCIPAL( String identifier ) 090 { 091 super( identifier ); 092 } 093 094 095 /** 096 * @return The generic Operation Principal instance 097 */ 098 public static StoredProcedureParameter instance() 099 { 100 return instance; 101 } 102 } 103 104 protected final String name; 105 106 107 protected StoredProcedureParameter( String name ) 108 { 109 this.name = name; 110 } 111 112 113 /** 114 * @return the name of this Stored Procedure Parameter. 115 */ 116 public String getName() 117 { 118 return name; 119 } 120 121 122 @Override 123 public String toString() 124 { 125 return name; 126 } 127 128 129 /** 130 * @see java.lang.Object#hashCode() 131 * @return the instance's hash code 132 */ 133 @Override 134 public int hashCode() 135 { 136 int h = 37; 137 138 h = h * 17 + ( ( name == null ) ? 0 : name.hashCode() ); 139 140 return h; 141 } 142 143 144 /** 145 * @see java.lang.Object#equals(java.lang.Object) 146 */ 147 @Override 148 public boolean equals( Object obj ) 149 { 150 if ( this == obj ) 151 { 152 return true; 153 } 154 155 if ( obj == null ) 156 { 157 return false; 158 } 159 160 if ( getClass() != obj.getClass() ) 161 { 162 return false; 163 } 164 165 StoredProcedureParameter other = ( StoredProcedureParameter ) obj; 166 167 if ( name == null ) 168 { 169 if ( other.name != null ) 170 { 171 return false; 172 } 173 } 174 else if ( !name.equals( other.name ) ) 175 { 176 return false; 177 } 178 179 return true; 180 } 181 182 183 /** 184 * The Modify Object factory 185 */ 186 public static final class Modify_OBJECT extends StoredProcedureParameter 187 { 188 private static Modify_OBJECT instance = new Modify_OBJECT( "$object" ); 189 190 191 private Modify_OBJECT( String identifier ) 192 { 193 super( identifier ); 194 } 195 196 197 /** 198 * @return The Modify Object instance 199 */ 200 public static StoredProcedureParameter instance() 201 { 202 return instance; 203 } 204 } 205 206 207 /** 208 * The Modify Modification factory 209 */ 210 public static final class Modify_MODIFICATION extends StoredProcedureParameter 211 { 212 private static Modify_MODIFICATION instance = new Modify_MODIFICATION( "$modification" ); 213 214 215 private Modify_MODIFICATION( String identifier ) 216 { 217 super( identifier ); 218 } 219 220 221 /** 222 * @return The Modify Modification instance 223 */ 224 public static StoredProcedureParameter instance() 225 { 226 return instance; 227 } 228 } 229 230 231 /** 232 * The Modify Old Entry factory 233 */ 234 public static final class Modify_OLD_ENTRY extends StoredProcedureParameter 235 { 236 private static Modify_OLD_ENTRY instance = new Modify_OLD_ENTRY( "$oldEntry" ); 237 238 239 private Modify_OLD_ENTRY( String identifier ) 240 { 241 super( identifier ); 242 } 243 244 245 /** 246 * @return The Modify Old Entry instance 247 */ 248 public static StoredProcedureParameter instance() 249 { 250 return instance; 251 } 252 } 253 254 255 /** 256 * The Modify New Entry factory 257 */ 258 public static final class Modify_NEW_ENTRY extends StoredProcedureParameter 259 { 260 private static Modify_NEW_ENTRY instance = new Modify_NEW_ENTRY( "$newEntry" ); 261 262 263 private Modify_NEW_ENTRY( String identifier ) 264 { 265 super( identifier ); 266 } 267 268 269 /** 270 * @return The Modify New Entry instance 271 */ 272 public static StoredProcedureParameter instance() 273 { 274 return instance; 275 } 276 } 277 278 279 /** 280 * The Add Entry factory 281 */ 282 public static final class Add_ENTRY extends StoredProcedureParameter 283 { 284 private static Add_ENTRY instance = new Add_ENTRY( "$entry" ); 285 286 287 private Add_ENTRY( String identifier ) 288 { 289 super( identifier ); 290 } 291 292 293 /** 294 * @return The Add Entry instance 295 */ 296 public static StoredProcedureParameter instance() 297 { 298 return instance; 299 } 300 } 301 302 303 /** 304 * The Add Attributes factory 305 */ 306 public static final class Add_ATTRIBUTES extends StoredProcedureParameter 307 { 308 private static Add_ATTRIBUTES instance = new Add_ATTRIBUTES( "$attributes" ); 309 310 311 private Add_ATTRIBUTES( String identifier ) 312 { 313 super( identifier ); 314 } 315 316 317 /** 318 * @return The Add Attributes instance 319 */ 320 public static StoredProcedureParameter instance() 321 { 322 return instance; 323 } 324 } 325 326 327 /** 328 * The Delete Name factory 329 */ 330 public static final class Delete_NAME extends StoredProcedureParameter 331 { 332 private static Delete_NAME instance = new Delete_NAME( "$name" ); 333 334 335 private Delete_NAME( String identifier ) 336 { 337 super( identifier ); 338 } 339 340 341 /** 342 * @return The Delete Name instance 343 */ 344 public static StoredProcedureParameter instance() 345 { 346 return instance; 347 } 348 } 349 350 351 /** 352 * The Delete Deleted factory 353 */ 354 public static final class Delete_DELETED_ENTRY extends StoredProcedureParameter 355 { 356 private static Delete_DELETED_ENTRY instance = new Delete_DELETED_ENTRY( "$deletedEntry" ); 357 358 359 private Delete_DELETED_ENTRY( String identifier ) 360 { 361 super( identifier ); 362 } 363 364 365 /** 366 * @return The Delete Deleted instance 367 */ 368 public static StoredProcedureParameter instance() 369 { 370 return instance; 371 } 372 } 373 374 375 /** 376 * The Modify DN Entry factory 377 */ 378 public static final class ModifyDN_ENTRY extends StoredProcedureParameter 379 { 380 private static ModifyDN_ENTRY instance = new ModifyDN_ENTRY( "$entry" ); 381 382 383 private ModifyDN_ENTRY( String identifier ) 384 { 385 super( identifier ); 386 } 387 388 389 /** 390 * @return The Modify DN Entry instance 391 */ 392 public static StoredProcedureParameter instance() 393 { 394 return instance; 395 } 396 } 397 398 399 /** 400 * The Modify New Rdn factory 401 */ 402 public static final class ModifyDN_NEW_RDN extends StoredProcedureParameter 403 { 404 private static ModifyDN_NEW_RDN instance = new ModifyDN_NEW_RDN( "$newrdn" ); 405 406 407 private ModifyDN_NEW_RDN( String identifier ) 408 { 409 super( identifier ); 410 } 411 412 413 /** 414 * @return The Modify New Rdn instance 415 */ 416 public static StoredProcedureParameter instance() 417 { 418 return instance; 419 } 420 } 421 422 423 /** 424 * The Modify DN Delete Old RDN factory 425 */ 426 public static final class ModifyDN_DELETE_OLD_RDN extends StoredProcedureParameter 427 { 428 private static ModifyDN_DELETE_OLD_RDN instance = new ModifyDN_DELETE_OLD_RDN( "$deleteoldrdn" ); 429 430 431 private ModifyDN_DELETE_OLD_RDN( String identifier ) 432 { 433 super( identifier ); 434 } 435 436 437 /** 438 * @return The Modify DN Delete Old RDN instance 439 */ 440 public static StoredProcedureParameter instance() 441 { 442 return instance; 443 } 444 } 445 446 447 /** 448 * The Modify DN New Superior factory 449 */ 450 public static final class ModifyDN_NEW_SUPERIOR extends StoredProcedureParameter 451 { 452 private static ModifyDN_NEW_SUPERIOR instance = new ModifyDN_NEW_SUPERIOR( "$newSuperior" ); 453 454 455 private ModifyDN_NEW_SUPERIOR( String identifier ) 456 { 457 super( identifier ); 458 } 459 460 461 /** 462 * @return The Modify DN New Superior instance 463 */ 464 public static StoredProcedureParameter instance() 465 { 466 return instance; 467 } 468 } 469 470 471 /** 472 * The Modify DN Old RDN factory 473 */ 474 public static final class ModifyDN_OLD_RDN extends StoredProcedureParameter 475 { 476 private static ModifyDN_OLD_RDN instance = new ModifyDN_OLD_RDN( "$oldRDN" ); 477 478 479 private ModifyDN_OLD_RDN( String identifier ) 480 { 481 super( identifier ); 482 } 483 484 485 /** 486 * @return The Modify DN Old RDN instance 487 */ 488 public static StoredProcedureParameter instance() 489 { 490 return instance; 491 } 492 } 493 494 495 /** 496 * The Modify DN Old Superior DN factory 497 */ 498 public static final class ModifyDN_OLD_SUPERIOR_DN extends StoredProcedureParameter 499 { 500 private static ModifyDN_OLD_SUPERIOR_DN instance = new ModifyDN_OLD_SUPERIOR_DN( "$oldRDN" ); 501 502 503 private ModifyDN_OLD_SUPERIOR_DN( String identifier ) 504 { 505 super( identifier ); 506 } 507 508 509 /** 510 * @return The Modify DN Old Superior DN instance 511 */ 512 public static StoredProcedureParameter instance() 513 { 514 return instance; 515 } 516 } 517 518 519 /** 520 * The Modify DN New DN factory 521 */ 522 public static final class ModifyDN_NEW_DN extends StoredProcedureParameter 523 { 524 private static ModifyDN_NEW_DN instance = new ModifyDN_NEW_DN( "$oldRDN" ); 525 526 527 private ModifyDN_NEW_DN( String identifier ) 528 { 529 super( identifier ); 530 } 531 532 533 /** 534 * @return The Modify DN New DN instance 535 */ 536 public static StoredProcedureParameter instance() 537 { 538 return instance; 539 } 540 } 541}