directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r927122 - in /directory/shared/trunk: i18n/src/main/java/org/apache/directory/shared/i18n/ i18n/src/main/resources/org/apache/directory/shared/i18n/ ldap/src/main/java/org/apache/directory/shared/ldap/schema/ ldap/src/main/java/org/apache/d...
Date Wed, 24 Mar 2010 17:14:57 GMT
Author: elecharny
Date: Wed Mar 24 17:14:56 2010
New Revision: 927122

URL: http://svn.apache.org/viewvc?rev=927122&view=rev
Log:
o Protected the SchemaObject from any modification once they have been injected in the registries
o The hashcode value is computed only once

Modified:
    directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
    directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSchemaObject.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java

Modified: directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java (original)
+++ directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java Wed Mar 24 17:14:56 2010
@@ -583,6 +583,7 @@ public class I18n
 	public static final String ERR_04438 = "ERR_04438";
 	public static final String ERR_04439 = "ERR_04439";
 	public static final String ERR_04440 = "ERR_04440";
+    public static final String ERR_04441 = "ERR_04441";
 
 	// ldap-constants
 	public static final String ERR_05001 = "ERR_05001";

Modified: directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties (original)
+++ directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties Wed Mar 24 17:14:56 2010
@@ -542,6 +542,7 @@ ERR_04437=Caught a SecurityException rea
 ERR_04438=The style must not be null
 ERR_04439=Usage - java org.mortbay.util.UnixCrypt <key> <salt>
 ERR_04440=Crypt={0}
+ERR_04441=Cannot modify the SchemaObject {0}, it has been locked
 
 # ldap-constants
 ERR_05001=Unknown AuthenticationLevel {0}

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSchemaObject.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSchemaObject.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSchemaObject.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSchemaObject.java Wed Mar 24 17:14:56 2010
@@ -28,6 +28,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -104,6 +105,12 @@ public abstract class AbstractSchemaObje
 
     /** A map containing the list of supported extensions */
     protected Map<String, List<String>> extensions;
+    
+    /** A locked to avoid modifications when set to true */
+    protected volatile boolean locked;
+    
+    /** The hashcoe for this schemaObject */
+    private int h;
 
 
     /**
@@ -158,6 +165,11 @@ public abstract class AbstractSchemaObje
      */
     public void setOid( String oid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.oid = oid;
     }
 
@@ -246,6 +258,11 @@ public abstract class AbstractSchemaObje
      */
     public void addName( String... names )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             // We must avoid duplicated names, as names are case insensitive
@@ -282,6 +299,11 @@ public abstract class AbstractSchemaObje
      */
     public void setNames( List<String> names )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( names == null )
         {
             return;
@@ -310,6 +332,11 @@ public abstract class AbstractSchemaObje
      */
     public void setNames( String... names )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( names == null )
         {
             return;
@@ -346,6 +373,11 @@ public abstract class AbstractSchemaObje
      */
     public void setDescription( String description )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.description = description;
@@ -371,6 +403,11 @@ public abstract class AbstractSchemaObje
      */
     public void setSpecification( String specification )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.specification = specification;
@@ -434,6 +471,11 @@ public abstract class AbstractSchemaObje
      */
     public void setReadOnly( boolean isReadOnly )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.isReadOnly = isReadOnly;
     }
 
@@ -459,6 +501,11 @@ public abstract class AbstractSchemaObje
      */
     public void setObsolete( boolean obsolete )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.isObsolete = obsolete;
@@ -482,6 +529,11 @@ public abstract class AbstractSchemaObje
      */
     public void addExtension( String key, List<String> values )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             extensions.put( key, values );
@@ -497,6 +549,11 @@ public abstract class AbstractSchemaObje
      */
     public void setExtensions( Map<String, List<String>> extensions )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly && ( extensions != null ) )
         {
             this.extensions = new HashMap<String, List<String>>();
@@ -557,6 +614,11 @@ public abstract class AbstractSchemaObje
      */
     public void setSchemaName( String schemaName )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.schemaName = schemaName;
@@ -569,54 +631,6 @@ public abstract class AbstractSchemaObje
      */
     public int hashCode()
     {
-        int h = 37;
-
-        // The OID
-        h += h * 17 + oid.hashCode();
-
-        // The SchemaObject type
-        h += h * 17 + objectType.getValue();
-
-        // The Names, if any
-        if ( ( names != null ) && ( names.size() != 0 ) )
-        {
-            for ( String name : names )
-            {
-                h += h * 17 + name.hashCode();
-            }
-        }
-
-        // The schemaName if any
-        if ( schemaName != null )
-        {
-            h += h * 17 + schemaName.hashCode();
-        }
-
-        h += h * 17 + ( isEnabled ? 1 : 0 );
-        h += h * 17 + ( isReadOnly ? 1 : 0 );
-
-        // The description, if any
-        if ( description != null )
-        {
-            h += h * 17 + description.hashCode();
-        }
-
-        // The extensions, if any
-        for ( String key : extensions.keySet() )
-        {
-            h += h * 17 + key.hashCode();
-
-            List<String> values = extensions.get( key );
-
-            if ( values != null )
-            {
-                for ( String value : values )
-                {
-                    h += h * 17 + value.hashCode();
-                }
-            }
-        }
-
         return h;
     }
 
@@ -879,4 +893,66 @@ public abstract class AbstractSchemaObje
         // Clear the names
         names.clear();
     }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public final void lock()
