directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r807740 - /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/
Date Tue, 25 Aug 2009 18:12:12 GMT
Author: elecharny
Date: Tue Aug 25 18:12:12 2009
New Revision: 807740

URL: http://svn.apache.org/viewvc?rev=807740&view=rev
Log:
o Added the AttributeType class
o Fixed many small inconsistencies into the other classes
o Renamed the setRegistries() to applyRegistries() to reflect this method functionality

Modified:
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java?rev=807740&r1=807739&r2=807740&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
Tue Aug 25 18:12:12 2009
@@ -22,6 +22,11 @@
 
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.schema.registries.LdapSyntaxRegistry;
+import org.apache.directory.shared.ldap.schema.registries.MatchingRuleRegistry;
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+
 
 /**
  * An attributeType specification. attributeType specifications describe the
@@ -129,97 +134,410 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface AttributeType extends SchemaObject
+public class AttributeType extends SchemaObject
 {
+    /** The serialVersionUID */
+    public static final long serialVersionUID = 1L;
+    
+    /** The syntax OID associated with this AttributeType */
+    private String syntaxOid;
+    
+    /** The syntax associated with the syntaxID */
+    private LdapSyntax syntax;
+    
+    /** The equality OID associated with this AttributeType */
+    private String equalityOid;
+
+    /** The equality MatchingRule associated with the equalityID */
+    private MatchingRule equality;
+    
+    /** The substring OID associated with this AttributeType */
+    private String substrOid;
+
+    /** The substring MatchingRule associated with the substringID */
+    private MatchingRule substr;
+    
+    /** The ordering OID associated with this AttributeType */
+    private String orderingOid;
+    
+    /** The ordering MatchingRule associated with the orderingID */
+    private MatchingRule ordering;
+    
+    /** The superior AttributeType OID */
+    private String supOid;
+    
+    /** The superior AttributeType */
+    private AttributeType sup;
+    
+    /** whether or not this type is single valued */
+    private boolean isSingleValue = false;
+
+    /** whether or not this type is a collective attribute */
+    private boolean isCollective = false;
+
+    /** whether or not this type can be modified by directory users */
+    private boolean canUserModify = true;
+
+    /** the usage for this attributeType */
+    private UsageEnum usage = UsageEnum.USER_APPLICATIONS;
+
+    /** the length of this attribute in bytes */
+    private int length = -1;
+    
+    /**
+     * Creates a AttributeType object using a unique OID.
+     * 
+     * @param oid the OID for this AttributeType
+     */
+    public AttributeType( String oid )
+    {
+        super( SchemaObjectType.ATTRIBUTE_TYPE, oid );
+    }
+    
+    
+    /**
+     * Inject the registries into this Object, updating the references to
+     * other SchemaObject
+     *
+     * @param registries The Registries
+     */
+    public void applyRegistries( Registries registries ) throws NamingException
+    {
+        if ( registries != null )
+        {
+            AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();
+            
+            sup = atRegistry.lookup( supOid );
+            
+            MatchingRuleRegistry mrRegistry = registries.getMatchingRuleRegistry();
+            
+            equality = mrRegistry.lookup( equalityOid );
+            ordering = mrRegistry.lookup( orderingOid );
+            substr = mrRegistry.lookup( substrOid );
+            
+            LdapSyntaxRegistry lsRegistry = registries.getLdapSyntaxRegistry();
+            
+            syntax = lsRegistry.lookup( syntaxOid );
+            
+        }
+    }
+    
+    
     /**
      * Gets whether or not this AttributeType is single-valued.
      * 
      * @return true if only one value can exist for this AttributeType, false
      *         otherwise
      */
-    boolean isSingleValue();
+    public boolean isSingleValue()
+    {
+        return isSingleValue;
+    }
 
 
     /**
+     * Tells if this AttributeType is SIngle Valued or not
+     *
+     * @param singleValue True if the AttributeType is single-vlaued
+     */
+    public void setSingleValue( boolean singleValue )
+    {
+        if ( !isReadOnly )
+        {
+            this.isSingleValue = singleValue;
+        }
+    }
+
+    
+    /**
      * 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();
+    public boolean isCanUserModify()
+    {
+        return canUserModify;
+    }
 
+    
+    /**
+     * Tells if this AttributeType can be modified by a user or not
+     *
+     * @param canUserModify The flag to set
+     */
+    public void setCanUserModify( boolean canUserModify )
+    {
+        if ( !isReadOnly )
+        {
+            this.canUserModify = canUserModify;
+        }
+    }
+    
+    
 
     /**
      * Gets whether or not this AttributeType is a collective attribute.
      * 
      * @return true if the attribute is collective, false otherwise
      */
