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 2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.authorization.dseecompat;
028    
029    
030    /**
031     * Enumeration that represents the type an "userdn" keyword DN can have.
032     * The issues is the syntax allows invalid URLs such as "ldap:///anyone"
033     * and "ldap:///self".  The strategy is to use this class to hold
034     * the type and another class UserDNTypeURL to hold both this type and URL.
035     *
036     * If the URL is an invalid URL, then a dummy URL is saved.
037     * For types such as URL, DN and DNPATTERN, the actual URL is saved and can
038     * be retrieved by the UserDN.evaluate() method when needed. The dummy URL is
039     * ignored in the UserDN.evaluate() method for types such as: ALL, PARENT,
040     * SELF and ANYONE.
041     */
042    public enum EnumUserDNType {
043    
044            /**
045             * The enumeration type when the "userdn" URL contains only a DN (no
046             * filter or scope) and that DN has no pattern.
047             */
048            DN(0),
049            /**
050             * The enumeration type when the "userdn" URL contains only a DN (no
051             * filter or scope) and that DN has a substring pattern.
052             */
053            DNPATTERN(1),
054            /**
055             * The enumeration type when the "userdn" URL has the value of:
056             *  "ldap:///all".
057             */
058            ALL(2),
059            /**
060             * The enumeration type when the "userdn" URL has the value of:
061             *  "ldap:///parent".
062             */
063            PARENT(3),
064            /**
065             * The enumeration type when the "userdn" URL has the value of:
066             *  "ldap:///self".
067             */
068            SELF(4),
069            /**
070             * The enumeration type when the "userdn" URL has the value of:
071             *  "ldap:///anyone".
072             */
073            ANYONE(5),
074            /**
075             * The enumeration type when the "userdn" URL is contains a DN (suffix),
076             * a scope and a filter.
077             */
078            URL(6);
079    
080            /**
081             * Constructor taking an integer value.
082             * @param v Integer value.
083             */
084            EnumUserDNType(int v) {}
085    }