001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2006-2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.types;
028    
029    
030    
031    /**
032     * This enumeration defines the set of possible attribute usage values
033     * that may apply to an attribute type, as defined in RFC 2252.
034     */
035    @org.opends.server.types.PublicAPI(
036         stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
037         mayInstantiate=false,
038         mayExtend=false,
039         mayInvoke=true)
040    public enum AttributeUsage
041    {
042      /**
043       * The attribute usage intended for user-defined attribute types.
044       */
045      USER_APPLICATIONS("userApplications", false),
046    
047    
048    
049      /**
050       * The attribute usage intended for standard operational attributes.
051       */
052      DIRECTORY_OPERATION("directoryOperation", true),
053    
054    
055    
056      /**
057       * The attribute usage intended for non-standard operational
058       * attributes shared among multiple DSAs.
059       */
060      DISTRIBUTED_OPERATION("distributedOperation", true),
061    
062    
063    
064      /**
065       * The attribute usage intended for non-standard operational
066       * attributes used by a single DSA.
067       */
068      DSA_OPERATION("dSAOperation", true);
069    
070    
071    
072      // The string representation of this attribute usage.
073      private final String usageString;
074    
075      // Flag indicating whether or not the usage should be categorized as
076      // operational.
077      private final boolean isOperational;
078    
079    
080    
081      /**
082       * Creates a new attribute usage with the provided string
083       * representation.
084       *
085       * @param usageString
086       *          The string representation of this attribute usage.
087       * @param isOperational
088       *          <code>true</code> if attributes having this attribute
089       *          usage are operational, or <code>false</code>
090       *          otherwise.
091       */
092      private AttributeUsage(String usageString, boolean isOperational)
093      {
094        this.usageString = usageString;
095        this.isOperational = isOperational;
096      }
097    
098    
099    
100      /**
101       * Retrieves a string representation of this attribute usage.
102       *
103       * @return  A string representation of this attribute usage.
104       */
105      public String toString()
106      {
107        return usageString;
108      }
109    
110    
111    
112      /**
113       * Determine whether or not attributes having this attribute usage
114       * are operational.
115       *
116       * @return Returns <code>true</code> if attributes having this
117       *         attribute usage are operational, or <code>false</code>
118       *         otherwise.
119       */
120      public boolean isOperational() {
121        return isOperational;
122      }
123    }
124