directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r490418 - in /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap: aci/ filter/ subtree/
Date Wed, 27 Dec 2006 00:50:51 GMT
Author: seelmann
Date: Tue Dec 26 16:50:50 2006
New Revision: 490418

URL: http://svn.apache.org/viewvc?view=rev&rev=490418
Log:
Added methods printToBuffer(StringBuffer) and printRefinementToBuffer(StringBuffer buffer).
It is used get the string representation of ACI, Filter and SubtreeSpecification items.

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExprNode.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExtensibleNode.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/PresenceNode.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SubstringNode.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
Tue Dec 26 16:50:50 2006
@@ -111,6 +111,15 @@
 
 
     /**
+     * Converts this item into its string representation as stored
+     * in directory.
+     *
+     * @param buffer the string buffer
+     */
+    public abstract void printToBuffer( StringBuffer buffer );
+
+    
+    /**
      * Converts a set of {@link GrantAndDenial}s into a set of
      * {@link MicroOperation}s and returns it.
      */

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java
Tue Dec 26 16:50:50 2006
@@ -172,4 +172,16 @@
     {
         return "[" + code + "] " + name;
     }
+    
+    
+    /**
+     * Converts this item into its string representation as stored
+     * in directory.
+     *
+     * @param buffer the string buffer
+     */
+    public void printToBuffer( StringBuffer buffer )
+    {
+        buffer.append( getName() );
+    }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java
Tue Dec 26 16:50:50 2006
@@ -135,4 +135,95 @@
         }
         return tuples;
     }
+
+
+    /**
+     * Converts this item into its string representation as stored
+     * in directory.
+     *
+     * @param buffer the string buffer
+     */
+    public void printToBuffer( StringBuffer buffer )
+    {
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        
+        // identificationTag
+        buffer.append( "identificationTag" );
+        buffer.append( ' ' );
+        buffer.append( '"' );
+        buffer.append( getIdentificationTag() );
+        buffer.append( '"' );
+        buffer.append( ',' );
+        buffer.append( ' ' );
+        
+        // precedence
+        buffer.append( "precedence" );
+        buffer.append( ' ' );
+        buffer.append( getPrecedence() );
+        buffer.append( ',' );
+        buffer.append( ' ' );
+        
+        // authenticationLevel
+        buffer.append( "authenticationLevel" );
+        buffer.append( ' ' );
+        buffer.append( getAuthenticationLevel().getName() );
+        buffer.append( ',' );
+        buffer.append( ' ' );
+        
+        // itemOrUserFirst
+        buffer.append( "itemOrUserFirst" );
+        buffer.append( ' ' );
+        buffer.append( "itemFirst" );
+        buffer.append( ':' );
+        buffer.append( ' ' );
+        
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        
+        // protectedItems
+        buffer.append( "protectedItems" );
+        buffer.append( ' ' );
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        for ( Iterator it = protectedItems.iterator(); it.hasNext(); )
+        {
+            ProtectedItem item =  ( ProtectedItem ) it.next();
+            item.printToBuffer( buffer );
+            
+            if(it.hasNext()) {
+                buffer.append( ',' );
+                buffer.append( ' ' );
+            }
+        }
+        buffer.append( ' ' );
+        buffer.append( '}' );
+        
+        buffer.append( ',' );
+        buffer.append( ' ' );
+        
+        // itemPermissions
+        buffer.append( "itemPermissions" );
+        buffer.append( ' ' );
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        for ( Iterator it = itemPermissions.iterator(); it.hasNext(); )
+        {
+            ItemPermission permission = ( ItemPermission ) it.next();
+            permission.printToBuffer( buffer );
+            
+            if(it.hasNext()) {
+                buffer.append( ',' );
+                buffer.append( ' ' );
+            }
+        }
+        buffer.append( ' ' );
+        buffer.append( '}' );
+        
+        buffer.append( ' ' );
+        buffer.append( '}' );
+        
+        buffer.append( ' ' );
+        buffer.append( '}' );
+    }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
Tue Dec 26 16:50:50 2006
@@ -82,4 +82,65 @@
         return "itemPermission: precedence=" + getPrecedence() + ", " + "userClasses=" +
