directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1028966 [9/9] - in /directory/shared/branches/shared-config: all/ dsml-engine/ dsml-parser/ dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/ dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ dsml-parser/src...
Date Sat, 30 Oct 2010 01:51:55 GMT
Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java
Sat Oct 30 01:51:50 2010
@@ -28,76 +28,36 @@ import org.apache.directory.shared.asn1.
  * This class store the PSearchControl's grammar constants. It is also used for
  * debugging purposes.
  * 
- * TODO: should this be an enum?
- * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class PersistentSearchControlStatesEnum implements States
+public enum PersistentSearchControlStatesEnum implements States
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
+    /** The END_STATE */
+    END_STATE,
+
     // =========================================================================
     // Persistent search control grammar states
     // =========================================================================
     /** Initial state */
-    public static final int START_STATE = 0;
+    START_STATE,
 
     /** Sequence Value */
-    public static final int PSEARCH_SEQUENCE_STATE = 1;
+    PSEARCH_SEQUENCE_STATE,
 
     /** changeTypes Value */
-    public static final int CHANGE_TYPES_STATE = 2;
+    CHANGE_TYPES_STATE,
     
     /** changesOnly Value */
-    public static final int CHANGES_ONLY_STATE = 3;
+    CHANGES_ONLY_STATE,
 
     /** returnECs Value */
-    public static final int RETURN_ECS_STATE = 4;
+    RETURN_ECS_STATE,
 
     /** terminal state */
-    public static final int LAST_PSEARCH_STATE = 5;
-
-    // =========================================================================
-    // States debug strings
-    // =========================================================================
-    /** A string representation of all the states */
-    private static final String[] PSEARCH_STRING = new String[]
-        { 
-        "START_STATE", 
-        "PSEARCH_SEQUENCE_VALUE", 
-        "CHANGE_TYPES_STATE",
-        "CHANGES_ONLY_STATE", 
-        "RETURN_ECS_STATE" 
-        };
-
-    /** The instance */
-    private static PersistentSearchControlStatesEnum instance = new PersistentSearchControlStatesEnum();
-
-
-    // ~ Constructors
-    // -------------------------------------------------------------------------------
-
-    /**
-     * This is a private constructor. This class is a singleton
-     */
-    private PersistentSearchControlStatesEnum()
-    {
-    }
-
-
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
-    /**
-     * Get an instance of this class
-     * 
-     * @return An instance on this class
-     */
-    public static States getInstance()
-    {
-        return instance;
-    }
+    LAST_PSEARCH_STATE;
 
 
     /**
@@ -137,6 +97,24 @@ public final class PersistentSearchContr
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END ) ? "PSEARCH_END_STATE" : PSEARCH_STRING[state] );
+        return ( ( state == END_STATE.ordinal() ) ? "PSEARCH_END_STATE" : name() );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEndState()
+    {
+        return this == END_STATE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public PersistentSearchControlStatesEnum getStartState()
+    {
+        return START_STATE;
     }
 }

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java
Sat Oct 30 01:51:50 2010
@@ -40,7 +40,7 @@ public class SubentriesControlContainer 
         super();
         stateStack = new int[1];
         grammar = SubentriesControlGrammar.getInstance();
-        states = SubentriesControlStatesEnum.getInstance();
+        setTransition( SubentriesControlStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java
Sat Oct 30 01:51:50 2010
@@ -58,12 +58,11 @@ public final class SubentriesControlGram
     private SubentriesControlGrammar()
     {
         setName( SubentriesControlGrammar.class.getName() );
-        setStatesEnum( SubentriesControlStatesEnum.getInstance() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[SubentriesControlStatesEnum.LAST_SUB_ENTRY_STATE][256];
+        super.transitions = new GrammarTransition[SubentriesControlStatesEnum.LAST_SUB_ENTRY_STATE.ordinal()][256];
 
-        super.transitions[SubentriesControlStatesEnum.START_STATE][UniversalTag.BOOLEAN.getValue()]
= 
+        super.transitions[SubentriesControlStatesEnum.START_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()]
= 
             new GrammarTransition( SubentriesControlStatesEnum.START_STATE, 
                                     SubentriesControlStatesEnum.SUB_ENTRY_VISIBILITY_STATE,
UniversalTag.BOOLEAN.getValue(), 
                 new GrammarAction( "SubEntryControl visibility" )

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java
Sat Oct 30 01:51:50 2010
@@ -30,61 +30,26 @@ import org.apache.directory.shared.asn1.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SubentriesControlStatesEnum implements States
+public enum SubentriesControlStatesEnum implements States
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
+    /** The END_STATE */
+    END_STATE,
+
     // =========================================================================
     // Sub entry control grammar states
     // =========================================================================
 
     /** Starting state */
