View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.ldap.trigger;
21  
22  
23  import org.apache.directory.api.ldap.model.name.Dn;
24  
25  
26  /**
27   * An entity that represents a stored procedure parameter which can be
28   * specified in an LDAP Trigger Specification.
29   * 
30   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
31   */
32  public abstract class StoredProcedureParameter
33  {
34      public static final class Generic_LDAP_CONTEXT extends StoredProcedureParameter
35      {
36          private Dn ctxName;
37  
38  
39          private Generic_LDAP_CONTEXT( Dn ctxName )
40          {
41              super( "$ldapContext" );
42              this.ctxName = ctxName;
43          }
44  
45  
46          public static StoredProcedureParameter instance( Dn ctxName )
47          {
48              return new Generic_LDAP_CONTEXT( ctxName );
49          }
50  
51  
52          public Dn getCtxName()
53          {
54              return ctxName;
55          }
56  
57  
58          public String toString()
59          {
60              return name + " \"" + ctxName.getName() + "\"";
61          }
62      }
63  
64      public static final class Generic_OPERATION_PRINCIPAL extends StoredProcedureParameter
65      {
66          private static Generic_OPERATION_PRINCIPAL instance = new Generic_OPERATION_PRINCIPAL( "$operationPrincipal" );
67  
68  
69          private Generic_OPERATION_PRINCIPAL( String identifier )
70          {
71              super( identifier );
72          }
73  
74  
75          public static StoredProcedureParameter instance()
76          {
77              return instance;
78          }
79      }
80  
81      protected final String name;
82  
83  
84      protected StoredProcedureParameter( String name )
85      {
86          this.name = name;
87      }
88  
89  
90      /**
91       * Returns the name of this Stored Procedure Parameter.
92       */
93      public String getName()
94      {
95          return name;
96      }
97  
98  
99      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 }