directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r826174 - /directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/
Date Sat, 17 Oct 2009 04:13:05 GMT
Author: elecharny
Date: Sat Oct 17 04:13:04 2009
New Revision: 826174

URL: http://svn.apache.org/viewvc?rev=826174&view=rev
Log:
Added clone metods to all those objects

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/LdapComparator.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.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/Normalizer.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SyntaxChecker.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=826174&r1=826173&r2=826174&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
Sat Oct 17 04:13:04 2009
@@ -136,7 +136,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class AttributeType extends SchemaObject
+public class AttributeType extends SchemaObject implements Cloneable
 {
     /** The serialVersionUID */
     public static final long serialVersionUID = 1L;
@@ -823,4 +823,22 @@
     {
         return DescriptionUtils.getDescription( this );
     }
+    
+    
+    /**
+     * Clone an AttributeType
+     */
+    public AttributeType clone() throws CloneNotSupportedException
+    {
+        AttributeType clone = (AttributeType)super.clone();
+        
+        // All the references to other Registries object are set to null.
+        clone.equality = null;
+        clone.ordering = null;
+        clone.substring = null;
+        clone.superior = null;
+        clone.syntax = null;
+        
+        return clone;
+    }
 }

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=826174&r1=826173&r2=826174&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
Sat Oct 17 04:13:04 2009
@@ -563,4 +563,56 @@
     {
         return DescriptionUtils.getDescription( this );
     }
+
+
+    /**
+     * Clone a DITContentRule
+     */
+    public DITContentRule clone() throws CloneNotSupportedException
+    {
+        DITContentRule clone = (DITContentRule)super.clone();
+        
+        // Clone the AUX ObjectClasses
+        clone.auxObjectClassOids = new ArrayList<String>();
+        
+        for ( String oid : auxObjectClassOids )
+        {
+            clone.auxObjectClassOids.add( oid );
+        }
+        
+        clone.auxObjectClasses = new ArrayList<ObjectClass>();
+        
+        // Clone the MAY AttributeTypes
+        clone.mayAttributeTypeOids = new ArrayList<String>();
+        
+        for ( String oid : mayAttributeTypeOids )
+        {
+            clone.mayAttributeTypeOids.add( oid );
+        }
+        
+        clone.mayAttributeTypes = new ArrayList<AttributeType>();
+        
+        // Clone the MUST AttributeTypes
+        clone.mustAttributeTypeOids = new ArrayList<String>();
+        
+        for ( String oid : mustAttributeTypeOids )
+        {
+            clone.mustAttributeTypeOids.add( oid );
+        }
+        
+        clone.mustAttributeTypes = new ArrayList<AttributeType>();
+        
+        // Clone the NOT AttributeTypes
+        clone.notAttributeTypeOids = new ArrayList<String>();
+        
+        for ( String oid : notAttributeTypeOids )
+        {
+            clone.notAttributeTypeOids.add( oid );
+        }
+        
+        clone.notAttributeTypes = new ArrayList<AttributeType>();
+        
+        
+        return clone;
+    }
 }

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=826174&r1=826173&r2=826174&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
Sat Oct 17 04:13:04 2009
@@ -202,4 +202,23 @@
     {
         return DescriptionUtils.getDescription( this );
     }
+
+
+    /**
+     * Clone a DITStructureRule
+     */
+    public DITStructureRule clone() throws CloneNotSupportedException
+    {
+        DITStructureRule clone = (DITStructureRule)super.clone();
+        
+        // Clone the Superiors rules
+        clone.superRules = new ArrayList<Integer>();
+        
+        for ( int ruleId : superRules )
+        {
+            clone.superRules.add( ruleId );
+        }
+        
+        return clone;
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapComparator.java?rev=826174&r1=826173&r2=826174&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapComparator.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapComparator.java
Sat Oct 17 04:13:04 2009
@@ -52,4 +52,15 @@
     {
         super( SchemaObjectType.COMPARATOR );
     }
+
+
+    /**
+     * Clone a LdapComparator
+     */
+    public LdapComparator<T> clone() throws CloneNotSupportedException
+    {
+        LdapComparator<T> clone = (LdapComparator<T>)super.clone();
+        
+        return clone;
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java?rev=826174&r1=826173&r2=826174&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LdapSyntax.java
Sat Oct 17 04:13:04 2009
@@ -198,4 +198,18 @@
             }
         }
     }
