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 ATTRIBUTE_TYPE(0), 034 COMPARATOR(1), 035 DIT_CONTENT_RULE(2), 036 DIT_STRUCTURE_RULE(3), 037 LDAP_SYNTAX(4), 038 MATCHING_RULE(5), 039 MATCHING_RULE_USE(6), 040 NAME_FORM(7), 041 NORMALIZER(8), 042 OBJECT_CLASS(9), 043 SYNTAX_CHECKER(10); 044 045 /** The inner value*/ 046 private int value; 047 048 049 /** 050 * A private constructor to associated a number to the type 051 */ 052 private SchemaObjectType( int value ) 053 { 054 this.value = value; 055 } 056 057 058 /** 059 * @return The numeric value for this type 060 */ 061 public int getValue() 062 { 063 return value; 064 } 065 066 067 /** 068 * Get the Rdn associated with a schemaObjectType 069 * 070 * @return The associated Rdn 071 */ 072 public String getRdn() 073 { 074 String schemaObjectPath = null; 075 076 switch ( this ) 077 { 078 case ATTRIBUTE_TYPE: 079 schemaObjectPath = SchemaConstants.ATTRIBUTE_TYPES_PATH; 080 break; 081 082 case COMPARATOR: 083 schemaObjectPath = SchemaConstants.COMPARATORS_PATH; 084 break; 085 086 case DIT_CONTENT_RULE: 087 schemaObjectPath = SchemaConstants.DIT_CONTENT_RULES_PATH; 088 break; 089 090 case DIT_STRUCTURE_RULE: 091 schemaObjectPath = SchemaConstants.DIT_STRUCTURE_RULES_PATH; 092 break; 093 094 case LDAP_SYNTAX: 095 schemaObjectPath = SchemaConstants.SYNTAXES_PATH; 096 break; 097 098 case MATCHING_RULE: 099 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}