+    {
+        if ( locked )
+        {
+            return;
+        }
+        
+        h = 37;
+
+        // The OID
+        h += h * 17 + oid.hashCode();
+
+        // The SchemaObject type
+        h += h * 17 + objectType.getValue();
+
+        // The Names, if any
+        if ( ( names != null ) && ( names.size() != 0 ) )
+        {
+            for ( String name : names )
+            {
+                h += h * 17 + name.hashCode();
+            }
+        }
+
+        // The schemaName if any
+        if ( schemaName != null )
+        {
+            h += h * 17 + schemaName.hashCode();
+        }
+
+        h += h * 17 + ( isEnabled ? 1 : 0 );
+        h += h * 17 + ( isReadOnly ? 1 : 0 );
+
+        // The description, if any
+        if ( description != null )
+        {
+            h += h * 17 + description.hashCode();
+        }
+
+        // The extensions, if any
+        for ( String key : extensions.keySet() )
+        {
+            h += h * 17 + key.hashCode();
+
+            List<String> values = extensions.get( key );
+
+            if ( values != null )
+            {
+                for ( String value : values )
+                {
+                    h += h * 17 + value.hashCode();
+                }
+            }
+        }
+        
+        locked = true;
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java Wed Mar 24 17:14:56 2010
@@ -738,6 +738,11 @@ public class AttributeType extends Abstr
      */
     public void setSingleValued( boolean singleValued )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.isSingleValued = singleValued;
@@ -763,6 +768,11 @@ public class AttributeType extends Abstr
      */
     public void setUserModifiable( boolean canUserModify )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.canUserModify = canUserModify;
@@ -788,6 +798,11 @@ public class AttributeType extends Abstr
      */
     public void updateCollective( boolean collective )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.isCollective = collective;
     }
 
@@ -799,6 +814,11 @@ public class AttributeType extends Abstr
      */
     public void setCollective( boolean collective )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.isCollective = collective;
@@ -829,6 +849,11 @@ public class AttributeType extends Abstr
      */
     public void setUsage( UsageEnum usage )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.usage = usage;
@@ -848,6 +873,11 @@ public class AttributeType extends Abstr
      */
     public void updateUsage( UsageEnum usage )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.usage = usage;
     }
 
@@ -871,6 +901,11 @@ public class AttributeType extends Abstr
      */
     public void setSyntaxLength( int length )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.syntaxLength = length;