+
+
+    /**
+     * Clone a LdapSyntax
+     */
+    public LdapSyntax clone() throws CloneNotSupportedException
+    {
+        LdapSyntax clone = (LdapSyntax)super.clone();
+        
+        // All the references to other Registries object are set to null.
+        clone.syntaxChecker = null;
+        
+        return clone;
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.java?rev=826174&r1=826173&r2=826174&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/LoadableSchemaObject.java
Sat Oct 17 04:13:04 2009
@@ -112,4 +112,15 @@
             this.fqcn = fqcn;
         }
     }
+
+
+    /**
+     * Clone a LoadableSchemaObject
+     */
+    public LoadableSchemaObject clone() throws CloneNotSupportedException
+    {
+        LoadableSchemaObject clone = (LoadableSchemaObject)super.clone();
+        
+        return clone;
+    }
 }

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=826174&r1=826173&r2=826174&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
Sat Oct 17 04:13:04 2009
@@ -267,4 +267,20 @@
     {
         return DescriptionUtils.getDescription( this );
     }
+    
+    
+    /**
+     * Clone an MatchingRule
+     */
+    public MatchingRule clone() throws CloneNotSupportedException
+    {
+        MatchingRule clone = (MatchingRule)super.clone();
+        
+        // All the references to other Registries object are set to null.
+        clone.ldapComparator = null;
+        clone.ldapSyntax = null;
+        clone.normalizer = null;
+        
+        return clone;
+    }
 }

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=826174&r1=826173&r2=826174&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
Sat Oct 17 04:13:04 2009
@@ -229,4 +229,26 @@
     {
         return DescriptionUtils.getDescription( this );
     }
+    
+    
+    /**
+     * Clone an MatchingRuleUse
+     */
+    public MatchingRuleUse clone() throws CloneNotSupportedException
+    {
+        MatchingRuleUse clone = (MatchingRuleUse)super.clone();
+        
+        // Clone the APPLY AttributeTypes
+        clone.applicableAttributeOids = new ArrayList<String>();
+        
+        for ( String oid : applicableAttributeOids )
+        {
+            clone.applicableAttributeOids.add( oid );
+        }
+        
+        clone.applicableAttributes = new ArrayList<AttributeType>();
+        
+        
+        return clone;
+    }
 }

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=826174&r1=826173&r2=826174&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
Sat Oct 17 04:13:04 2009
@@ -425,4 +425,38 @@
     {
         return DescriptionUtils.getDescription( this );
     }