-    public static final int START_STATE = 0;
+    START_STATE,
 
     /** Visibility Value */
-    public static final int SUB_ENTRY_VISIBILITY_STATE = 1;
+    SUB_ENTRY_VISIBILITY_STATE,
 
     /** terminal state */
-    public static final int LAST_SUB_ENTRY_STATE = 2;
-
-    // =========================================================================
-    // States debug strings
-    // =========================================================================
-    /** A string representation of all the states */
-    private static final String[] SUB_ENTRY_STRING = new String[]
-        {
-            "START_STATE",
-            "SUB_ENTRY_VISIBILITY_STATE"
-        };
-
-    /** The instance */
-    private static SubentriesControlStatesEnum instance = new SubentriesControlStatesEnum();
-
-
-    // ~ Constructors
-    // -------------------------------------------------------------------------------
-
-    /**
-     * This is a private constructor. This class is a singleton
-     */
-    private SubentriesControlStatesEnum()
-    {
-    }
-
-
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
-    /**
-     * Get an instance of this class
-     * 
-     * @return An instance on this class
-     */
-    public static States getInstance()
-    {
-        return instance;
-    }
+    LAST_SUB_ENTRY_STATE;
 
 
     /**
@@ -124,6 +89,24 @@ public final class SubentriesControlStat
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END ) ? "SUB_ENTRY_END_STATE" : SUB_ENTRY_STRING[state]
);
+        return ( ( state == END_STATE.ordinal() ) ? "SUB_ENTRY_END_STATE" : name() );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEndState()
+    {
+        return this == END_STATE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public SubentriesControlStatesEnum getStartState()
+    {
+        return START_STATE;
     }
 }

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/constants/LdapSecurityConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/constants/LdapSecurityConstants.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/constants/LdapSecurityConstants.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/constants/LdapSecurityConstants.java
Sat Oct 30 01:51:50 2010
@@ -43,7 +43,36 @@ public enum LdapSecurityConstants
     HASH_METHOD_CRYPT("crypt"),
 
     /** The SHA-256 encryption method */
-    HASH_METHOD_SHA256("sha-256");
+    HASH_METHOD_SHA256("sha-256"),
+
+    /** The salted SHA-256 encryption method */
+    HASH_METHOD_SSHA256("ssha-256"),
+
+    /** The SHA-384 encryption method */
+    HASH_METHOD_SHA384("sha-384"),
+
+    /** The salted SHA-384 encryption method */
+    HASH_METHOD_SSHA384("ssha-384"),
+
+    /** The SHA-512 encryption method */
+    HASH_METHOD_SHA512("sha-512"),
+
+    /** The salted SHA-512 encryption method */
+    HASH_METHOD_SSHA512("ssha-512");
+
+    /* These encryption types are not yet supported 
+    ** The AES encryption method *
+    ENC_METHOD_AES("aes"),
+    
+    ** The 3DES encryption method *
+    ENC_METHOD_3DES("3des"),
+    
+    ** The Blowfish encryption method *
+    ENC_METHOD_BLOWFISH("blowfish"),
+    
+    ** The RC4 encryption method *
+    ENC_METHOD_RC4("rc4");
+    */
 
     /** The associated name */
     private String name;
@@ -114,6 +143,53 @@ public enum LdapSecurityConstants
             return HASH_METHOD_SHA256;
         }
 
+        if ( HASH_METHOD_SSHA256.getName().equalsIgnoreCase( algorithm ) )
+        {
+            return HASH_METHOD_SSHA256;
+        }
+
+        if ( HASH_METHOD_SHA384.getName().equalsIgnoreCase( algorithm ) )
+        {
+            return HASH_METHOD_SHA384;
+        }
+
+        if ( HASH_METHOD_SSHA384.getName().equalsIgnoreCase( algorithm ) )
+        {
+            return HASH_METHOD_SSHA384;
+        }
+
+        if ( HASH_METHOD_SHA512.getName().equalsIgnoreCase( algorithm ) )
+        {
+            return HASH_METHOD_SHA512;
+        }
+
+        if ( HASH_METHOD_SSHA512.getName().equalsIgnoreCase( algorithm ) )
+        {
+            return HASH_METHOD_SSHA512;
+        }
+
+        /*
+        if ( ENC_METHOD_AES.getName().equalsIgnoreCase( algorithm ) )
+        {
+            return ENC_METHOD_AES;
+        }
+
+        if ( ENC_METHOD_3DES.getName().equalsIgnoreCase( algorithm ) )
+        {
+            return ENC_METHOD_3DES;
+        }
+
+        if ( ENC_METHOD_BLOWFISH.getName().equalsIgnoreCase( algorithm ) )
+        {
+            return ENC_METHOD_BLOWFISH;
+        }
+
+        if ( ENC_METHOD_RC4.getName().equalsIgnoreCase( algorithm ) )
+        {
+            return ENC_METHOD_RC4;
+        }
+        */
+
         return null;
     }
 }

