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.model.schema; 021 022 023import org.apache.directory.api.ldap.model.constants.SchemaConstants; 024 025 026/** 027 * The SchemaObject types 028 * 029 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 030 */ 031public enum SchemaObjectType 032{ 033 /** An AttributeType */ 034 ATTRIBUTE_TYPE(0), 035 036 /** A Comparator */ 037 COMPARATOR(1), 038 039 /** */ 040 DIT_CONTENT_RULE(2), 041 042 /** */ 043 DIT_STRUCTURE_RULE(3), 044 045 /** A Syntax */ 046 LDAP_SYNTAX(4), 047 048 /** A MatchingRule */ 049 MATCHING_RULE(5), 050 051 /** A MatchingRuleUse */ 052 MATCHING_RULE_USE(6), 053 054 /** A NameForm */ 055 NAME_FORM(7), 056 057 /** A Normalizer */ 058 NORMALIZER(8), 059 060 /** An ObjectClass */ 061 OBJECT_CLASS(9), 062 063 /** A SyntaxChecker */ 064 SYNTAX_CHECKER(10); 065 066 /** The inner value*/ 067 private int value; 068 069 070 /** 071 * A private constructor to associated a number to the type 072 */ 073 SchemaObjectType( int value ) 074 { 075 this.value = value; 076 } 077 078 079 /** 080 * @return The numeric value for this type 081 */ 082 public int getValue() 083 { 084 return value; 085 } 086 087 088 /** 089 * Get the Rdn associated with a schemaObjectType 090 * 091 * @return The associated Rdn 092 */ 093 public String getRdn() 094 { 095 String schemaObjectPath; 096 097 switch ( this ) 098 { 099 case ATTRIBUTE_TYPE: 100 schemaObjectPath = SchemaConstants.ATTRIBUTE_TYPES_PATH; 101 break; 102 103 case COMPARATOR: 104 schemaObjectPath = SchemaConstants.COMPARATORS_PATH; 105 break; 106 107 case DIT_CONTENT_RULE: 108 schemaObjectPath = SchemaConstants.DIT_CONTENT_RULES_PATH; 109 break; 110 111 case DIT_STRUCTURE_RULE: 112 schemaObjectPath = SchemaConstants.DIT_STRUCTURE_RULES_PATH; 113 break; 114 115 case LDAP_SYNTAX: 116 schemaObjectPath = SchemaConstants.SYNTAXES_PATH; 117 break; 118 119 case MATCHING_RULE: 120 schemaObjectPath = SchemaConstants.MATCHING_RULES_PATH; 121 break; 122 123 case MATCHING_RULE_USE: 124 schemaObjectPath = SchemaConstants.MATCHING_RULE_USE_PATH; 125 break; 126 127 case NAME_FORM: 128 schemaObjectPath = SchemaConstants.NAME_FORMS_PATH; 129 break; 130 131 case NORMALIZER: 132 schemaObjectPath = SchemaConstants.NORMALIZERS_PATH; 133 break; 134 135 case OBJECT_CLASS: 136 schemaObjectPath = SchemaConstants.OBJECT_CLASSES_PATH; 137 break; 138 139 case SYNTAX_CHECKER: 140 schemaObjectPath = SchemaConstants.SYNTAX_CHECKERS_PATH; 141 break; 142 143 default: 144 throw new IllegalArgumentException( "Unexpected SchemaObjectType " + this ); 145 } 146 147 return schemaObjectPath; 148 } 149}