001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2009 Sun Microsystems, Inc. 015 * Portions Copyright 2016 ForgeRock AS. 016 */ 017 018package org.forgerock.opendj.ldap.schema; 019 020/** 021 * This enumeration defines the set of possible attribute usage values that may 022 * apply to an attribute type, as defined in RFC 2252. 023 * 024 * @see <a href="http://tools.ietf.org/html/rfc2252">RFC 2252 - Lightweight 025 * Directory Access Protocol (v3): Attribute Syntax Definitions</a> 026 */ 027public enum AttributeUsage { 028 /** The attribute usage intended for user-defined attribute types. */ 029 USER_APPLICATIONS("userApplications", false), 030 /** The attribute usage intended for standard operational attributes. */ 031 DIRECTORY_OPERATION("directoryOperation", true), 032 /** 033 * The attribute usage intended for non-standard operational attributes 034 * shared among multiple DSAs. 035 */ 036 DISTRIBUTED_OPERATION("distributedOperation", true), 037 /** 038 * The attribute usage intended for non-standard operational attributes used 039 * by a single DSA. 040 */ 041 DSA_OPERATION("dSAOperation", true); 042 043 /** The string representation of this attribute usage. */ 044 private final String usageString; 045 046 /** Flag indicating whether the usage should be categorized as operational. */ 047 private final boolean isOperational; 048 049 /** 050 * Creates a new attribute usage with the provided string representation. 051 * 052 * @param usageString 053 * The string representation of this attribute usage. 054 * @param isOperational 055 * <code>true</code> if attributes having this attribute usage 056 * are operational, or <code>false</code> otherwise. 057 */ 058 private AttributeUsage(final String usageString, final boolean isOperational) { 059 this.usageString = usageString; 060 this.isOperational = isOperational; 061 } 062 063 /** 064 * Determine whether attributes having this attribute usage are operational. 065 * 066 * @return Returns <code>true</code> if attributes having this attribute 067 * usage are operational, or <code>false</code> otherwise. 068 */ 069 public boolean isOperational() { 070 return isOperational; 071 } 072 073 /** 074 * Retrieves a string representation of this attribute usage. 075 * 076 * @return A string representation of this attribute usage. 077 */ 078 @Override 079 public String toString() { 080 return usageString; 081 } 082}