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 public static final class Generic_LDAP_CONTEXT extends StoredProcedureParameter 035 { 036 private Dn ctxName; 037 038 039 private Generic_LDAP_CONTEXT( Dn ctxName ) 040 { 041 super( "$ldapContext" ); 042 this.ctxName = ctxName; 043 } 044 045 046 public static StoredProcedureParameter instance( Dn ctxName ) 047 { 048 return new Generic_LDAP_CONTEXT( ctxName ); 049 } 050 051 052 public Dn getCtxName() 053 { 054 return ctxName; 055 } 056 057 058 public String toString() 059 { 060 return name + " \"" + ctxName.getName() + "\""; 061 } 062 } 063 064 public static final class Generic_OPERATION_PRINCIPAL extends StoredProcedureParameter 065 { 066 private static Generic_OPERATION_PRINCIPAL instance = new Generic_OPERATION_PRINCIPAL( "$operationPrincipal" ); 067 068 069 private Generic_OPERATION_PRINCIPAL( String identifier ) 070 { 071 super( identifier ); 072 } 073 074 075 public static StoredProcedureParameter instance() 076 { 077 return instance; 078 } 079 } 080 081 protected final String name; 082 083 084 protected StoredProcedureParameter( String name ) 085 { 086 this.name = name; 087 } 088 089 090 /** 091 * Returns the name of this Stored Procedure Parameter. 092 */ 093 public String getName() 094 { 095 return name; 096 } 097 098 099 public String toString() 100 { 101 return name; 102 } 103 104 105 /** 106 * @see java.lang.Object#hashCode() 107 * @return the instance's hash code 108 */ 109 public int hashCode() 110 { 111 int h = 37; 112 113 h = h * 17 + ( ( name == null ) ? 0 : name.hashCode() ); 114 115 return h; 116 } 117 118 119 /** 120 * @see java.lang.Object#equals(java.lang.Object) 121 */ 122 public boolean equals( Object obj ) 123 { 124 if ( this == obj ) 125 { 126 return true; 127 } 128 if ( obj == null ) 129 { 130 return false; 131 } 132 if ( getClass() != obj.getClass() ) 133 { 134 return false; 135 } 136 final StoredProcedureParameter other = ( StoredProcedureParameter ) obj; 137 if ( name == null ) 138 { 139 if ( other.name != null ) 140 { 141 return false; 142 } 143 } 144 else if ( !name.equals( other.name ) ) 145 { 146 return false; 147 } 148 return true; 149 } 150 151 public static final class Modify_OBJECT extends StoredProcedureParameter 152 { 153 private static Modify_OBJECT instance = new Modify_OBJECT( "$object" ); 154 155 156 private Modify_OBJECT( String identifier ) 157 { 158 super( identifier ); 159 } 160 161 162 public static StoredProcedureParameter instance() 163 { 164 return instance; 165 } 166 } 167 168 public static final class Modify_MODIFICATION extends StoredProcedureParameter 169 { 170 private static Modify_MODIFICATION instance = new Modify_MODIFICATION( "$modification" ); 171 172 173 private Modify_MODIFICATION( String identifier ) 174 { 175 super( identifier ); 176 } 177 178 179 public static StoredProcedureParameter instance() 180 { 181 return instance; 182 } 183 } 184 185 public static final class Modify_OLD_ENTRY extends StoredProcedureParameter 186 { 187 private static Modify_OLD_ENTRY instance = new Modify_OLD_ENTRY( "$oldEntry" ); 188 189 190 private Modify_OLD_ENTRY( String identifier ) 191 { 192 super( identifier ); 193 } 194 195 196 public static StoredProcedureParameter instance() 197 { 198 return instance; 199 } 200 } 201 202 public static final class Modify_NEW_ENTRY extends StoredProcedureParameter 203 { 204 private static Modify_NEW_ENTRY instance = new Modify_NEW_ENTRY( "$newEntry" ); 205 206 207 private Modify_NEW_ENTRY( String identifier ) 208 { 209 super( identifier ); 210 } 211 212 213 public static StoredProcedureParameter instance() 214 { 215 return instance; 216 } 217 } 218 219 public static final class Add_ENTRY extends StoredProcedureParameter 220 { 221 private static Add_ENTRY instance = new Add_ENTRY( "$entry" ); 222 223 224 private Add_ENTRY( String identifier ) 225 { 226 super( identifier ); 227 } 228 229 230 public static StoredProcedureParameter instance() 231 { 232 return instance; 233 } 234 } 235 236 public static final class Add_ATTRIBUTES extends StoredProcedureParameter 237 { 238 private static Add_ATTRIBUTES instance = new Add_ATTRIBUTES( "$attributes" ); 239 240 241 private Add_ATTRIBUTES( String identifier ) 242 { 243 super( identifier ); 244 } 245 246 247 public static StoredProcedureParameter instance() 248 { 249 return instance; 250 } 251 } 252 253 public static final class Delete_NAME extends StoredProcedureParameter 254 { 255 private static Delete_NAME instance = new Delete_NAME( "$name" ); 256 257 258 private Delete_NAME( String identifier ) 259 { 260 super( identifier ); 261 } 262 263 264 public static StoredProcedureParameter instance() 265 { 266 return instance; 267 } 268 } 269 270 public static final class Delete_DELETED_ENTRY extends StoredProcedureParameter 271 { 272 private static Delete_DELETED_ENTRY instance = new Delete_DELETED_ENTRY( "$deletedEntry" ); 273 274 275 private Delete_DELETED_ENTRY( String identifier ) 276 { 277 super( identifier ); 278 } 279 280 281 public static StoredProcedureParameter instance() 282 { 283 return instance; 284 } 285 } 286 287 public static final class ModifyDN_ENTRY extends StoredProcedureParameter 288 { 289 private static ModifyDN_ENTRY instance = new ModifyDN_ENTRY( "$entry" ); 290 291 292 private ModifyDN_ENTRY( String identifier ) 293 { 294 super( identifier ); 295 } 296 297 298 public static StoredProcedureParameter instance() 299 { 300 return instance; 301 } 302 } 303 304 public static final class ModifyDN_NEW_RDN extends StoredProcedureParameter 305 { 306 private static ModifyDN_NEW_RDN instance = new ModifyDN_NEW_RDN( "$newrdn" ); 307 308 309 private ModifyDN_NEW_RDN( String identifier ) 310 { 311 super( identifier ); 312 } 313 314 315 public static StoredProcedureParameter instance() 316 { 317 return instance; 318 } 319 } 320 321 public static final class ModifyDN_DELETE_OLD_RDN extends StoredProcedureParameter 322 { 323 private static ModifyDN_DELETE_OLD_RDN instance = new ModifyDN_DELETE_OLD_RDN( "$deleteoldrdn" ); 324 325 326 private ModifyDN_DELETE_OLD_RDN( String identifier ) 327 { 328 super( identifier ); 329 } 330 331 332 public static StoredProcedureParameter instance() 333 { 334 return instance; 335 } 336 } 337 338 public static final class ModifyDN_NEW_SUPERIOR extends StoredProcedureParameter 339 { 340 private static ModifyDN_NEW_SUPERIOR instance = new ModifyDN_NEW_SUPERIOR( "$newSuperior" ); 341 342 343 private ModifyDN_NEW_SUPERIOR( String identifier ) 344 { 345 super( identifier ); 346 } 347 348 349 public static StoredProcedureParameter instance() 350 { 351 return instance; 352 } 353 } 354 355 public static final class ModifyDN_OLD_RDN extends StoredProcedureParameter 356 { 357 private static ModifyDN_OLD_RDN instance = new ModifyDN_OLD_RDN( "$oldRDN" ); 358 359 360 private ModifyDN_OLD_RDN( String identifier ) 361 { 362 super( identifier ); 363 } 364 365 366 public static StoredProcedureParameter instance() 367 { 368 return instance; 369 } 370 } 371 372 public static final class ModifyDN_OLD_SUPERIOR_DN extends StoredProcedureParameter 373 { 374 private static ModifyDN_OLD_SUPERIOR_DN instance = new ModifyDN_OLD_SUPERIOR_DN( "$oldRDN" ); 375 376 377 private ModifyDN_OLD_SUPERIOR_DN( String identifier ) 378 { 379 super( identifier ); 380 } 381 382 383 public static StoredProcedureParameter instance() 384 { 385 return instance; 386 } 387 } 388 389 public static final class ModifyDN_NEW_DN extends StoredProcedureParameter 390 { 391 private static ModifyDN_NEW_DN instance = new ModifyDN_NEW_DN( "$oldRDN" ); 392 393 394 private ModifyDN_NEW_DN( String identifier ) 395 { 396 super( identifier ); 397 } 398 399 400 public static StoredProcedureParameter instance() 401 { 402 return instance; 403 } 404 } 405}