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     * Represents an LDAP MatchingRuleUseDescription defined in RFC 2252.
028     * <p>
029     * According to ldapbis [MODELS]:
030     * </p>
031     * 
032     * <pre>
033     *  Values of the matchingRuleUse list the attributes which are suitable
034     *  for use with an extensible matching rule.
035     *  
036     *    Matching rule use descriptions are written according to the following
037     *    ABNF:
038     * 
039     *      MatchingRuleUseDescription = LPAREN WSP
040     *          numericoid                ; object identifier
041     *          [ SP &quot;NAME&quot; SP qdescrs ]  ; short names (descriptors)
042     *          [ SP &quot;DESC&quot; SP qdstring ] ; description
043     *          [ SP &quot;OBSOLETE&quot; ]         ; not active
044     *          SP &quot;APPLIES&quot; SP oids      ; attribute types
045     *          extensions WSP RPAREN     ; extensions
046     *  
047     *    where:
048     *      [numericoid] is the object identifier of the matching rule
049     *          associated with this matching rule use description;
050     *      NAME [qdescrs] are short names (descriptors) identifying this
051     *          matching rule use;
052     *      DESC [qdstring] is a short descriptive string;
053     *      OBSOLETE indicates this matching rule use is not active;
054     *      APPLIES provides a list of attribute types the matching rule applies
055     *          to; and
056     *      [extensions] describe extensions.
057     * 
058     *  The matchingRule within the MatchingRuleUse definition can be used by an
059     *  extensible match assertion if the assertion is based on the attributes 
060     *  listed within the MatchingRuleUse definition.  If an extensible match 
061     *  assertion is based on attributes other than those listed within the 
062     *  MatchingRuleUse definition then the assertion is deemed undefined.
063     *  
064     *  Also according to 3.3.20 of [SYNTAXES] (ldapbis working group):
065     *  
066     *  A value of the Matching Rule Use Description syntax indicates the
067     *  attribute types to which a matching rule may be applied in an
068     *  extensibleMatch search filter [PROT].  The LDAP-specific encoding of
069     *  a value of this syntax is defined by the &lt;MatchingRuleUseDescription&gt;
070     *  rule in [MODELS] above.
071     * </pre>
072     * 
073     * @see <a
074     *      href="http://www.ietf.org/internet-drafts/draft-ietf-ldapbis-models-11.txt">ldapbis
075     *      [MODELS]</a>
076     * @see <a
077     *      href="http://www.ietf.org/internet-drafts/draft-ietf-ldapbis-syntaxes-09.txt">ldapbis
078     *      [SYNTAXES]</a>
079     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
080     * @version $Rev: 437007 $
081     */
082    public interface MatchingRuleUse extends SchemaObject
083    {
084        /**
085         * Gets the matchingRule this MatchingRuleUse definition applies to.
086         * 
087         * @return the matchingRule
088         * @throws NamingException
089         *             if there is a failure resolving the object
090         */
091        public MatchingRule getMatchingRule() throws NamingException;
092    
093    
094        /**
095         * Gets the the attributes which can be used with the matching rule in an
096         * extensible match assertion.
097         * 
098         * @return the applicable attributes
099         * @throws NamingException
100         *             if there is a failure resolving the object
101         */
102        public AttributeType[] getApplicableAttributes() throws NamingException;
103    }