-    boolean isCollective();
+    public boolean isCollective()
+    {
+        return isCollective;
+    }
 
 
     /**
+     * Tells if this AttributeType is a collective attribute or not
+     *
+     * @param collective True if the AttributeType is collective
+     */
+    public void setCollective( boolean collective )
+    {
+        if ( !isReadOnly )
+        {
+            this.isCollective = collective;
+        }
+    }
+    
+    
+    /**
      * Determines the usage for this AttributeType.
      * 
      * @return a type safe UsageEnum
      */
-    UsageEnum getUsage();
+    public UsageEnum getUsage()
+    {
+        return usage;
+    }
 
 
     /**
-     * Gets the name of the superior class for this AttributeType.
+     * Sets the AttributeType usage, one of :<br>
+     * <li>USER_APPLICATIONS
+     * <li>DIRECTORY_OPERATION
+     * <li>DISTRIBUTED_OPERATION
+     * <li>DSA_OPERATION
+     * <br>
+     * @see UsageEnum
+     * @param usage The AttributeType usage
+     */
+    public void setUsage( UsageEnum usage )
+    {
+        if ( !isReadOnly )
+        {
+            this.usage = usage;
+        }
+    }
+    
+
+    /**
+     * Gets a length limit for this AttributeType.
+     * 
+     * @return the length of the attribute
+     */
+    public int getLength()
+    {
+        return length;
+    }
+    
+    
+    /**
+     * Sets the length limit of this AttributeType based on its associated
+     * syntax.
+     * 
+     * @param length the new length to set
+     */
+    public void setLength( int length )
+    {
+        if ( !isReadOnly )
+        {
+            this.length = length;
+        }
+    }
+    
+    
+    /**
+     * Gets the the superior AttributeType of this AttributeType.
+     * 
+     * @return the superior AttributeType for this AttributeType
+     */
+    public AttributeType getSup()
+    {
+        return sup;
+    }
+
+    
+    /**
+     * Gets the OID of the superior AttributeType for this AttributeType.
      * 
-     * @return the super class for this AttributeType
-     * @throws NamingException
-     *             if there is a failure to resolve the superior
+     * @return The OID of the superior AttributeType for this AttributeType.
      */
-    AttributeType getSuperior() throws NamingException, NamingException;
+    public String getSupOid()
+    {
+        return supOid;
+    }
+
+    
+    /**
+     * Sets the superior AttributeType OID of this AttributeType
+     *
+     * @param superiorOid The superior AttributeType OID of this AttributeType
+     */
+    public void setSuperiorOid( String superiorOid ) throws NamingException
+    {
+        if ( !isReadOnly )
+        {
+            this.supOid = superiorOid;
+        }
+    }
 
 
     /**
-     * The Syntax for this AttributeType's values.
+     * Gets the Syntax for this AttributeType's values.
      * 
      * @return the value syntax
-     * @throws NamingException
-     *             if there is a failure to resolve the syntax
      */
-    LdapSyntax getSyntax() throws NamingException;
+    public LdapSyntax getSyntax()
+    {
+        return syntax;
+    }
 
 
     /**
-     * Gets a length limit for this AttributeType.
+     * Gets the Syntax OID for this AttributeType's values.
      * 
-     * @return the length of the attribute
+     * @return the value syntax's OID
      */
-    int getLength();
+    public String getSyntaxOid()
+    {
+        return syntaxOid;
+    }
 
 
     /**
+     * Sets the Syntax OID for this AttributeType
+     *
+     * @param superiorOid The syntax OID for this AttributeType
+     * @throws NamingException if there is a failure to resolve the matchingRule
+     */
+    public void setSyntaxOid( String syntaxOid ) throws NamingException
+    {
+        if ( !isReadOnly )
+        {
+            this.syntaxOid = syntaxOid;
+        }
+    }
+
+    
+    /**
      * 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;
+    public MatchingRule getEquality()
+    {
+        return equality;
+    }
 
 
     /**
-     * Gets the MatchingRule for this AttributeType used for ordering.
+     * Gets the Equality OID for this AttributeType's values.
      * 
-     * @return the ordering matching rule
-     * @throws NamingException
-     *             if there is a failure to resolve the matchingRule
+     * @return the value Equality's OID
      */