Propchange: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/constants/MetaSchemaConstants.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct 30 01:51:50 2010
@@ -4,4 +4,5 @@
 /directory/shared/branches/shared-subtree/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/MetaSchemaConstants.java:965208-965686
 /directory/shared/branches/xdbm-refactoring/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/MetaSchemaConstants.java:945830-946347
 /directory/shared/branches-dnfactory-experiment/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/MetaSchemaConstants.java:980350-980351
+/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/constants/MetaSchemaConstants.java:1023442-1028955
 /directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/MetaSchemaConstants.java:519076-580502

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
Sat Oct 30 01:51:50 2010
@@ -145,6 +145,11 @@ public abstract class AbstractExprNode i
      */
     protected static Value<?> escapeFilterValue( Value<?> value )
     {
+        if ( value.isNull() )
+        {
+            return value;
+        }
+
         StringBuilder sb = null;
         String val;
 
@@ -195,7 +200,7 @@ public abstract class AbstractExprNode i
                     sb.append( digit.toUpperCase() );
                 }
             }
-            
+
             return new StringValue( sb.toString() );
         }
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ApproximateNode.java
Sat Oct 30 01:51:50 2010
@@ -72,7 +72,13 @@ public class ApproximateNode<T> extends 
             buf.append( attribute );
         }
         
-        buf.append( "~=" ).append( getEscapedValue() );
+        buf.append( "~=" );
+
+        Value<?> escapedValue = getEscapedValue();
+        if ( !escapedValue.isNull())
+        {
+            buf.append( escapedValue );
+        }
 
         buf.append( super.toString() );
         

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/EqualityNode.java
Sat Oct 30 01:51:50 2010
@@ -74,7 +74,13 @@ public class EqualityNode<T> extends Sim
             buf.append( attribute );
         }
         
-        buf.append( "=" ).append( getEscapedValue() );
+        buf.append( "=" );
+        
+        Value<?> escapedValue = getEscapedValue();
+        if ( !escapedValue.isNull())
+        {
+            buf.append( escapedValue );
+        }
 
         buf.append( super.toString() );
         

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/GreaterEqNode.java
Sat Oct 30 01:51:50 2010
@@ -74,7 +74,13 @@ public class GreaterEqNode<T> extends Si
             buf.append( attribute );
         }
         
-        buf.append( ">=" ).append( getEscapedValue() );
+        buf.append( ">=" );
+
+        Value<?> escapedValue = getEscapedValue();
+        if ( !escapedValue.isNull())
+        {
+            buf.append( escapedValue );
+        }
 
         buf.append( super.toString() );
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/filter/LessEqNode.java
Sat Oct 30 01:51:50 2010
@@ -74,7 +74,13 @@ public class LessEqNode<T> extends Simpl
             buf.append( attribute );
         }
         
-        buf.append( "<=" ).append( getEscapedValue() );
+        buf.append( "<=" );
+
+        Value<?> escapedValue = getEscapedValue();
+        if ( !escapedValue.isNull())
+        {
+            buf.append( escapedValue );
+        }
 
         buf.append( super.toString() );
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
Sat Oct 30 01:51:50 2010
@@ -29,6 +29,7 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.commons.collections.MultiMap;
 import org.apache.commons.collections.map.MultiValueMap;
@@ -188,7 +189,7 @@ public class RDN implements Cloneable, C
     public static final int EQUAL = 0;
 
     /** A flag used to tell if the RDN has been normalized */
-    private boolean normalized;
+    private AtomicBoolean normalized = new AtomicBoolean();
 
     /** the schema manager */
     private transient SchemaManager schemaManager;
@@ -217,7 +218,7 @@ public class RDN implements Cloneable, C
         this.schemaManager = schemaManager;
         upName = "";
         normName = "";
-        normalized = false;
+        normalized.set( false );
     }
 
 
