directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r234243 - in /directory/shared/ldap/trunk/common/src: antlr/ java/org/apache/ldap/common/subtree/ test/org/apache/ldap/common/subtree/
Date Sun, 21 Aug 2005 15:32:51 GMT
Author: akarasulu
Date: Sun Aug 21 08:32:46 2005
New Revision: 234243

URL: http://svn.apache.org/viewcvs?rev=234243&view=rev
Log:
changes: for http://issues.apache.org/jira/browse/DIRLDAP-48

 o changed SS to use a Name for the base instead of a string
 o fixed the type change on BaseSS impl
 o fixed modifier with type change on base property
 o fixed parser with changes to base property
 o fixed test cases which now test for the base properly as a Name


Modified:
    directory/shared/ldap/trunk/common/src/antlr/subtree-specification.g
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/BaseSubtreeSpecification.java
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/SubtreeSpecification.java
    directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/SubtreeSpecificationModifier.java
    directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/subtree/SubtreeParserTest.java

Modified: directory/shared/ldap/trunk/common/src/antlr/subtree-specification.g
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/antlr/subtree-specification.g?rev=234243&r1=234242&r2=234243&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/antlr/subtree-specification.g (original)
+++ directory/shared/ldap/trunk/common/src/antlr/subtree-specification.g Sun Aug 21 08:32:46
2005
@@ -23,6 +23,8 @@
 package org.apache.ldap.common.subtree;
 
 
+import javax.naming.Name;
+import javax.naming.NamingException;
 import org.apache.ldap.common.name.LdapName;
 
 }
@@ -58,8 +60,14 @@
         BASE rdn:LOCALNAME
         {
             String quoted = rdn.getText();
-
-            modifier.setBase( quoted.substring( 1, quoted.length() - 1 ) );
+            try
+            {
+                modifier.setBase( new LdapName( quoted.substring( 1, quoted.length() - 1
) ) );
+            }
+            catch ( NamingException e )
+            {
+                throw new RecognitionException( "LdapName parse failed on base." );
+            }
         }
     )?
     ( SP )*

Modified: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/BaseSubtreeSpecification.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/BaseSubtreeSpecification.java?rev=234243&r1=234242&r2=234243&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/BaseSubtreeSpecification.java
(original)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/BaseSubtreeSpecification.java
Sun Aug 21 08:32:46 2005
@@ -17,10 +17,12 @@
 package org.apache.ldap.common.subtree;
 
 
+import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.filter.ExprNode;
 
 import java.util.Set;
 import java.util.Collections;
+import javax.naming.Name;
 
 
 /**
@@ -35,7 +37,7 @@
     private final static String EMPTY = "";
 
     /** the subtree base relative to the administration point */
-    private final String base;
+    private final Name base;
 
     /** the set of subordinates entries and their subordinates to exclude */
     private final Set chopBefore;