@@ -925,6 +960,11 @@ public class AttributeType extends Abstr
      */
     public void setSuperiorOid( String superiorOid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.superiorOid = superiorOid;
@@ -939,6 +979,11 @@ public class AttributeType extends Abstr
      */
     public void setSuperior( AttributeType superior )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.superior = superior;
@@ -954,6 +999,11 @@ public class AttributeType extends Abstr
      */
     public void setSuperior( String superiorOid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.superiorOid = superiorOid;
@@ -968,6 +1018,11 @@ public class AttributeType extends Abstr
      */
     public void updateSuperior( AttributeType superior )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.superior = superior;
         this.superiorOid = superior.getOid();
     }
@@ -1020,6 +1075,11 @@ public class AttributeType extends Abstr
      */
     public void setSyntaxOid( String syntaxOid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.syntaxOid = syntaxOid;
@@ -1034,6 +1094,11 @@ public class AttributeType extends Abstr
      */
     public void setSyntax( LdapSyntax syntax )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.syntax = syntax;
@@ -1049,6 +1114,11 @@ public class AttributeType extends Abstr
      */
     public void updateSyntax( LdapSyntax syntax )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.syntax = syntax;
         this.syntaxOid = syntax.getOid();
     }
@@ -1101,6 +1171,11 @@ public class AttributeType extends Abstr
      */
     public void setEqualityOid( String equalityOid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.equalityOid = equalityOid;
@@ -1115,6 +1190,11 @@ public class AttributeType extends Abstr
      */
     public void setEquality( MatchingRule equality )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.equality = equality;
@@ -1130,6 +1210,11 @@ public class AttributeType extends Abstr
      */
     public void updateEquality( MatchingRule equality )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.equality = equality;
         this.equalityOid = equality.getOid();
     }
@@ -1182,6 +1267,11 @@ public class AttributeType extends Abstr
      */
     public void setOrderingOid( String orderingOid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.orderingOid = orderingOid;
@@ -1196,6 +1286,11 @@ public class AttributeType extends Abstr
      */
     public void setOrdering( MatchingRule ordering )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.ordering = ordering;
@@ -1211,6 +1306,11 @@ public class AttributeType extends Abstr
      */
     public void updateOrdering( MatchingRule ordering )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.ordering = ordering;
         this.orderingOid = ordering.getOid();
     }
@@ -1263,6 +1363,11 @@ public class AttributeType extends Abstr
      */
     public void setSubstringOid( String substrOid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.substringOid = substrOid;
@@ -1277,6 +1382,11 @@ public class AttributeType extends Abstr
      */
     public void setSubstring( MatchingRule substring )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.substring = substring;
@@ -1292,6 +1402,11 @@ public class AttributeType extends Abstr
      */
     public void updateSubstring( MatchingRule substring )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.substring = substring;
         this.substringOid = substring.getOid();
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITContentRule.java Wed Mar 24 17:14:56 2010
@@ -23,6 +23,7 @@ package org.apache.directory.shared.ldap
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.schema.registries.ObjectClassRegistry;
@@ -182,6 +183,11 @@ public class DITContentRule extends Abst
      */
     public void addAuxObjectClassOidOids( String oid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             auxObjectClassOids.add( oid );
@@ -196,6 +202,11 @@ public class DITContentRule extends Abst
      */
     public void addAuxObjectClasses( ObjectClass objectClass )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             if ( !auxObjectClassOids.contains( objectClass.getOid() ) )
@@ -212,6 +223,11 @@ public class DITContentRule extends Abst
      */
     public void setAuxObjectClassOids( List<String> auxObjectClassOids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.auxObjectClassOids = auxObjectClassOids;
@@ -224,6 +240,11 @@ public class DITContentRule extends Abst
      */
     public void setAuxObjectClasses( List<ObjectClass> auxObjectClasses )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.auxObjectClasses = auxObjectClasses;
@@ -264,6 +285,11 @@ public class DITContentRule extends Abst
      */
     public void addMayAttributeTypeOids( String oid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             mayAttributeTypeOids.add( oid );
@@ -278,6 +304,11 @@ public class DITContentRule extends Abst
      */
     public void addMayAttributeTypes( AttributeType attributeType )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             if ( !mayAttributeTypeOids.contains( attributeType.getOid() ) )
@@ -294,6 +325,11 @@ public class DITContentRule extends Abst
      */
     public void setMayAttributeTypeOids( List<String> mayAttributeTypeOids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mayAttributeTypeOids = mayAttributeTypeOids;
@@ -308,6 +344,11 @@ public class DITContentRule extends Abst
      */
     public void setMayAttributeTypes( List<AttributeType> mayAttributeTypes )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mayAttributeTypes = mayAttributeTypes;
@@ -348,6 +389,11 @@ public class DITContentRule extends Abst
      */
     public void addMustAttributeTypeOids( String oid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             mustAttributeTypeOids.add( oid );
@@ -362,6 +408,11 @@ public class DITContentRule extends Abst
      */
     public void addMustAttributeTypes( AttributeType attributeType )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             if ( !mustAttributeTypeOids.contains( attributeType.getOid() ) )
@@ -378,6 +429,11 @@ public class DITContentRule extends Abst
      */
     public void setMustAttributeTypeOids( List<String> mustAttributeTypeOids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mustAttributeTypeOids = mustAttributeTypeOids;
@@ -392,6 +448,11 @@ public class DITContentRule extends Abst
      */
     public void setMustAttributeTypes( List<AttributeType> mustAttributeTypes )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mustAttributeTypes = mustAttributeTypes;
@@ -432,6 +493,11 @@ public class DITContentRule extends Abst
      */
     public void addNotAttributeTypeOids( String oid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             notAttributeTypeOids.add( oid );
@@ -446,6 +512,11 @@ public class DITContentRule extends Abst
      */
     public void addNotAttributeTypes( AttributeType attributeType )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             if ( !notAttributeTypeOids.contains( attributeType.getOid() ) )
@@ -462,6 +533,11 @@ public class DITContentRule extends Abst
      */
     public void setNotAttributeTypeOids( List<String> notAttributeTypeOids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.notAttributeTypeOids = notAttributeTypeOids;
@@ -476,6 +552,11 @@ public class DITContentRule extends Abst
      */
     public void setNotAttributeTypes( List<AttributeType> notAttributeTypes )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.notAttributeTypes = notAttributeTypes;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DITStructureRule.java Wed Mar 24 17:14:56 2010
@@ -23,6 +23,7 @@ package org.apache.directory.shared.ldap
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.NotImplementedException;
 
 
@@ -123,6 +124,11 @@ public class DITStructureRule extends Ab
      */
     public void setForm( String form )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.form = form;
@@ -146,6 +152,11 @@ public class DITStructureRule extends Ab
      */
     public void setRuleId( int ruleId )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.ruleId = ruleId;
@@ -169,6 +180,11 @@ public class DITStructureRule extends Ab
      */
     public void setSuperRules( List<Integer> superRules )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.superRules = superRules;
@@ -183,6 +199,11 @@ public class DITStructureRule extends Ab
      */
     public void addSuperRule( Integer superRule )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         superRules.add( superRule );
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java Wed Mar 24 17:14:56 2010
@@ -22,6 +22,7 @@ package org.apache.directory.shared.ldap
 
 import java.util.List;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.schema.syntaxCheckers.OctetStringSyntaxChecker;
@@ -136,6 +137,11 @@ public class LdapSyntax extends Abstract
      */
     public void setHumanReadable( boolean isHumanReadable )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.isHumanReadable = isHumanReadable;
@@ -162,6 +168,11 @@ public class LdapSyntax extends Abstract
      */
     public void setSyntaxChecker( SyntaxChecker syntaxChecker )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.syntaxChecker = syntaxChecker;
@@ -176,6 +187,11 @@ public class LdapSyntax extends Abstract
      */
     public void updateSyntaxChecker( SyntaxChecker syntaxChecker )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.syntaxChecker = syntaxChecker;
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.java Wed Mar 24 17:14:56 2010
@@ -20,6 +20,7 @@
 package org.apache.directory.shared.ldap.schema;
 
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.exception.LdapException;
 
 import org.apache.directory.shared.ldap.schema.registries.Registries;
@@ -91,6 +92,11 @@ public abstract class LoadableSchemaObje
      */
     public void setBytecode( String bytecode )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.bytecode = bytecode;
@@ -114,6 +120,11 @@ public abstract class LoadableSchemaObje
      */
     public void setFqcn( String fqcn )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.fqcn = fqcn;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java Wed Mar 24 17:14:56 2010
@@ -248,6 +248,11 @@ public class MatchingRule extends Abstra
      */
     public void setSyntaxOid( String oid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.ldapSyntaxOid = oid;
@@ -262,6 +267,11 @@ public class MatchingRule extends Abstra
      */
     public void setSyntax( LdapSyntax ldapSyntax )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.ldapSyntax = ldapSyntax;
@@ -277,6 +287,11 @@ public class MatchingRule extends Abstra
      */
     public void updateSyntax( LdapSyntax ldapSyntax )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.ldapSyntax = ldapSyntax;
         this.ldapSyntaxOid = ldapSyntax.getOid();
     }
@@ -302,6 +317,11 @@ public class MatchingRule extends Abstra
      */
     public void setLdapComparator( LdapComparator<?> ldapComparator )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.ldapComparator = ( LdapComparator<? super Object> ) ldapComparator;
@@ -316,6 +336,11 @@ public class MatchingRule extends Abstra
      */
     public void updateLdapComparator( LdapComparator<?> ldapComparator )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.ldapComparator = ( LdapComparator<? super Object> ) ldapComparator;
     }
 
@@ -340,6 +365,11 @@ public class MatchingRule extends Abstra
      */
     public void setNormalizer( Normalizer normalizer )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.normalizer = normalizer;
@@ -354,6 +384,11 @@ public class MatchingRule extends Abstra
      */
     public void updateNormalizer( Normalizer normalizer )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         this.normalizer = normalizer;
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRuleUse.java Wed Mar 24 17:14:56 2010
@@ -23,6 +23,7 @@ package org.apache.directory.shared.ldap
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.exception.LdapException;
 
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
@@ -118,6 +119,11 @@ public class MatchingRuleUse extends Abs
      */
     public void addToRegistries( Registries registries ) throws LdapException
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( registries != null )
         {
             AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();
@@ -160,6 +166,11 @@ public class MatchingRuleUse extends Abs
      */
     public void setApplicableAttributeOids( List<String> applicableAttributeOids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.applicableAttributeOids = applicableAttributeOids;
@@ -174,6 +185,11 @@ public class MatchingRuleUse extends Abs
      */
     public void setApplicableAttributes( List<AttributeType> applicableAttributes )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.applicableAttributes = applicableAttributes;
@@ -196,6 +212,11 @@ public class MatchingRuleUse extends Abs
      */
     public void addApplicableAttributeOids( String oid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             if ( !applicableAttributeOids.contains( oid ) )
@@ -213,6 +234,11 @@ public class MatchingRuleUse extends Abs
      */
     public void addApplicableAttribute( AttributeType attributeType )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             if ( !applicableAttributeOids.contains( attributeType.getOid() ) )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NameForm.java Wed Mar 24 17:14:56 2010
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.exception.LdapException;
 
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
@@ -206,6 +207,11 @@ public class NameForm extends AbstractSc
      */
     public void setStructuralObjectClassOid( String structuralObjectClassOid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.structuralObjectClassOid = structuralObjectClassOid;
@@ -220,6 +226,11 @@ public class NameForm extends AbstractSc
      */
     public void setStructuralObjectClass( ObjectClass structuralObjectClass )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.structuralObjectClass = structuralObjectClass;
@@ -262,6 +273,11 @@ public class NameForm extends AbstractSc
      */
     public void setMustAttributeTypeOids( List<String> mustAttributeTypeOids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mustAttributeTypeOids = mustAttributeTypeOids;
@@ -276,6 +292,11 @@ public class NameForm extends AbstractSc
      */
     public void setMustAttributeTypes( List<AttributeType> mustAttributeTypes )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mustAttributeTypes = mustAttributeTypes;
@@ -298,6 +319,11 @@ public class NameForm extends AbstractSc
      */
     public void addMustAttributeTypeOids( String oid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             mustAttributeTypeOids.add( oid );
@@ -312,6 +338,11 @@ public class NameForm extends AbstractSc
      */
     public void addMustAttributeTypes( AttributeType attributeType )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             if ( !mustAttributeTypeOids.contains( attributeType.getOid() ) )
@@ -357,6 +388,11 @@ public class NameForm extends AbstractSc
      */
     public void setMayAttributeTypeOids( List<String> mayAttributeTypeOids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mayAttributeTypeOids = mayAttributeTypeOids;
@@ -371,6 +407,11 @@ public class NameForm extends AbstractSc
      */
     public void setMayAttributeTypes( List<AttributeType> mayAttributeTypes )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mayAttributeTypes = mayAttributeTypes;
@@ -393,6 +434,11 @@ public class NameForm extends AbstractSc
      */
     public void addMayAttributeTypeOids( String oid )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             mayAttributeTypeOids.add( oid );
@@ -407,6 +453,11 @@ public class NameForm extends AbstractSc
      */
     public void addMayAttributeTypes( AttributeType attributeType )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             if ( !mayAttributeTypeOids.contains( attributeType.getOid() ) )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java Wed Mar 24 17:14:56 2010
@@ -406,6 +406,11 @@ public class ObjectClass extends Abstrac
      */
     public void addMayAttributeTypeOids( String... oids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             for ( String oid : oids )
@@ -423,6 +428,11 @@ public class ObjectClass extends Abstrac
      */
     public void addMayAttributeTypes( AttributeType... attributeTypes )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             for ( AttributeType attributeType : attributeTypes )
@@ -442,6 +452,11 @@ public class ObjectClass extends Abstrac
      */
     public void setMayAttributeTypeOids( List<String> mayAttributeTypeOids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mayAttributeTypeOids = mayAttributeTypeOids;
@@ -456,6 +471,11 @@ public class ObjectClass extends Abstrac
      */
     public void setMayAttributeTypes( List<AttributeType> mayAttributeTypes )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mayAttributeTypes = mayAttributeTypes;
@@ -516,6 +536,11 @@ public class ObjectClass extends Abstrac
      */
     public void addMustAttributeTypeOids( String... oids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             for ( String oid : oids )
@@ -533,6 +558,11 @@ public class ObjectClass extends Abstrac
      */
     public void addMustAttributeTypes( AttributeType... attributeTypes )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             for ( AttributeType attributeType : attributeTypes )
@@ -552,6 +582,11 @@ public class ObjectClass extends Abstrac
      */
     public void setMustAttributeTypeOids( List<String> mustAttributeTypeOids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mustAttributeTypeOids = mustAttributeTypeOids;
@@ -566,6 +601,11 @@ public class ObjectClass extends Abstrac
      */
     public void setMustAttributeTypes( List<AttributeType> mustAttributeTypes )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.mustAttributeTypes = mustAttributeTypes;
@@ -630,6 +670,11 @@ public class ObjectClass extends Abstrac
      */
     public void addSuperiorOids( String... oids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             for ( String oid : oids )
@@ -650,6 +695,11 @@ public class ObjectClass extends Abstrac
      */
     public void addSuperior( ObjectClass... objectClasses )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             for ( ObjectClass objectClass : objectClasses )
@@ -671,6 +721,11 @@ public class ObjectClass extends Abstrac
      */
     public void setSuperiors( List<ObjectClass> superiors )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.superiors = superiors;
@@ -713,6 +768,11 @@ public class ObjectClass extends Abstrac
      */
     public void setSuperiorOids( List<String> superiorOids )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.superiorOids = superiorOids;
@@ -738,6 +798,11 @@ public class ObjectClass extends Abstrac
      */
     public void setType( ObjectClassTypeEnum objectClassType )
     {
+        if ( locked )
+        {
+            throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
+        }
+        
         if ( !isReadOnly )
         {
             this.objectClassType = objectClassType;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java Wed Mar 24 17:14:56 2010
@@ -347,4 +347,12 @@ public interface SchemaObject extends Se
      * @param registries The Registries
      */
     void setRegistries( Registries registries );
+    
+    
+    /**
+     * Transform the SchemaObject to an immutable object
+     * TODO locked.
+     *
+     */
+    void lock();
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java?rev=927122&r1=927121&r2=927122&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java Wed Mar 24 17:14:56 2010
@@ -1345,6 +1345,9 @@ public class Registries implements Schem
 
         // Build the SchemaObject references
         buildReference( errors, schemaObject );
+        
+        // Lock the SchemaObject
+        schemaObject.lock();
 
         if ( errors.isEmpty() )
         {



Mime
View raw message