You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/08/14 00:03:46 UTC

svn commit: r431253 - in /directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions: AttributeType.java MatchingRuleUse.java

Author: akarasulu
Date: Sun Aug 13 15:03:45 2006
New Revision: 431253

URL: http://svn.apache.org/viewvc?rev=431253&view=rev
Log:
Adding MatchingRuleUses and AttributeTypes revised from 1.0 branch

Added:
    directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions/AttributeType.java
    directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions/MatchingRuleUse.java

Added: directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions/AttributeType.java?rev=431253&view=auto
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions/AttributeType.java (added)
+++ directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions/AttributeType.java Sun Aug 13 15:03:45 2006
@@ -0,0 +1,229 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server2.schema.descriptions;
+
+
+import javax.naming.NamingException;
+
+
+/**
+ * An attributeType specification. attributeType specifications describe the
+ * nature of attributes within the directory. The attributeType specification's
+ * properties are accessible through this interface.
+ * <p>
+ * According to section 4.1.2 of RFC 4512:
+ * </p>
+ * 
+ * <pre>
+ *  4.1.2. Attribute Types
+ * 
+ *     Attribute Type definitions are written according to the ABNF:
+ *
+ *       AttributeTypeDescription = LPAREN WSP
+ *           numericoid                    ; object identifier
+ *           [ SP "NAME" SP qdescrs ]      ; short names (descriptors)
+ *           [ SP "DESC" SP qdstring ]     ; description
+ *           [ SP "OBSOLETE" ]             ; not active
+ *           [ SP "SUP" SP oid ]           ; supertype
+ *           [ SP "EQUALITY" SP oid ]      ; equality matching rule
+ *           [ SP "ORDERING" SP oid ]      ; ordering matching rule
+ *           [ SP "SUBSTR" SP oid ]        ; substrings matching rule
+ *           [ SP "SYNTAX" SP noidlen ]    ; value syntax
+ *           [ SP "SINGLE-VALUE" ]         ; single-value
+ *           [ SP "COLLECTIVE" ]           ; collective
+ *           [ SP "NO-USER-MODIFICATION" ] ; not user modifiable
+ *           [ SP "USAGE" SP usage ]       ; usage
+ *           extensions WSP RPAREN         ; extensions
+ *
+ *       usage = "userApplications"     /  ; user
+ *               "directoryOperation"   /  ; directory operational
+ *               "distributedOperation" /  ; DSA-shared operational
+ *               "dSAOperation"            ; DSA-specific operational
+ *
+ *     where:
+ *       <numericoid> is object identifier assigned to this attribute type;
+ *       NAME <qdescrs> are short names (descriptors) identifying this
+ *           attribute type;
+ *       DESC <qdstring> is a short descriptive string;
+ *       OBSOLETE indicates this attribute type is not active;
+ *       SUP oid specifies the direct supertype of this type;
+ *       EQUALITY, ORDERING, and SUBSTR provide the oid of the equality,
+ *           ordering, and substrings matching rules, respectively;
+ *       SYNTAX identifies value syntax by object identifier and may suggest
+ *           a minimum upper bound;
+ *       SINGLE-VALUE indicates attributes of this type are restricted to a
+ *           single value;
+ *       COLLECTIVE indicates this attribute type is collective
+ *           [X.501][RFC3671];
+ *       NO-USER-MODIFICATION indicates this attribute type is not user
+ *           modifiable;
+ *       USAGE indicates the application of this attribute type; and
+ *       <extensions> describe extensions.
+ *
+ *     Each attribute type description must contain at least one of the SUP
+ *     or SYNTAX fields.  If no SYNTAX field is provided, the attribute type
+ *     description takes its value from the supertype.
+ *
+ *     If SUP field is provided, the EQUALITY, ORDERING, and SUBSTRING
+ *     fields, if not specified, take their value from the supertype.
+ *
+ *     Usage of userApplications, the default, indicates that attributes of
+ *     this type represent user information.  That is, they are user
+ *     attributes.
+ *
+ *     A usage of directoryOperation, distributedOperation, or dSAOperation
+ *     indicates that attributes of this type represent operational and/or
+ *     administrative information.  That is, they are operational
+ *     attributes.
+ *
+ *     directoryOperation usage indicates that the attribute of this type is
+ *     a directory operational attribute.  distributedOperation usage
+ *     indicates that the attribute of this type is a DSA-shared usage
+ *     operational attribute.  dSAOperation usage indicates that the
+ *     attribute of this type is a DSA-specific operational attribute.
+ *
+ *     COLLECTIVE requires usage userApplications.  Use of collective
+ *     attribute types in LDAP is discussed in [RFC3671].
+ *
+ *     NO-USER-MODIFICATION requires an operational usage.
+ *
+ *     Note that the <AttributeTypeDescription> does not list the matching
+ *     rules that can be used with that attribute type in an extensibleMatch
+ *     search filter [RFC4511].  This is done using the 'matchingRuleUse'
+ *     attribute described in Section 4.1.4.
+ *
+ *     This document refines the schema description of X.501 by requiring
+ *     that the SYNTAX field in an <AttributeTypeDescription> be a string
+ *     representation of an object identifier for the LDAP string syntax
+ *     definition, with an optional indication of the suggested minimum
+ *     bound of a value of this attribute.
+ *
+ *     A suggested minimum upper bound on the number of characters in a
+ *     value with a string-based syntax, or the number of bytes in a value
+ *     for all other syntaxes, may be indicated by appending this bound
+ *     count inside of curly braces following the syntax's OBJECT IDENTIFIER
+ *     in an Attribute Type Description.  This bound is not part of the
+ *     syntax name itself.  For instance, "1.3.6.4.1.1466.0{64}" suggests
+ *     that server implementations should allow a string to be 64 characters
+ *     long, although they may allow longer strings.  Note that a single
+ *     character of the Directory String syntax may be encoded in more than
+ *     one octet since UTF-8 [RFC3629] is a variable-length encoding.
+ *
+ * </pre>
+ * 
+ * @see <a href="http://www.faqs.org/rfcs/rfc2252.html">RFC 2252 Section 4.2</a>
+ * @see <a
+ *      href="http://www.ietf.org/internet-drafts/draft-ietf-ldapbis-models-11.txt">
+ *      ldapbis [MODELS]</a>
+ * @see DescriptionUtils#getDescription(AttributeType)
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 379008 $
+ */
+public interface AttributeType extends OidObject
+{
+    public enum Usage { USERAPPLICATIONS, DIRECTORYOPERATION, DISTRIBUTEDOPERATION, DSAOPERATION };
+    
+    /**
+     * Gets whether or not this AttributeType is single-valued.
+     * 
+     * @return true if only one value can exist for this AttributeType, false
+     *         otherwise
+     */
+    boolean isSingleValue();
+
+
+    /**
+     * Gets whether or not this AttributeType can be modified by a user.
+     * 
+     * @return true if users can modify it, false if only the directory can.
+     */
+    boolean isCanUserModify();
+
+
+    /**
+     * Gets whether or not this AttributeType is a collective attribute.
+     * 
+     * @return true if the attribute is collective, false otherwise
+     */
+    boolean isCollective();
+
+
+    /**
+     * Determines the usage for this AttributeType.
+     * 
+     * @return a type safe UsageEnum
+     */
+    Usage getUsage();
+
+
+    /**
+     * Gets the name of the superior class for this AttributeType.
+     * 
+     * @return the super class for this AttributeType
+     * @throws NamingException
+     *             if there is a failure to resolve the superior
+     */
+    AttributeType getSuperior() throws NamingException;
+
+
+    /**
+     * The Syntax for this AttributeType's values.
+     * 
+     * @return the value syntax
+     * @throws NamingException
+     *             if there is a failure to resolve the syntax
+     */
+    Syntax getSyntax() throws NamingException;
+
+
+    /**
+     * Gets a length limit for this AttributeType.
+     * 
+     * @return the length of the attribute
+     */
+    int getLength();
+
+
+    /**
+     * Gets the MatchingRule for this AttributeType used for equality matching.
+     * 
+     * @return the equality matching rule
+     * @throws NamingException
+     *             if there is a failure to resolve the matchingRule
+     */
+    MatchingRule getEquality() throws NamingException;
+
+
+    /**
+     * Gets the MatchingRule for this AttributeType used for ordering.
+     * 
+     * @return the ordering matching rule
+     * @throws NamingException
+     *             if there is a failure to resolve the matchingRule
+     */
+    MatchingRule getOrdering() throws NamingException;
+
+
+    /**
+     * Gets the MatchingRule for this AttributeType used for substring matching.
+     * 
+     * @return the substring matching rule
+     * @throws NamingException
+     *             if there is a failure to resolve the matchingRule
+     */
+    MatchingRule getSubstr() throws NamingException;
+}