userClasses + ", "
             + "grantsAndDenials=" + getGrantsAndDenials();
     }
+    
+    /**
+     * Converts this item into its string representation as stored
+     * in directory.
+     *
+     * @param buffer the string buffer
+     */
+    public void printToBuffer( StringBuffer buffer )
+    {
+        buffer.append( '{' );
+        buffer.append( ' ' );
+
+        if ( getPrecedence() >= 0 && getPrecedence() <= 255 )
+        {
+            buffer.append( "precedence" );
+            buffer.append( ' ' );
+            buffer.append( getPrecedence() );
+            buffer.append( ',' );
+            buffer.append( ' ' );
+        }
+        
+        buffer.append( "userClasses" );
+        buffer.append( ' ' );
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        for ( Iterator it = userClasses.iterator(); it.hasNext(); )
+        {
+            UserClass userClass = ( UserClass ) it.next();
+            userClass.printToBuffer( buffer );
+            
+            if(it.hasNext()) {
+                buffer.append( ',' );
+                buffer.append( ' ' );
+            }
+        }
+        buffer.append( ' ' );
+        buffer.append( '}' );
+        
+        buffer.append( ',' );
+        buffer.append( ' ' );
+        
+        buffer.append( "grantsAndDenials" );
+        buffer.append( ' ' );
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        for ( Iterator it = getGrantsAndDenials().iterator(); it.hasNext(); )
+        {
+            GrantAndDenial grantAndDenial = ( GrantAndDenial ) it.next();
+            grantAndDenial.printToBuffer( buffer );
+            
+            if(it.hasNext()) {
+                buffer.append( ',' );
+                buffer.append( ' ' );
+            }
+        }
+        buffer.append( ' ' );
+        buffer.append( '}' );
+        
+        buffer.append( ' ' );
+        buffer.append( '}' );
+    }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
Tue Dec 26 16:50:50 2006
@@ -26,6 +26,7 @@
 import java.util.Collections;
 import java.util.Iterator;
 
+import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -69,6 +70,16 @@
     {
     }
 