@@ -65,7 +67,7 @@
      */
     public BaseSubtreeSpecification()
     {
-        this.base = "";
+        this.base = new LdapName();
 
         this.minBaseDistance = 0;
 
@@ -89,7 +91,7 @@
      */
     public BaseSubtreeSpecification( ExprNode refinement )
     {
-        this.base = EMPTY;
+        this.base = new LdapName();
 
         this.minBaseDistance = 0;
 
@@ -110,7 +112,7 @@
      *
      * @param base the base of the subtree relative to the administrative point
      */
-    public BaseSubtreeSpecification( String base )
+    public BaseSubtreeSpecification( Name base )
     {
         this.base = base;
 
@@ -136,7 +138,7 @@
      * @param chopAfter the set of subordinates entries whose subordinates are to be excluded
      * @param chopBefore the set of subordinates entries and their subordinates to exclude
      */
-    public BaseSubtreeSpecification( String base, int minBaseDistance, int maxBaseDistance,
+    public BaseSubtreeSpecification( Name base, int minBaseDistance, int maxBaseDistance,
                                      Set chopAfter, Set chopBefore )
     {
         this( base, minBaseDistance, maxBaseDistance, chopAfter, chopBefore, null );
@@ -156,7 +158,7 @@
      * @param refinement the filter expression only composed of objectClass attribute
      * value assertions
      */
-    public BaseSubtreeSpecification( String base, int minBaseDistance, int maxBaseDistance,
+    public BaseSubtreeSpecification( Name base, int minBaseDistance, int maxBaseDistance,
                                      Set chopAfter, Set chopBefore, ExprNode refinement )
     {
         this.base = base;
@@ -185,7 +187,7 @@
     // -----------------------------------------------------------------------
 
 
-    public String getBase()
+    public Name getBase()
     {
         return this.base;
     }

Modified: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/SubtreeSpecification.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/SubtreeSpecification.java?rev=234243&r1=234242&r2=234243&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/SubtreeSpecification.java
(original)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/SubtreeSpecification.java
Sun Aug 21 08:32:46 2005
@@ -20,6 +20,7 @@
 import org.apache.ldap.common.filter.ExprNode;
 
 import java.util.Set;
+import javax.naming.Name;
 
 
 /**
@@ -42,10 +43,11 @@
      * a subentry immediately subordinate to dc=apache,dc=org would be relative to
      * the dc=apache,dc=org context.
      *
-     * @return the RDN representing the base of the subtree, or the empty string
-     * name if the base is the administrative point
+     * @return the RDN representing the base of the subtree, or the empty name
+     * if the base is the administrative point - note that this Name is not 
+     * Normalized according to matchingRules. 
      */
-    String getBase();
+    Name getBase();
 
     /**
      * A set of RDNs relative to the base entry representing chopBefore
@@ -53,7 +55,8 @@
      * chopBefore form is used then the specified entry and its subordinates
      * are excluded from the subtree or subtree refinement."
      *
-     * @return a set of relative names to the subtree base or the empty set
+     * @return a set of relative {@link javax.naming.Name}s to the subtree 
+     * base or the empty set
      */
     Set getChopBeforeExclusions();
 
@@ -63,7 +66,8 @@
      * chopAfter form is used then only the subordinates of the specified
      * entry are excluded from the subtree or subtree refinement."
      *
-     * @return a set of relative names to the subtree base or the empty set
+     * @return a set of relative {@link javax.naming.Name}s to the subtree 
+     * base or the empty set
      */
     Set getChopAfterExclusions();
 

Modified: directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/SubtreeSpecificationModifier.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/SubtreeSpecificationModifier.java?rev=234243&r1=234242&r2=234243&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/SubtreeSpecificationModifier.java
(original)
+++ directory/shared/ldap/trunk/common/src/java/org/apache/ldap/common/subtree/SubtreeSpecificationModifier.java
Sun Aug 21 08:32:46 2005
@@ -17,10 +17,12 @@
 package org.apache.ldap.common.subtree;
 
 
+import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.filter.ExprNode;
 
 import java.util.Set;
 import java.util.Collections;
+import javax.naming.Name;
 
 
 /**
@@ -36,7 +38,7 @@
     private final static String EMPTY = "";
 
     /** the subtree base relative to the administration point */
-    private String base = EMPTY;
+    private Name base = new LdapName();
 
     /** the set of subordinates entries and their subordinates to exclude */
     private Set chopBefore = Collections.EMPTY_SET;
@@ -84,7 +86,7 @@
      *
      * @param base subtree base relative to the administration point
      */
-    public void setBase( String base )
+    public void setBase( Name base )
     {
         this.base = base;
     }

Modified: directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/subtree/SubtreeParserTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/subtree/SubtreeParserTest.java?rev=234243&r1=234242&r2=234243&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/subtree/SubtreeParserTest.java
(original)
+++ directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/subtree/SubtreeParserTest.java
Sun Aug 21 08:32:46 2005
@@ -24,6 +24,8 @@
 import antlr.TokenStreamException;
 import antlr.RecognitionException;
 
+import org.apache.ldap.common.name.LdapName;
+
 
 /**
  * Tests the SubtreeSpecification parser.
@@ -78,7 +80,7 @@
     {
         SubtreeSpecification spec = parse( EMPTY_SPEC );
 
-        assertEquals( "", spec.getBase().toString() );
+        assertTrue( spec.getBase().isEmpty() );
 
         assertTrue( spec.getChopAfterExclusions().isEmpty() );
 
@@ -101,7 +103,7 @@
     {
         SubtreeSpecification spec = parse( EMPTY_SPEC_SP );
 
-        assertEquals( "", spec.getBase() );
+        assertEquals( new LdapName(), spec.getBase() );
 
         assertTrue( spec.getChopAfterExclusions().isEmpty() );
 
@@ -124,7 +126,7 @@
     {
         SubtreeSpecification spec = parse( SPEC_BASE );
 
-        assertEquals( "ou=system", spec.getBase() );
+        assertEquals( new LdapName( "ou=system" ), spec.getBase() );
 
         assertTrue( spec.getChopAfterExclusions().isEmpty() );
 



Mime
View raw message