-    MatchingRule getOrdering() throws NamingException;
+    public String getEqualityOid()
+    {
+        return equalityOid;
+    }
+
 
+    /**
+     * Sets the Equality OID for this AttributeType
+     *
+     * @param equalityOid The Equality OID for this AttributeType
+     * @throws NamingException if there is a failure to resolve the matchingRule
+     */
+    public void setEqualityOid( String equalityOid ) throws NamingException
+    {
+        if ( !isReadOnly )
+        {
+            this.equalityOid = equalityOid;
+        }
+    }
+    
 
     /**
-     * Gets the MatchingRule for this AttributeType used for substring matching.
+     * Gets the MatchingRule for this AttributeType used for Ordering matching.
      * 
-     * @return the substring matching rule
-     * @throws NamingException
-     *             if there is a failure to resolve the matchingRule
+     * @return the Ordering matching rule
      */
-    MatchingRule getSubstr() throws NamingException;
+    public MatchingRule getOrdering()
+    {
+        return ordering;
+    }
+
+
+    /**
+     * Gets the Ordering OID for this AttributeType's values.
+     * 
+     * @return the value Equality's OID
+     */
+    public String getOrderingOid()
+    {
+        return orderingOid;
+    }
+
+
+    /**
+     * Sets the Ordering OID for this AttributeType
+     *
+     * @param orderingOid The Ordering OID for this AttributeType
+     * @throws NamingException if there is a failure to resolve the matchingRule
+     */
+    public void setOrderingOid( String orderingOid ) throws NamingException
+    {
+        if ( !isReadOnly )
+        {
+            this.orderingOid = orderingOid;
+        }
+    }
+
+    
+    /**
+     * Gets the MatchingRule for this AttributeType used for Substr matching.
+     * 
+     * @return the Substr matching rule
+     */
+    public MatchingRule getSubstr()
+    {
+        return substr;
+    }
+
+
+    /**
+     * Gets the Substr OID for this AttributeType's values.
+     * 
+     * @return the value Substr's OID
+     */
+    public String getSubstrOid()
+    {
+        return substrOid;
+    }
+
+
+    /**
+     * Sets the Substr OID for this AttributeType
+     *
+     * @param substrOid The Substr OID for this AttributeType
+     * @throws NamingException if there is a failure to resolve the matchingRule
+     */
+    public void setSubstrOid( String substrOid ) throws NamingException
+    {
+        if ( !isReadOnly )
+        {
+            this.substrOid = substrOid;
+        }
+    }
 
 
     /**
@@ -230,9 +548,17 @@
      * @return true if the descendant is truely a derived from this AttributeType
      * @throws NamingException if there are problems resolving superior types
      */
-    boolean isAncestorOf( AttributeType descendant ) throws NamingException;
+    public boolean isAncestorOf( AttributeType descendant ) throws NamingException
+    {
+        if ( ( descendant == null ) || this.equals( descendant ) )
+        {
+            return false;
+        }
 
+        return isAncestorOrEqual( this, descendant );
+    }
 
+    
     /**
      * Checks to see if this AttributeType is the descendant of another
      * attributeType.
@@ -241,5 +567,41 @@
      * @return true if this AttributeType truely descends from the ancestor
      * @throws NamingException if there are problems resolving superior types
      */