+    
+    /**
+     * Converts this item into its string representation as stored
+     * in directory.
+     *
+     * @param buffer the string buffer
+     */
+    public abstract void printToBuffer( StringBuffer buffer );
+
+    
     /**
      * The contents of entries (possibly a family member) which are restricted
      * to those that have object class values that satisfy the predicate defined
@@ -117,6 +128,14 @@
 
             return false;
         }
+
+
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "classes" );
+            buffer.append( ' ' );
+            classes.printRefinementToBuffer( buffer );
+        }
     }
 
     /**
@@ -141,6 +160,12 @@
         {
             return "entry";
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "entry" );
+        }
     }
 
     /**
@@ -161,6 +186,12 @@
         {
             return "allUserAttributeTypes";
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "allUserAttributeTypes" );
+        }
     }
 
     /**
@@ -181,6 +212,12 @@
         {
             return "allUserAttributeTypesAndValues";
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "allUserAttributeTypesAndValues" );
+        }
     }
 
     /**
@@ -244,6 +281,27 @@
 
             return false;
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( '{' );
+            buffer.append( ' ' );
+            
+            for ( Iterator it = attributeTypes.iterator(); it.hasNext(); )
+            {
+                String attributeType = ( String ) it.next();
+                buffer.append( attributeType );
+                
+                if(it.hasNext()) {
+                    buffer.append( ',' );
+                    buffer.append( ' ' );
+                }
+            }
+            
+            buffer.append( ' ' );
+            buffer.append( '}' );
+        }
     }
 
     /**
@@ -269,7 +327,15 @@
 
         public String toString()
         {
-            return "attributType: " + attributeTypes;
+            return "attributeType: " + attributeTypes;
+        }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "attributeType" );
+            buffer.append( ' ' );
+            super.printToBuffer( buffer );
         }
     }
 
@@ -297,6 +363,14 @@
         {
             return "allAttributeValues: " + attributeTypes;
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "allAttributeValues" );
+            buffer.append( ' ' );
+            super.printToBuffer( buffer );
+        }
     }
 
     /**
@@ -328,6 +402,14 @@
         {
             return "selfValue: " + attributeTypes;
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "selfValue" );
+            buffer.append( ' ' );
+            super.printToBuffer( buffer );
+        }
     }
 
     /**
@@ -389,6 +471,39 @@
         {
             return "attributeValue: " + attributes;
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "attributeValue" );
+            buffer.append( ' ' );
+           
+            buffer.append( '{' );
+            buffer.append( ' ' );
+            
+            for ( Iterator it = attributes.iterator(); it.hasNext(); )
+            {
+                Attribute attribute = ( Attribute ) it.next();
+                buffer.append( attribute.getID() );
+                buffer.append( '=' );
+                try
+                {
+                    buffer.append( attribute.get( 0 ) );
+                }
+                catch ( NamingException e )
+                {
+                    // doesn't occur here, it is a BasicAttribute
+                }
+                
+                if(it.hasNext()) {
+                    buffer.append( ',' );
+                    buffer.append( ' ' );
+                }
+            }
+            
+            buffer.append( ' ' );
+            buffer.append( '}' );
+        }
     }
 
     /**
@@ -457,6 +572,30 @@
         {
             return "maxValueCount: " + items;
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "maxValueCount" );
+            buffer.append( ' ' );
+           
+            buffer.append( '{' );
+            buffer.append( ' ' );
+            
+            for ( Iterator it = items.iterator(); it.hasNext(); )
+            {
+                MaxValueCountItem item = ( MaxValueCountItem ) it.next();
+                item.printToBuffer( buffer );
+                
+                if(it.hasNext()) {
+                    buffer.append( ',' );
+                    buffer.append( ' ' );
+                }
+            }
+            
+            buffer.append( ' ' );
+            buffer.append( '}' );
+        }
     }
 
     /**
@@ -520,6 +659,14 @@
             filter.printToBuffer( buf );
             return buf.toString();
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "rangeOfValues" );
+            buffer.append( ' ' );
+            filter.printToBuffer( buffer );
+        }
     }
 
     /**
@@ -581,6 +728,14 @@
         {
             return "maxImmSub: " + value;
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "maxImmSub" );
+            buffer.append( ' ' );
+            buffer.append( value );
+        }
     }
 
     /**
@@ -650,6 +805,30 @@
         {
             return "restrictedBy: " + items;
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "restrictedBy" );
+            buffer.append( ' ' );
+            
+            buffer.append( '{' );
+            buffer.append( ' ' );
+            
+            for ( Iterator it = items.iterator(); it.hasNext(); )
+            {
+                RestrictedByItem item = ( RestrictedByItem ) it.next();
+                item.printToBuffer( buffer );
+                
+                if(it.hasNext()) {
+                    buffer.append( ',' );
+                    buffer.append( ' ' );
+                }
+            }
+            
+            buffer.append( ' ' );
+            buffer.append( '}' );
+        }
     }
 
     /**
@@ -702,6 +881,26 @@
         {
             return "attributeType=" + attributeType + ", maxCount=" + maxCount;
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( '{' );
+            buffer.append( ' ' );
+            
+            buffer.append( "type" );
+            buffer.append( ' ' );
+            buffer.append( attributeType );
+
+            buffer.append( ' ' );
+            
+            buffer.append( "maxCount" );
+            buffer.append( ' ' );
+            buffer.append( maxCount );
+            
+            buffer.append( ' ' );
+            buffer.append( '}' );
+        }
     }
 
     /**
@@ -755,5 +954,26 @@
         {
             return "attributeType=" + attributeType + ", valuesIn=" + valuesIn;
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( '{' );
+            buffer.append( ' ' );
+            
+            buffer.append( "type" );
+            buffer.append( ' ' );
+            buffer.append( attributeType );
+
+            buffer.append( ' ' );
+            
+            buffer.append( "valuesIn" );
+            buffer.append( ' ' );
+            buffer.append( valuesIn );
+            
+            buffer.append( ' ' );
+            buffer.append( '}' );
+        }
     }
+    
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
Tue Dec 26 16:50:50 2006
@@ -59,6 +59,16 @@
     protected UserClass()
     {
     }
+    
+    
+    /**
+     * Converts this item into its string representation as stored
+     * in directory.
+     *
+     * @param buffer the string buffer
+     */
+    public abstract void printToBuffer( StringBuffer buffer );
+    
 
     /**
      * Every directory user (with possible requirements for
@@ -78,6 +88,12 @@
         {
             return "allUsers";
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "allUsers" );
+        }
     }
 
     /**
@@ -99,6 +115,12 @@
         {
             return "thisEntry";
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "thisEntry" );
+        }
     }
 
     /**
@@ -164,6 +186,29 @@
         {
             return names.toString();
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( '{' );
+            buffer.append( ' ' );
+            
+            for ( Iterator it = names.iterator(); it.hasNext(); )
+            {
+                javax.naming.Name name = ( javax.naming.Name ) it.next();
+                buffer.append( '"' );
+                buffer.append( name.toString() );
+                buffer.append( '"' );
+                
+                if(it.hasNext()) {
+                    buffer.append( ',' );
+                    buffer.append( ' ' );
+                }
+            }
+            
+            buffer.append( ' ' );
+            buffer.append( '}' );
+        }
     }
 
     /**
@@ -190,6 +235,14 @@
         {
             return "name: " + super.toString();
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "name" );
+            buffer.append( ' ' );
+            super.printToBuffer( buffer );
+        }
     }
 
     /**
@@ -219,6 +272,14 @@
         {
             return "userGroup: " + super.toString();
         }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "userGroup" );
+            buffer.append( ' ' );
+            super.printToBuffer( buffer );
+        }
     }
 
     /**
@@ -281,6 +342,29 @@
         public String toString()
         {
             return "subtree: " + subtreeSpecifications;
+        }
+        
+        
+        public void printToBuffer( StringBuffer buffer )
+        {
+            buffer.append( "subtree" );
+            buffer.append( ' ' );
+            buffer.append( '{' );
+            buffer.append( ' ' );
+            
+            for ( Iterator it = subtreeSpecifications.iterator(); it.hasNext(); )
+            {
+                SubtreeSpecification ss = ( SubtreeSpecification ) it.next();
+                ss.printToBuffer( buffer );
+                
+                if(it.hasNext()) {
+                    buffer.append( ',' );
+                    buffer.append( ' ' );
+                }
+            }
+            
+            buffer.append( ' ' );
+            buffer.append( '}' );
         }
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java
Tue Dec 26 16:50:50 2006
@@ -135,4 +135,95 @@
         }
         return tuples;
     }
+    
+    
+    /**
+     * Converts this item into its string representation as stored
+     * in directory.
+     *
+     * @param buffer the string buffer
+     */
+    public void printToBuffer( StringBuffer buffer )
+    {
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        
+        // identificationTag
+        buffer.append( "identificationTag" );
+        buffer.append( ' ' );
+        buffer.append( '"' );
+        buffer.append( getIdentificationTag() );
+        buffer.append( '"' );
+        buffer.append( ',' );
+        buffer.append( ' ' );
+        
+        // precedence
+        buffer.append( "precedence" );
+        buffer.append( ' ' );
+        buffer.append( getPrecedence() );
+        buffer.append( ',' );
+        buffer.append( ' ' );
+        
+        // authenticationLevel
+        buffer.append( "authenticationLevel" );
+        buffer.append( ' ' );
+        buffer.append( getAuthenticationLevel().getName() );
+        buffer.append( ',' );
+        buffer.append( ' ' );
+        
+        // itemOrUserFirst
+        buffer.append( "itemOrUserFirst" );
+        buffer.append( ' ' );
+        buffer.append( "userFirst" );
+        buffer.append( ':' );
+        buffer.append( ' ' );
+        
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        
+        // protectedItems
+        buffer.append( "userClasses" );
+        buffer.append( ' ' );
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        for ( Iterator it = userClasses.iterator(); it.hasNext(); )
+        {
+            UserClass userClass =  ( UserClass ) it.next();
+            userClass.printToBuffer( buffer );
+            
+            if(it.hasNext()) {
+                buffer.append( ',' );
+                buffer.append( ' ' );
+            }
+        }
+        buffer.append( ' ' );
+        buffer.append( '}' );
+        
+        buffer.append( ',' );
+        buffer.append( ' ' );
+        
+        // itemPermissions
+        buffer.append( "userPermissions" );
+        buffer.append( ' ' );
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        for ( Iterator it = userPermissions.iterator(); it.hasNext(); )
+        {
+            UserPermission permission = ( UserPermission ) it.next();
+            permission.printToBuffer( buffer );
+            
+            if(it.hasNext()) {
+                buffer.append( ',' );
+                buffer.append( ' ' );
+            }
+        }
+        buffer.append( ' ' );
+        buffer.append( '}' );
+        
+        buffer.append( ' ' );
+        buffer.append( '}' );
+        
+        buffer.append( ' ' );
+        buffer.append( '}' );
+    }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java
Tue Dec 26 16:50:50 2006
@@ -81,4 +81,66 @@
         return "itemPermission: precedence=" + getPrecedence() + ", " + "protectedItems="
