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     */
020    package org.apache.directory.shared.ldap.schema;
021    
022    
023    import javax.naming.NamingException;
024    
025    
026    /**
027     * An objectClass definition.
028     * <p>
029     * According to ldapbis [MODELS]:
030     * </p>
031     * 
032     * <pre>
033     *  Object Class definitions are written according to the ABNF:
034     *  
035     *    ObjectClassDescription = LPAREN WSP
036     *        numericoid                ; object identifier
037     *        [ SP &quot;NAME&quot; SP qdescrs ]  ; short names (descriptors)
038     *        [ SP &quot;DESC&quot; SP qdstring ] ; description
039     *        [ SP &quot;OBSOLETE&quot; ]         ; not active
040     *        [ SP &quot;SUP&quot; SP oids ]      ; superior object classes
041     *        [ SP kind ]               ; kind of class
042     *        [ SP &quot;MUST&quot; SP oids ]     ; attribute types
043     *        [ SP &quot;MAY&quot; SP oids ]      ; attribute types
044     *        extensions WSP RPAREN
045     * 
046     *     kind = &quot;ABSTRACT&quot; / &quot;STRUCTURAL&quot; / &quot;AUXILIARY&quot;
047     * 
048     *   where:
049     *     [numericoid] is object identifier assigned to this object class;
050     *     NAME [qdescrs] are short names (descriptors) identifying this object
051     *         class;
052     *     DESC [qdstring] is a short descriptive string;
053     *     OBSOLETE indicates this object class is not active;
054     *     SUP [oids] specifies the direct superclasses of this object class;
055     *     the kind of object class is indicated by one of ABSTRACT,
056     *         STRUCTURAL, or AUXILIARY, default is STRUCTURAL;
057     *     MUST and MAY specify the sets of required and allowed attribute
058     *         types, respectively; and
059     *    [extensions] describe extensions.
060     * </pre>
061     * 
062     * @see <a href="http://www.faqs.org/rfcs/rfc2252.html">RFC2252 Section 4.4</a>
063     * @see <a
064     *      href="http://www.ietf.org/internet-drafts/draft-ietf-ldapbis-models-11.txt">ldapbis
065     *      [MODELS]</a>
066     * @see DescriptionUtils#getDescription(ObjectClass)
067     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
068     * @version $Rev: 568072 $
069     */
070    public interface ObjectClass extends SchemaObject
071    {
072        /**
073         * Gets the superclasses of this ObjectClass.
074         * 
075         * @return the superclasses
076         * @throws NamingException
077         *             if there is a failure resolving the object
078         */
079        ObjectClass[] getSuperClasses() throws NamingException;
080    
081    
082        /**
083         * Gets the type of this ObjectClass as a type safe enum.
084         * 
085         * @return the ObjectClass type as an enum
086         */
087        ObjectClassTypeEnum getType();
088        
089        
090        /**
091         * Tells if the current ObjectClass is STRUCTURAL
092         * 
093         * @return <code>true</code> if the ObjectClass is STRUCTURAL
094         */
095        boolean isStructural();
096        
097    
098        /**
099         * Tells if the current ObjectClass is ABSTRACT
100         * 
101         * @return <code>true</code> if the ObjectClass is ABSTRACT
102         */
103        boolean isAbstract();
104        
105    
106        /**
107         * Tells if the current ObjectClass is AUXILIARY
108         * 
109         * @return <code>true</code> if the ObjectClass is AUXILIARY
110         */
111        boolean isAuxiliary();
112    
113    
114        /**
115         * Gets the AttributeTypes whose attributes must be present within an entry
116         * of this ObjectClass.
117         * 
118         * @return the AttributeTypes of attributes that must be within entries of
119         *         this ObjectClass
120         * @throws NamingException
121         *             if there is a failure resolving the object
122         */
123        AttributeType[] getMustList() throws NamingException;
124    
125    
126        /**
127         * Gets the AttributeTypes whose attributes may be present within an entry
128         * of this ObjectClass.
129         * 
130         * @return the AttributeTypes of attributes that may be within entries of
131         *         this ObjectClass
132         * @throws NamingException
133         *             if there is a failure resolving the object
134         */
135        AttributeType[] getMayList() throws NamingException;
136    }