Added: directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions/MatchingRuleUse.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions/MatchingRuleUse.java?rev=431253&view=auto
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions/MatchingRuleUse.java (added)
+++ directory/sandbox/akarasulu/apacheds-2.0/schema/descriptions/src/main/java/org/apache/directory/server2/schema/descriptions/MatchingRuleUse.java Sun Aug 13 15:03:45 2006
@@ -0,0 +1,84 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server2.schema.descriptions;
+
+
+import java.util.List;
+
+import javax.naming.NamingException;
+
+
+/**
+ * Represents an LDAP MatchingRuleUseDescription defined in RFC 4512.
+ * <p>
+ * According to section 4.1.4 of the RFC:
+ * </p>
+ * 
+ * <pre>
+ *    A matching rule use lists the attribute types that are suitable for
+ *    use with an extensibleMatch search filter.
+ * 
+ *    Matching rule use descriptions are written according to the following
+ *    ABNF:
+ *
+ *        MatchingRuleUseDescription = LPAREN WSP
+ *            numericoid                 ; object identifier
+ *            [ SP "NAME" SP qdescrs ]   ; short names (descriptors)
+ *            [ SP "DESC" SP qdstring ]  ; description
+ *            [ SP "OBSOLETE" ]          ; not active
+ *              SP "APPLIES" SP oids       ; attribute types
+ *              extensions WSP RPAREN      ; extensions
+ * 
+ *    where:
+ *        <numericoid> is the object identifier of the matching rule
+ *             associated with this matching rule use description;
+ *         NAME <qdescrs> are short names (descriptors) identifying this
+ *             matching rule use;
+ *         DESC <qdstring> is a short descriptive string;
+ *         OBSOLETE indicates this matching rule use is not active;
+ *         APPLIES provides a list of attribute types the matching rule
+ *             applies to; and
+ *         <extensions> describe extensions.
+ *
+ * </pre>
+ * 
+ * DO NOT POPULATE OID REGISTRY USING THESE OBJECTS!!!
+ * 
+ * @see <a="http://www.faqs.org/rfcs/rfc4512.html">RFC 4512</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public interface MatchingRuleUse extends OidObject
+{
+    /**
+     * Gets the matchingRule this MatchingRuleUse definition applies to.
+     * 
+     * @return the matchingRule
+     * @throws NamingException if there is a failure resolving the object
+     */
+    public MatchingRule getMatchingRule() throws NamingException;
+
+
+    /**
+     * Gets the the attributes which can be used with the matching rule in an
+     * extensible match assertion.
+     * 
+     * @return the applicable attributes
+     * @throws NamingException if there is a failure resolving the object
+     */
+    public List<AttributeType> getApplicableAttributes() throws NamingException;
+}