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.model.schema;
21  
22  
23  import org.apache.directory.api.ldap.model.constants.SchemaConstants;
24  
25  
26  /**
27   * The SchemaObject types
28   *
29   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
30   */
31  public enum SchemaObjectType
32  {
33      ATTRIBUTE_TYPE(0),
34      COMPARATOR(1),
35      DIT_CONTENT_RULE(2),
36      DIT_STRUCTURE_RULE(3),
37      LDAP_SYNTAX(4),
38      MATCHING_RULE(5),
39      MATCHING_RULE_USE(6),
40      NAME_FORM(7),
41      NORMALIZER(8),
42      OBJECT_CLASS(9),
43      SYNTAX_CHECKER(10);
44  
45      /** The inner value*/
46      private int value;
47  
48  
49      /**
50       * A private constructor to associated a number to the type
51       */
52      private SchemaObjectType( int value )
53      {
54          this.value = value;
55      }
56  
57  
58      /**
59       * @return The numeric value for this type
60       */
61      public int getValue()
62      {
63          return value;
64      }
65  
66  
67      /**
68       * Get the Rdn associated with a schemaObjectType
69       *
70       * @return The associated Rdn
71       */
72      public String getRdn()
73      {
74          String schemaObjectPath = null;
75  
76          switch ( this )
77          {
78              case ATTRIBUTE_TYPE:
79                  schemaObjectPath = SchemaConstants.ATTRIBUTE_TYPES_PATH;
80                  break;
81  
82              case COMPARATOR:
83                  schemaObjectPath = SchemaConstants.COMPARATORS_PATH;
84                  break;
85  
86              case DIT_CONTENT_RULE:
87                  schemaObjectPath = SchemaConstants.DIT_CONTENT_RULES_PATH;
88                  break;
89  
90              case DIT_STRUCTURE_RULE:
91                  schemaObjectPath = SchemaConstants.DIT_STRUCTURE_RULES_PATH;
92                  break;
93  
94              case LDAP_SYNTAX:
95                  schemaObjectPath = SchemaConstants.SYNTAXES_PATH;
96                  break;
97  
98              case MATCHING_RULE:
99                  schemaObjectPath = SchemaConstants.MATCHING_RULES_PATH;
100                 break;
101 
102             case MATCHING_RULE_USE:
103                 schemaObjectPath = SchemaConstants.MATCHING_RULE_USE_PATH;
104                 break;
105 
106             case NAME_FORM:
107                 schemaObjectPath = SchemaConstants.NAME_FORMS_PATH;
108                 break;
109 
110             case NORMALIZER:
111                 schemaObjectPath = SchemaConstants.NORMALIZERS_PATH;
112                 break;
113 
114             case OBJECT_CLASS:
115                 schemaObjectPath = SchemaConstants.OBJECT_CLASSES_PATH;
116                 break;
117 
118             case SYNTAX_CHECKER:
119                 schemaObjectPath = SchemaConstants.SYNTAX_CHECKERS_PATH;
120                 break;
121         }
122 
123         return schemaObjectPath;
124     }
125 }