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 */ 020 package org.apache.directory.shared.ldap.schema; 021 022 import org.apache.directory.shared.ldap.constants.SchemaConstants; 023 024 /** 025 * The SchemaObject types 026 * 027 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 028 * @version $Rev$, $Date$ 029 */ 030 public enum SchemaObjectType 031 { 032 ATTRIBUTE_TYPE(0), 033 COMPARATOR(1), 034 DIT_CONTENT_RULE(2), 035 DIT_STRUCTURE_RULE(3), 036 LDAP_SYNTAX(4), 037 MATCHING_RULE(5), 038 MATCHING_RULE_USE(6), 039 NAME_FORM(7), 040 NORMALIZER(8), 041 OBJECT_CLASS(9), 042 SYNTAX_CHECKER(10); 043 044 /** The inner value*/ 045 private int value; 046 047 /** 048 * A private constructor to associated a number to the type 049 */ 050 private SchemaObjectType( int value ) 051 { 052 this.value = value; 053 } 054 055 /** 056 * @return The numeric value for this type 057 */ 058 public int getValue() 059 { 060 return value; 061 } 062 063 064 /** 065 * Get the RDN associated with a schemaObjectType 066 * 067 * @param schemaObjectType The type we want the RDN for 068 * @return The associated RDN 069 */ 070 public String getRdn() 071 { 072 String schemaObjectPath = null; 073 074 switch ( this ) 075 { 076 case ATTRIBUTE_TYPE : 077 schemaObjectPath = SchemaConstants.ATTRIBUTES_TYPE_PATH; 078 break; 079 080 case COMPARATOR : 081 schemaObjectPath = SchemaConstants.COMPARATORS_PATH; 082 break; 083 084 case DIT_CONTENT_RULE : 085 schemaObjectPath = SchemaConstants.DIT_CONTENT_RULES_PATH; 086 break; 087 088 case DIT_STRUCTURE_RULE : 089 schemaObjectPath = SchemaConstants.DIT_STRUCTURE_RULES_PATH; 090 break; 091 092 case LDAP_SYNTAX : 093 schemaObjectPath = SchemaConstants.SYNTAXES_PATH; 094 break; 095 096 case MATCHING_RULE : 097 schemaObjectPath = SchemaConstants.MATCHING_RULES_PATH; 098 break; 099 100 case MATCHING_RULE_USE : 101 schemaObjectPath = SchemaConstants.MATCHING_RULE_USE_PATH; 102 break; 103 104 case NAME_FORM : 105 schemaObjectPath = SchemaConstants.NAME_FORMS_PATH; 106 break; 107 108 case NORMALIZER : 109 schemaObjectPath = SchemaConstants.NORMALIZERS_PATH; 110 break; 111 112 case OBJECT_CLASS : 113 schemaObjectPath = SchemaConstants.OBJECT_CLASSES_PATH; 114 break; 115 116 case SYNTAX_CHECKER : 117 schemaObjectPath = SchemaConstants.SYNTAX_CHECKERS_PATH; 118 break; 119 } 120 121 return schemaObjectPath; 122 } 123 }