+ protectedItems + ", "
             + "grantsAndDenials=" + getGrantsAndDenials();
     }
+    
+    
+    /**
+     * Converts this item into its string representation as stored
+     * in directory.
+     *
+     * @param buffer the string buffer
+     */
+    public void printToBuffer( StringBuffer buffer )
+    {
+        buffer.append( '{' );
+        buffer.append( ' ' );
+
+        if ( getPrecedence() >= 0 && getPrecedence() <= 255 )
+        {
+            buffer.append( "precedence" );
+            buffer.append( ' ' );
+            buffer.append( getPrecedence() );
+            buffer.append( ',' );
+            buffer.append( ' ' );
+        }
+        
+        buffer.append( "protectedItems" );
+        buffer.append( ' ' );
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        for ( Iterator it = protectedItems.iterator(); it.hasNext(); )
+        {
+            ProtectedItem item = ( ProtectedItem ) it.next();
+            item.printToBuffer( buffer );
+            
+            if(it.hasNext()) {
+                buffer.append( ',' );
+                buffer.append( ' ' );
+            }
+        }
+        buffer.append( ' ' );
+        buffer.append( '}' );
+        
+        buffer.append( ',' );
+        buffer.append( ' ' );
+        
+        buffer.append( "grantsAndDenials" );
+        buffer.append( ' ' );
+        buffer.append( '{' );
+        buffer.append( ' ' );
+        for ( Iterator it = getGrantsAndDenials().iterator(); it.hasNext(); )
+        {
+            GrantAndDenial grantAndDenial = ( GrantAndDenial ) it.next();
+            grantAndDenial.printToBuffer( buffer );
+            
+            if(it.hasNext()) {
+                buffer.append( ',' );
+                buffer.append( ' ' );
+            }
+        }
+        buffer.append( ' ' );
+        buffer.append( '}' );
+        
+        buffer.append( ' ' );
+        buffer.append( '}' );
+    }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AssertionNode.java
Tue Dec 26 16:50:50 2006
@@ -122,6 +122,15 @@
         return a_buf.append( m_desc ).append( MAX_STR );
     }
 