-    boolean isDescendantOf( AttributeType ancestor ) throws NamingException;
+    public boolean isDescendantOf( AttributeType ancestor ) throws NamingException
+    {
+        if ( ( ancestor == null ) || equals( ancestor ) )
+        {
+            return false;
+        }
+
+        return isAncestorOrEqual( ancestor, this );
+    }
+
+
+    
+    
+    /**
+     * Recursive method which checks to see if a descendant is really an ancestor or if the
two
+     * are equal.
+     *
+     * @param ancestor the possible ancestor of the descendant
+     * @param descendant the possible descendant of the ancestor
+     * @return true if the ancestor equals the descendant or if the descendant is really
+     * a subtype of the ancestor. otherwise false
+     * @throws NamingException if there are issues with superior attribute resolution
+     */
+    private boolean isAncestorOrEqual( AttributeType ancestor, AttributeType descendant )
throws NamingException
+    {
+        if ( ( ancestor == null ) || ( descendant == null ) )
+        {
+            return false;
+        }
+
+        if ( ancestor.equals( descendant ) )
+        {
+            return true;
+        }
+
+        return isAncestorOrEqual( ancestor, descendant.getSup() );
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java?rev=807740&r1=807739&r2=807740&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
Tue Aug 25 18:12:12 2009
@@ -20,8 +20,15 @@
 package org.apache.directory.shared.ldap.schema;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.schema.registries.ObjectClassRegistry;
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+
 
 /**
  * A ditContentRule specification. ditContentRules identify the content of
@@ -109,59 +116,223 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public interface DITContentRule extends SchemaObject
+public class DITContentRule extends SchemaObject
 {
+    /** The serialVersionUID */
+    public static final long serialVersionUID = 1L;
+    
+    /** The list of Auxiliary ObjectClass OIDs entries may belong to */
+    private List<String> auxObjectClassOids;
+
+    /** The list of Auxiliary ObjectClass entries may belong to */
+    private List<ObjectClass> auxObjectClasses;
+
+    /** The list of allowed AttributeType OIDs */
+    private List<String> mayAttributeTypeOids;
+
+    /** The list of allowed AttributeTypes */
+    private List<AttributeType> mayAttributeTypes;
+
+    /** The list of required AttributeType OIDs */
+    private List<String> mustAttributeTypeOids;
+
+    /** The list of required AttributeTypes */
+    private List<AttributeType> mustAttributeTypes;
+    
+    /** The list of precluded AttributeType OIDs */
+    private List<String> notAttributeTypeOids;
+
+    /** The list of precluded AttributeTypes */
+    private List<AttributeType> notAttributeTypes;
+
     /**
-     * Gets the STRUCTURAL ObjectClass this DITContentRule specifies attributes
-     * for.
+     * Creates a DITContentRule object using a unique OID.
      * 
-     * @return the ObjectClass this DITContentRule specifies attributes for
-     * @throws NamingException
-     *             if there is a failure resolving the object
+     * @param oid the OID for this DITContentRule
+     */
+    public DITContentRule( String oid )
+    {
+        super( SchemaObjectType.DIT_CONTENT_RULE, oid );
+        
+        mayAttributeTypeOids = new ArrayList<String>();
+        mustAttributeTypeOids = new ArrayList<String>();
+        notAttributeTypeOids = new ArrayList<String>();
+        auxObjectClassOids = new ArrayList<String>();
+    }
+
+    
+    /**
+     * @return the auxObjectClassOids
      */
-    ObjectClass getObjectClass() throws NamingException;
+    public List<String> getAuxObjectClassOids()
+    {
+        return auxObjectClassOids;
+    }
 
 
     /**
-     * Gets all the AUXILIARY ObjectClasses this DITContentRule specifies for
-     * the given STRUCTURAL objectClass.
-     * 
-     * @return the extra AUXILIARY ObjectClasses
-     * @throws NamingException
-     *             if there is a failure resolving the object
+     * @param auxObjectClassOids the auxObjectClassOids to set
      */
-    ObjectClass[] getAuxObjectClasses() throws NamingException;
+    public void setAuxObjectClassOids( List<String> auxObjectClassOids )
+    {
+        if ( !isReadOnly )
+        {
+            this.auxObjectClassOids = auxObjectClassOids;
+        }
+    }
 
 
     /**
-     * Gets all the AttributeTypes of the "must" attribute names this
-     * DITContentRule specifies for the given STRUCTURAL objectClass.
-     * 
-     * @return the AttributeTypes of attributes that must be included in entries
-     * @throws NamingException
-     *             if there is a failure resolving the object
+     * @return the auxObjectClasses
+     */
+    public List<ObjectClass> getAuxObjectClasses()
+    {
+        return auxObjectClasses;
+    }
+
+    
+    /**
+     * @return the mayAttributeTypeOids
      */
-    AttributeType[] getMustNames() throws NamingException;
+    public List<String> getMayAttributeTypeOids()
+    {
+        return mayAttributeTypeOids;
+    }
 
 
     /**
-     * Gets all the AttributeTypes of the "may" attribute names this
-     * DITContentRule specifies for the given STRUCTURAL objectClass.
-     * 
-     * @return the AttributeTypes of attributes that may be included in entries
-     * @throws NamingException
-     *             if there is a failure resolving the object
+     * @param mayAttributeTypeOids the mayAttributeTypeOids to set
      */
-    AttributeType[] getMayNames() throws NamingException;
+    public void setMayAttributeTypeOids( List<String> mayAttributeTypeOids )
+    {
+        if ( !isReadOnly )
+        {
+            this.mayAttributeTypeOids = mayAttributeTypeOids;
+        }
+    }
 
 
     /**
-     * Gets all the AttributeTypes of the "not" attribute names this
-     * DITContentRule specifies for the given STRUCTURAL objectClass.
-     * 
-     * @return the AttributeTypes of attributes that are excluded in entries
-     * @throws NamingException
-     *             if there is a failure resolving the object
+     * @return the mayAttributeTypes
+     */
+    public List<AttributeType> getMayAttributeTypes()
+    {
+        return mayAttributeTypes;
+    }
+
+
+    /**
+     * @return the mustAttributeTypeOids
+     */
+    public List<String> getMustAttributeTypeOids()
+    {
+        return mustAttributeTypeOids;
+    }
+
+
+    /**
+     * @param mustAttributeTypeOids the mustAttributeTypeOids to set
+     */
+    public void setMustAttributeTypeOids( List<String> mustAttributeTypeOids )
+    {
+        if ( !isReadOnly )
+        {
+            this.mustAttributeTypeOids = mustAttributeTypeOids;
+        }
+    }
+
+
+    /**
+     * @return the mustAttributeTypes
+     */
+    public List<AttributeType> getMustAttributeTypes()
+    {
+        return mustAttributeTypes;
+    }
+
+
+    /**
+     * @return the notAttributeTypeOids
+     */
+    public List<String> getNotAttributeTypeOids()
+    {
+        return notAttributeTypeOids;
+    }
+
+
+    /**
+     * @param notAttributeTypeOids the notAttributeTypeOids to set
+     */
+    public void setNotAttributeTypeOids( List<String> notAttributeTypeOids )
+    {
+        if ( !isReadOnly )
+        {
+            this.notAttributeTypeOids = notAttributeTypeOids;
+        }
+    }
+
+
+    /**
+     * @return the notAttributeTypes
+     */
+    public List<AttributeType> getNotAttributeTypes()
+    {
+        return notAttributeTypes;
+    }
+    
+    
+    /**
+     * Inject the registries into this Object, updating the references to
+     * other SchemaObject
+     *
+     * @param registries The Registries
      */
-    AttributeType[] getNotNames() throws NamingException;
+    public void applyRegistries( Registries registries ) throws NamingException
+    {
+        if ( registries != null )
+        {
+            AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();
+            ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
+            
+            if ( mayAttributeTypeOids != null )
+            {
+                mayAttributeTypes = new ArrayList<AttributeType>( mayAttributeTypeOids.size()
);
+                
+                for ( String oid : mayAttributeTypeOids )
+                {
+                    mayAttributeTypes.add( atRegistry.lookup( oid ) );
+                }
+            }
+
+            if ( mustAttributeTypeOids != null )
+            {
+                mustAttributeTypes = new ArrayList<AttributeType>( mustAttributeTypeOids.size()
);
+                
+                for ( String oid : mustAttributeTypeOids )
+                {
+                    mustAttributeTypes.add( atRegistry.lookup( oid ) );
+                }
+            }
+
+            if ( notAttributeTypeOids != null )
+            {
+                notAttributeTypes = new ArrayList<AttributeType>( notAttributeTypeOids.size()
);
+                
+                for ( String oid : notAttributeTypeOids )
+                {
+                    notAttributeTypes.add( atRegistry.lookup( oid ) );
+                }
+            }
+            
+            if ( auxObjectClassOids != null )
+            {
+                auxObjectClasses = new ArrayList<ObjectClass>( auxObjectClassOids.size()
);
+                
+                for ( String oid : auxObjectClassOids )
+                {
+                    auxObjectClasses.add( ocRegistry.lookup( oid ) );
+                }
+            }
+        }
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java?rev=807740&r1=807739&r2=807740&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java
Tue Aug 25 18:12:12 2009
@@ -122,7 +122,10 @@
      */
     public void setForm( String form )
     {
-        this.form = form;
+        if ( !isReadOnly )
+        {
+            this.form = form;
+        }
     }
 
 
@@ -142,7 +145,10 @@
      */
     public void setRuleId( int ruleId )
     {
-        this.ruleId = ruleId;
+        if ( !isReadOnly )
+        {
+            this.ruleId = ruleId;
+        }
     }
 
 
@@ -162,7 +168,10 @@
      */
     public void setSuperRules( List<Integer> superRules )
     {
-        this.superRules = superRules;
+        if ( !isReadOnly )
+        {
+            this.superRules = superRules;
+        }
     }
 
 

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java?rev=807740&r1=807739&r2=807740&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
Tue Aug 25 18:12:12 2009
@@ -111,7 +111,7 @@
      *
      * @param registries The Registries
      */
-    public void setRegistries( Registries registries ) throws NamingException
+    public void applyRegistries( Registries registries ) throws NamingException
     {
         if ( registries != null )
         {

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java?rev=807740&r1=807739&r2=807740&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
Tue Aug 25 18:12:12 2009
@@ -20,8 +20,14 @@
 package org.apache.directory.shared.ldap.schema;
 
 
+import java.util.ArrayList;
 import java.util.List;
 
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+
 
 /**
  * Represents an LDAP MatchingRuleUseDescription defined in RFC 2252.
@@ -84,38 +90,78 @@
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
 
-    /** The list of attributes types the matching rule applies to */
-    private List<String> applicableAttributes;
+    /** The list of attributes types OID the matching rule applies to */
+    private List<String> applicableAttributeOids;
 
+    /** The list of attributes types the matching rule applies to */
+    private List<AttributeType> applicableAttributes;
+    
     /**
      * Creates a new instance of MatchingRuleUseDescription
      */
     public MatchingRuleUse( String oid )
     {
         super(  SchemaObjectType.MATCHING_RULE_USE, oid );
+        
+        applicableAttributeOids = new ArrayList<String>();
     }
     
 
+
+
     /**
-     * @return The matchingRule's list of Attribute types the MRU applies to
+     * Inject the registries into this Object, updating the references to
+     * other SchemaObject
+     *
+     * @param registries The Registries
      */
-    public List<String> getApplicableAttributes()
+    public void applyRegistries( Registries registries ) throws NamingException
+    {
+        if ( registries != null )
+        {
+            AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();
+            
+            if ( applicableAttributeOids != null )
+            {
+                applicableAttributes = new ArrayList<AttributeType>( applicableAttributeOids.size()
);
+                
+                for ( String oid : applicableAttributeOids )
+                {
+                    applicableAttributes.add( atRegistry.lookup( oid ) );
+                }
+            }
+        }
+    }
+
+    
+    /**
+     * @return The matchingRule's list of AttributeType OIDs the MRU applies to
+     */
+    public List<String> getApplicableAttributeOids()
+    {
+        return applicableAttributeOids;
+    }
+
+
+    /**
+     * @return The matchingRule's list of AttributeType OIDs the MRU applies to
+     */
+    public List<AttributeType> getApplicableAttributes()
     {
         return applicableAttributes;
     }
 
 
     /**
-     * Set the matchingRule's Attribute types the MRU applies to. description
+     * Set the matchingRule's AttributeType OIDs the MRU applies to. description
      *
-     * @param applicableAttributes The Attribute types list
+     * @param applicableAttributes The AttributeType OIDs list
      */
-    public void setApplicableAttributes( List<String> applicableAttributes )
+    public void setApplicableAttributeOids( List<String> applicableAttributeOids )
     {
         if ( !isReadOnly )
         {
-            this.applicableAttributes = applicableAttributes;
+            this.applicableAttributeOids = applicableAttributeOids;
         }
     }
-    
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java?rev=807740&r1=807739&r2=807740&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
Tue Aug 25 18:12:12 2009
@@ -27,7 +27,6 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.ObjectClassRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 
 
@@ -119,12 +118,6 @@
     /** The set of allowed AttributeTypes for this name form */
     private List<AttributeType> mayAttributeTypes;
     
-    /** The associated AttributeType registry */
-    private AttributeTypeRegistry atRegistry;
-    
-    /** The associated ObjectClass registry */
-    private ObjectClassRegistry ocRegistry;
-    
 
     /**
      * Creates a new instance of MatchingRule.
@@ -151,9 +144,9 @@
     {
         if ( registries != null )
         {
-            atRegistry = registries.getAttributeTypeRegistry();
-            ocRegistry = registries.getObjectClassRegistry();
-            structuralObjectClass = ocRegistry.lookup( structuralObjectClassOid );
+            AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();
+
+            structuralObjectClass = registries.getObjectClassRegistry().lookup( structuralObjectClassOid
);
             
             if ( mayAttributeTypeOids != null )
             {

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java?rev=807740&r1=807739&r2=807740&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java
Tue Aug 25 18:12:12 2009
@@ -141,7 +141,10 @@
      */
     public void changeOid( String oid )
     {
-        this.oid = oid;
+        if ( !isReadOnly )
+        {
+            this.oid = oid;
+        }
     }
     
     



Mime
View raw message