directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r519076 - in /directory/shared/trunk: ./ ldap/ ldap/src/main/java/org/apache/directory/shared/ldap/trigger/ ldap/src/main/java/org/apache/directory/shared/ldap/util/ ldap/src/test/java/org/apache/directory/shared/ldap/ldif/
Date Fri, 16 Mar 2007 18:18:59 GMT
Author: elecharny
Date: Fri Mar 16 11:18:58 2007
New Revision: 519076

URL: http://svn.apache.org/viewvc?view=rev&rev=519076
Log:
Now use the newly created project shared-ldap-constants
Reflected the changes into the source files

Modified:
    directory/shared/trunk/ldap/pom.xml
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
    directory/shared/trunk/pom.xml

Modified: directory/shared/trunk/ldap/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/pom.xml?view=diff&rev=519076&r1=519075&r2=519076
==============================================================================
--- directory/shared/trunk/ldap/pom.xml (original)
+++ directory/shared/trunk/ldap/pom.xml Fri Mar 16 11:18:58 2007
@@ -88,6 +88,12 @@
     </dependency>
 
     <dependency>
+      <groupId>org.apache.directory.shared</groupId>
+      <artifactId>shared-ldap-constants</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+
+    <dependency>
       <groupId>antlr</groupId>
       <artifactId>antlr</artifactId>
       <version>2.7.6</version>

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java?view=diff&rev=519076&r1=519075&r2=519076
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java
Fri Mar 16 11:18:58 2007
@@ -27,6 +27,7 @@
 import javax.naming.directory.DirContext;
 import javax.naming.ldap.LdapContext;
 
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 
@@ -69,7 +70,7 @@
         Attribute objectClass = new AttributeImpl( "objectClass" );
         subentry.put( objectClass );
         objectClass.add( "top" );
-        objectClass.add( "subentry" );
+        objectClass.add( SchemaConstants.SUBENTRY_OC );
         objectClass.add( TRIGGER_EXECUTION_SUBENTRY_OC );
         subentry.put( SUBTREE_SPECIFICATION_ATTR, subtreeSpec );
         subentry.put( PRESCRIPTIVE_TRIGGER_SPECIFICATION_ATTR, prescriptiveTriggerSpec );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java?view=diff&rev=519076&r1=519075&r2=519076
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
Fri Mar 16 11:18:58 2007
@@ -306,7 +306,15 @@
         return null;
     }
     
-    
+    /**
+     * Check if an attribute contains a specific value, using the associated matchingRule
for that
+     *
+     * @param attr The attribute we are searching in
+     * @param compared The object we are looking for
+     * @param type The attribute type
+     * @return <code>true</code> if the value exists in the attribute</code>
+     * @throws NamingException If something went wrong while accessing the data
+     */
     public final static boolean containsValue( Attribute attr, Object compared, AttributeType
type ) throws NamingException
     {
         // quick bypass test
@@ -320,9 +328,12 @@
         if ( type.getSyntax().isHumanReadible() )
         {
             String comparedStr = ( String ) normalizer.normalize( compared );
-            for ( int ii = attr.size() - 1; ii >= 0; ii-- )
+            
+            for ( NamingEnumeration values = attr.getAll(); values.hasMoreElements(); /**/
)
+            //for ( int ii = attr.size() - 1; ii >= 0; ii-- )
             {
-                String value = ( String ) attr.get( ii );
+                String value = (String)values.nextElement();
+                //String value = ( String ) attr.get( ii );
                 if ( comparedStr.equals( normalizer.normalize( value ) ) )
                 {
                     return true;
@@ -332,9 +343,12 @@
         else
         {
             byte[] comparedBytes = ( byte[] ) compared;
-            for ( int ii = attr.size() - 1; ii >= 0; ii-- )
+            
+            for ( NamingEnumeration values = attr.getAll(); values.hasMoreElements(); /**/
)
+            //for ( int ii = attr.size() - 1; ii >= 0; ii-- )
             {
-                if ( ArrayUtils.isEquals( comparedBytes, attr.get( ii ) ) )
+                String value = (String)values.nextElement();
+                if ( ArrayUtils.isEquals( comparedBytes, value ) )
                 {
                     return true;
                 }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java?view=diff&rev=519076&r1=519075&r2=519076
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
Fri Mar 16 11:18:58 2007
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.ldif;
 
+
 import java.io.DataOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -33,6 +34,7 @@
 import javax.naming.ldap.Control;
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.util.StringTools;
 
@@ -1555,7 +1557,7 @@
         assertEquals( "cn=browseRootAci,dc=example,dc=com", entry.getDn() );
         Attribute attr = entry.get( "objectClass" );
         assertTrue( attr.contains( "top" ) );
-        assertTrue( attr.contains( "subentry" ) );
+        assertTrue( attr.contains( SchemaConstants.SUBENTRY_OC ) );
         assertTrue( attr.contains( "accessControlSubentry" ) );
 
         attr = entry.get( "subtreeSpecification" );

Modified: directory/shared/trunk/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/pom.xml?view=diff&rev=519076&r1=519075&r2=519076
==============================================================================
--- directory/shared/trunk/pom.xml (original)
+++ directory/shared/trunk/pom.xml Fri Mar 16 11:18:58 2007
@@ -14,6 +14,7 @@
   <modules>
     <module>asn1</module>
     <module>ldap</module>
+    <module>ldap-constants</module>
     <module>asn1-codec</module>
     <module>convert</module>
   </modules>



Mime
View raw message