@@ -243,12 +244,12 @@ public class RDN implements Cloneable, C
             {
                 this.schemaManager = schemaManager;
                 normalize( schemaManager.getNormalizerMapping() );
-                normalized = true;
+                normalized.set( true );
             }
             else
             {
                 normalize();
-                normalized = false;
+                normalized.set( false );
             }
 
             upName = rdn;
@@ -259,7 +260,7 @@ public class RDN implements Cloneable, C
             upName = "";
             normName = "";
             length = 0;
-            normalized = false;
+            normalized.set( false );
         }
     }
 
@@ -304,12 +305,12 @@ public class RDN implements Cloneable, C
 
         if( schemaManager != null )
         {
-            normalized = true;
+            normalized.set( true );
         }
         else
         {
             // As strange as it seems, the RDN is *not* normalized against the schema at
this point
-            normalized = false;
+            normalized.set( false );
         }
     }
 
@@ -353,7 +354,7 @@ public class RDN implements Cloneable, C
         {
             this.schemaManager = schemaManager;
             normalize( schemaManager.getNormalizerMapping() );
-            normalized = true;
+            normalized.set( true );
         }
         else
         {
@@ -361,7 +362,7 @@ public class RDN implements Cloneable, C
             normalize();
 
             // As strange as it seems, the RDN is *not* normalized against the schema at
this point
-            normalized = false;
+            normalized.set( false );
         }
     }
 
@@ -394,7 +395,7 @@ public class RDN implements Cloneable, C
         this.length = length;
         this.upName = upName;
         this.normName = normName;
-        normalized = true;
+        normalized.set( true );
     }
 
 
@@ -411,7 +412,7 @@ public class RDN implements Cloneable, C
         this.upName = rdn.getName();
         this.start = rdn.start;
         this.length = rdn.length;
-        normalized = rdn.normalized;
+        normalized.set(rdn.normalized.get());
 
         switch ( rdn.getNbAtavs() )
         {
@@ -506,13 +507,7 @@ public class RDN implements Cloneable, C
      */
     public RDN normalize( SchemaManager sm ) throws LdapInvalidDnException
     {
-        String savedUpName = getName();
-        DN.rdnOidToName( this, sm.getNormalizerMapping() );
-        normalize();
-        this.upName = savedUpName;
-        normalized = true;
-
-        return this;
+        return normalize( sm.getNormalizerMapping() );
     }
 
 
@@ -526,13 +521,26 @@ public class RDN implements Cloneable, C
      */
     public RDN normalize( Map<String, OidNormalizer> oidsMap ) throws LdapInvalidDnException
     {
-        String savedUpName = getName();
-        DN.rdnOidToName( this, oidsMap );
-        normalize();
-        this.upName = savedUpName;
-        normalized = true;
+        if ( ( oidsMap == null ) || ( oidsMap.isEmpty() ) )
+        {
+            return this;
+        }
 
-        return this;
+        if ( normalized.get() )
+        {
+            return this;
+        }
+
+        synchronized ( this )
+        {
+            String savedUpName = getName();
+            DN.rdnOidToName( this, oidsMap );
+            normalize();
+            this.upName = savedUpName;
+            normalized.set( true );
+    
+            return this;
+        }
     }
 
 
@@ -674,7 +682,7 @@ public class RDN implements Cloneable, C
         upName = "";
         start = -1;
         length = 0;
-        normalized = false;
+        normalized.set( false );
     }
 
 