+    
+    
+    /**
+     * Clone a NameForm
+     */
+    public NameForm clone() throws CloneNotSupportedException
+    {
+        NameForm clone = (NameForm)super.clone();
+        
+        // Clone the MAY AttributeTypes
+        clone.mayAttributeTypeOids = new ArrayList<String>();
+        
+        for ( String oid : mayAttributeTypeOids )
+        {
+            clone.mayAttributeTypeOids.add( oid );
+        }
+        
+        clone.mayAttributeTypes = new ArrayList<AttributeType>();
+        
+        // Clone the MUST AttributeTypes
+        clone.mustAttributeTypeOids = new ArrayList<String>();
+        
+        for ( String oid : mustAttributeTypeOids )
+        {
+            clone.mustAttributeTypeOids.add( oid );
+        }
+        
+        clone.mustAttributeTypes = new ArrayList<AttributeType>();
+
+        // All the references to other Registries object are set to null.
+        clone.structuralObjectClass = null;
+        
+        return clone;
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/Normalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/Normalizer.java?rev=826174&r1=826173&r2=826174&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/Normalizer.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/Normalizer.java
Sat Oct 17 04:13:04 2009
@@ -87,4 +87,15 @@
     {
         // Do nothing. The extended class will store the Registries if needed
     }
+
+
+    /**
+     * Clone a Normalizer
+     */
+    public Normalizer clone() throws CloneNotSupportedException
+    {
+        Normalizer clone = (Normalizer)super.clone();
+        
+        return clone;
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java?rev=826174&r1=826173&r2=826174&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectClass.java
Sat Oct 17 04:13:04 2009
@@ -505,4 +505,45 @@
     {
         return DescriptionUtils.getDescription( this );
     }
+
+    
+    /**
+     * Clone an ObjectClass
+     */
+    public ObjectClass clone() throws CloneNotSupportedException
+    {
+        ObjectClass clone = (ObjectClass)super.clone();
+        
+        // Clone the Superiors ObjectClasses
+        clone.superiorOids = new ArrayList<String>();
+        
+        for ( String oid : superiorOids )
+        {
+            clone.superiorOids.add( oid );
+        }
+        
+        clone.superiors = new ArrayList<ObjectClass>();
+        
+        // Clone the MAY AttributeTypes
+        clone.mayAttributeTypeOids = new ArrayList<String>();
+        
+        for ( String oid : mayAttributeTypeOids )
+        {
+            clone.mayAttributeTypeOids.add( oid );
+        }
+        
+        clone.mayAttributeTypes = new ArrayList<AttributeType>();
+        
+        // Clone the MUST AttributeTypes
+        clone.mustAttributeTypeOids = new ArrayList<String>();
+        
+        for ( String oid : mustAttributeTypeOids )
+        {
+            clone.mustAttributeTypeOids.add( oid );
+        }
+        
+        clone.mustAttributeTypes = new ArrayList<AttributeType>();
+        
+        return clone;
+    }
 }
\ No newline at end of file

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=826174&r1=826173&r2=826174&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
Sat Oct 17 04:13:04 2009
@@ -71,7 +71,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class SchemaObject implements Serializable
+public abstract class SchemaObject implements Serializable, Cloneable
 {
     /** The serialVersionUID */
     public static final long serialVersionUID = 1L;
@@ -706,4 +706,40 @@
         
         return false;
     }
+    
+
+    /**
+     * Clone a SchemaObject
+     */
+    public SchemaObject clone() throws CloneNotSupportedException
+    {
+        SchemaObject clone = (SchemaObject)super.clone();
+
+        //Clone the names
+        clone.names = new ArrayList<String>();
+        
+        for ( String name : names )
+        {
+            clone.names.add( name );
+        }
+
+        // Clone the extensions
+        clone.extensions = new HashMap<String, List<String>>();
+        
+        for ( String key : extensions.keySet() )
+        {
+            List<String> extensionValues = extensions.get( key );
+            
+            List<String> cloneExtension = new ArrayList<String>();
+            
+            for ( String value : extensionValues )
+            {
+                cloneExtension.add( value );
+            }
+            
+            clone.extensions.put( key, cloneExtension );
+        }
+        
+        return clone;
+    }
 }

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SyntaxChecker.java?rev=826174&r1=826173&r2=826174&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SyntaxChecker.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SyntaxChecker.java
Sat Oct 17 04:13:04 2009
@@ -82,4 +82,15 @@
             throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX
);
         }
     }
+
+
+    /**
+     * Clone a SyntaxChecker
+     */
+    public SyntaxChecker clone() throws CloneNotSupportedException
+    {
+        SyntaxChecker clone = (SyntaxChecker)super.clone();
+        
+        return clone;
+    }
 }



Mime
View raw message