+    
+    /**
+     * @see ExprNode#printRefinementToBuffer(StringBuffer)
+     */
+    public StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException
+    {
+        throw new UnsupportedOperationException( "AssertionNode can't be part of a refinement"
);
+    }
+
 
     /**
      * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
Tue Dec 26 16:50:50 2006
@@ -22,9 +22,12 @@
 
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.math.BigInteger;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * Node representing branches within the expression tree corresponding to
@@ -277,6 +280,48 @@
         return buf;
     }
 
+    
+    /**
+     * @see ExprNode#printRefinementToBuffer(StringBuffer)
+     */
+    public StringBuffer printRefinementToBuffer( StringBuffer buf ) throws UnsupportedOperationException
+    {
+        
+        
+        switch ( operator )
+        {
+            case AND :
+                buf.append( "and" );
+                break;
+            case OR :
+                buf.append( "or" );
+                break;
+            case NOT :
+                buf.append( "not" );
+                break;
+        }
+        
+        
+        buf.append( ':' );
+        buf.append( ' ' );
+        buf.append( '{' );
+        
+        for ( Iterator<ExprNode> it = children.iterator(); it.hasNext(); )
+        {
+            ExprNode node = it.next();
+            node.printRefinementToBuffer( buf );
+            
+            if(it.hasNext())
+            {
+                buf.append( ',' );
+                buf.append( ' ' );
+            }
+        }
+        
+        buf.append( '}' );
+        
+        return buf;
+    }
 
     /**
      * Gets a human readable representation for the operators: AND for '&', OR

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExprNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExprNode.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExprNode.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExprNode.java
Tue Dec 26 16:50:50 2006
@@ -70,6 +70,18 @@
 
 
     /**
+     * Recursively appends the refinement string representation of this node and its
+     * descendents in prefix notation to a buffer.
+     * 
+     * @param a_buf
+     *            the buffer to append to.
+     * @throws UnsupportedOperationException
+     *            if this node isn't a part of a refinement.
+     */
+    StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException;
+    
+    
+    /**
      * Element/node accept method for visitor pattern.
      * 
      * @param a_visitor

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExtensibleNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExtensibleNode.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExtensibleNode.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ExtensibleNode.java
Tue Dec 26 16:50:50 2006
@@ -145,6 +145,15 @@
         return buf;
     }
 
+    
+    /**
+     * @see ExprNode#printRefinementToBuffer(StringBuffer)
+     */
+    public StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException
+    {
+        throw new UnsupportedOperationException( "ExtensibleNode can't be part of a refinement"
);
+    }
+
 
     /**
      * @see java.lang.Object#toString()

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/PresenceNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/PresenceNode.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/PresenceNode.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/PresenceNode.java
Tue Dec 26 16:50:50 2006
@@ -76,6 +76,15 @@
         return ( buf.toString() );
     }
 
+    
+    /**
+     * @see ExprNode#printRefinementToBuffer(StringBuffer)
+     */
+    public StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException
+    {
+        throw new UnsupportedOperationException( "PresenceNode can't be part of a refinement"
);
+    }
+
 
     /**
      * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/ScopeNode.java
Tue Dec 26 16:50:50 2006
@@ -167,6 +167,15 @@
 
         return buf;
     }
+    
+    
+    /**
+     * @see ExprNode#printRefinementToBuffer(StringBuffer)
+     */
+    public StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException
+    {
+        throw new UnsupportedOperationException( "ScopeNode can't be part of a refinement"
);
+    }
 
 
     /**

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SimpleNode.java
Tue Dec 26 16:50:50 2006
@@ -184,6 +184,44 @@
         return buf;
     }
 
+    
+    /**
+     * @see ExprNode#printRefinementToBuffer(StringBuffer)
+     */
+    public StringBuffer printRefinementToBuffer( StringBuffer buf ) throws UnsupportedOperationException
+    {
+
+        switch ( getAssertionType() )
+        {
+            case EQUALITY:
+                break;
+
+            case APPROXIMATE:
+                throw new UnsupportedOperationException( "Approximate assertion isn't valid
for a refinement" );
+
+            case GREATEREQ:
+                throw new UnsupportedOperationException( "GreaterOrEqual assertion isn't
valid for a refinement" );
+
+            case LESSEQ:
+                throw new UnsupportedOperationException( "LessOrEqual assertion isn't valid
for a refinement" );
+
+            default:
+                throw new UnsupportedOperationException( "Undefined assertion for a refinement"
);
+        }
+
+        if ( getAttribute() == null || !"objectClass".equalsIgnoreCase( getAttribute() )
)
+        {
+            throw new UnsupportedOperationException( "Invalid attribute " + getAttribute()
+ " for a refinement" );
+        }
+
+        buf.append( "item" );
+        buf.append( ':' );
+        buf.append( ' ' );
+        buf.append( getValue() );
+
+        return buf;
+    }
+
 
     /**
      * @see java.lang.Object#toString()

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SubstringNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SubstringNode.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SubstringNode.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/SubstringNode.java
Tue Dec 26 16:50:50 2006
@@ -246,6 +246,15 @@
         return buf;
     }
 
+    
+    /**
+     * @see ExprNode#printRefinementToBuffer(StringBuffer)
+     */
+    public StringBuffer printRefinementToBuffer( StringBuffer a_buf ) throws UnsupportedOperationException
+    {
+        throw new UnsupportedOperationException( "SubstringNode can't be part of a refinement"
);
+    }
+
 
     /**
      * @see org.apache.directory.shared.ldap.filter.ExprNode#accept(

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/BaseSubtreeSpecification.java
Tue Dec 26 16:50:50 2006
@@ -23,6 +23,7 @@
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
+import java.util.Iterator;
 import java.util.Set;
 import java.util.Collections;
 
@@ -237,4 +238,108 @@
     {
         return this.refinement;
     }
+
+    
+    /**
+     * Converts this item into its string representation as stored
+     * in directory.
+     *
+     * @param buffer the string buffer
+     */
+    public void printToBuffer( StringBuffer buffer )
+    {
+        buffer.append( '{' );
+        
+        if(!base.isEmpty()) {
+            buffer.append( ' ' );
+            buffer.append( "base" );
+            buffer.append( ' ' );
+            buffer.append( '"' );
+            buffer.append( base.getUpName() );
+            buffer.append( '"' );
+            buffer.append( ',' );
+        }
+        
+        if(minBaseDistance > 0) {
+            buffer.append( ' ' );
+            buffer.append( "minimum" );
+            buffer.append( ' ' );
+            buffer.append( minBaseDistance );
+            buffer.append( ',' );
+        }
+        
+        if(maxBaseDistance > UNBOUNDED_MAX) {
+            buffer.append( ' ' );
+            buffer.append( "maximum" );
+            buffer.append( ' ' );
+            buffer.append( maxBaseDistance );
+            buffer.append( ',' );
+        }
+        
+        if(!chopBefore.isEmpty() || !chopAfter.isEmpty()) {
+            buffer.append( ' ' );
+            buffer.append( "specificExclusions" );
+            buffer.append( ' ' );
+            buffer.append( '{' );
+
+            for ( Iterator it = chopBefore.iterator(); it.hasNext(); )
+            {
+                LdapDN dn = ( LdapDN ) it.next();
+                buffer.append( ' ' );
+                buffer.append( "chopBefore" );
+                buffer.append( ':' );
+                buffer.append( ' ' );
+                buffer.append( '"' );
+                buffer.append( dn.getUpName() );
+                buffer.append( '"' );
+                
+                if(it.hasNext())
+                {
+                    buffer.append( ',' );
+                    buffer.append( ' ' );
+                }
+            }
+            
+            for ( Iterator it = chopAfter.iterator(); it.hasNext(); )
+            {
+                LdapDN dn = ( LdapDN ) it.next();
+                buffer.append( ' ' );
+                buffer.append( "chopAfter" );
+                buffer.append( ':' );
+                buffer.append( ' ' );
+                buffer.append( '"' );
+                buffer.append( dn.getUpName() );
+                buffer.append( '"' );
+                
+                if(it.hasNext())
+                {
+                    buffer.append( ',' );
+                    buffer.append( ' ' );
+                }
+            }
+            
+            buffer.append( ' ' );
+            buffer.append( '}' );
+            
+            buffer.append( ',' );
+        }
+        
+        if(refinement != null) 
+        {
+            buffer.append( ' ' );
+            buffer.append( "specificationFilter" );
+            buffer.append( ' ' );
+            refinement.printRefinementToBuffer( buffer );
+            buffer.append( ',' );
+        }
+        
+        if(buffer.charAt( buffer.length()-1 ) == ',') {
+            buffer.deleteCharAt( buffer.length()-1 );
+        }
+        
+        buffer.append( ' ' );
+        buffer.append( '}' );
+    }
+
+    
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java?view=diff&rev=490418&r1=490417&r2=490418
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/subtree/SubtreeSpecification.java
Tue Dec 26 16:50:50 2006
@@ -117,4 +117,14 @@
      *         specification
      */
     ExprNode getRefinement();
+    
+    
+    /**
+     * Converts this item into its string representation as stored
+     * in directory.
+     *
+     * @param buffer the string buffer
+     */
+    void printToBuffer( StringBuffer buffer );
+    
 }



Mime
View raw message