@@ -847,6 +855,7 @@ public class RDN implements Cloneable, C
         try
         {
             RDN rdn = ( RDN ) super.clone();
+            rdn.normalized = new AtomicBoolean( normalized.get() );
 
             // The AttributeTypeAndValue is immutable. We won't clone it
 
@@ -1449,7 +1458,7 @@ public class RDN implements Cloneable, C
      */
     public boolean isNormalized()
     {
-        return normalized;
+        return normalized.get();
     }
 
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java
Sat Oct 30 01:51:50 2010
@@ -24,38 +24,42 @@ package org.apache.directory.shared.ldap
 /**
  * An enumeration that represents change inducing LDAP operations.
  * 
- * TODO: should this be an enum?
- * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class LdapOperation
+public enum LdapOperation
 {
-    public static final LdapOperation MODIFY = new LdapOperation( "Modify" );
+    MODIFY( "Modify" ),
 
-    public static final LdapOperation ADD = new LdapOperation( "Add" );
+    ADD( "Add" ),
 
-    public static final LdapOperation DELETE = new LdapOperation( "Delete" );
+    DELETE( "Delete" ),
 
-    public static final LdapOperation MODIFYDN = new LdapOperation( "ModifyDN" );
+    MODIFYDN( "ModifyDN" ),
     
-    public static final LdapOperation MODIFYDN_RENAME = new LdapOperation( "ModifyDN.Rename"
);
+    MODIFYDN_RENAME( "ModifyDN.Rename" ),
     
-    public static final LdapOperation MODIFYDN_EXPORT = new LdapOperation( "ModifyDN.Export"
);
+    MODIFYDN_EXPORT( "ModifyDN.Export" ),
     
-    public static final LdapOperation MODIFYDN_IMPORT = new LdapOperation( "ModifyDN.Import"
);
+    MODIFYDN_IMPORT( "ModifyDN.Import" );
 
     
     private final String name;
 
 
-    private LdapOperation( String name )
+    /**
+     * 
+     * Creates a new instance of LdapOperation.
+     *
+     * @param name
+     */
+    LdapOperation( String name )
     {
         this.name = name;
     }
 
 
     /**
-     * Returns the name of this LDAP operation.
+     * @return the name of this LDAP operation
      */
     public String getName()
     {
@@ -67,53 +71,4 @@ public final class LdapOperation
     {
         return name;
     }
-
-
-    /**
-     * @see java.lang.Object#hashCode()
-     * @return the instance's hash code 
-     */
-    public int hashCode()
-    {
-        int h = 37;
-
-        h = h*17 + ( ( name == null ) ? 0 : name.hashCode() );
-        
-        return h;
-    }
-
-
-    /**
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
-    public boolean equals( Object obj )
-    {
-        if ( this == obj )
-        {
-            return true;
-        }
-        
-        if ( ! ( obj  instanceof LdapOperation ) )
-        {
-            return false;
-        }
-
-        final LdapOperation other = ( LdapOperation ) obj;
-
-        if ( name == null )
-        {
-            if ( other.name != null )
-            {
-                return false;
-            }
-            else
-            { 
-                return true;
-            }
-        }
-        else 
-        {
-            return name.equals( other.name );
-        }
-    }
 }

Modified: directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueAttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueAttributeTypeTest.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueAttributeTypeTest.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/entry/BinaryValueAttributeTypeTest.java
Sat Oct 30 01:51:50 2010
@@ -36,8 +36,6 @@ import java.util.Arrays;
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
-import org.apache.directory.shared.ldap.entry.BinaryValue;
-import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.LdapSyntax;

Modified: directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterToStringTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterToStringTest.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterToStringTest.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterToStringTest.java
Sat Oct 30 01:51:50 2010
@@ -45,6 +45,34 @@ public class FilterToStringTest
         String str = "(ou=test)";
         ExprNode node = FilterParser.parse( str );
         assertEquals( str, node.toString() );
+
+        str = "(ou~=test)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str = "(ou>=test)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str = "(ou<=test)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str="(ou=)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str="(ou~=)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str="(ou>=)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
+
+        str="(ou<=)";
+        node = FilterParser.parse( str );
+        assertEquals( str, node.toString() );
     }
 
 

Modified: directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
Sat Oct 30 01:51:50 2010
@@ -50,7 +50,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
-import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -65,15 +65,15 @@ import org.junit.runner.RunWith;
 @Concurrent()
 public class DNTest
 {
-    private Map<String, OidNormalizer> oids;
-    private Map<String, OidNormalizer> oidOids;
+    private static Map<String, OidNormalizer> oids;
+    private static Map<String, OidNormalizer> oidOids;
 
 
     /**
      * Initialize OIDs maps for normalization
      */
-    @Before
-    public void initMapOids()
+    @BeforeClass
+    public static void initMapOids()
     {
         oids = new HashMap<String, OidNormalizer>();
 

Copied: directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/name/MultiThreadedTest.java
(from r1028955, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/MultiThreadedTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/name/MultiThreadedTest.java?p2=directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/name/MultiThreadedTest.java&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/MultiThreadedTest.java&r1=1028955&r2=1028966&rev=1028966&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/MultiThreadedTest.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/name/MultiThreadedTest.java
Sat Oct 30 01:51:50 2010
@@ -33,7 +33,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;

Modified: directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java
(original)
+++ directory/shared/branches/shared-config/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java
Sat Oct 30 01:51:50 2010
@@ -20,15 +20,15 @@
 package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.List;
-
-import static junit.framework.Assert.fail;
 import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertNotNull;
 import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.fail;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.schema.parsers.AbstractSchemaParser;



Mime
View raw message