directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r572194 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/aci/ main/java/org/apache/directory/shared/ldap/codec/actions/ main/java/org/apache/directory/shared/ldap/message/ main/java/org/apache/directory/shar...
Date Sun, 02 Sep 2007 23:58:20 GMT
Author: elecharny
Date: Sun Sep  2 16:58:18 2007
New Revision: 572194

URL: http://svn.apache.org/viewvc?rev=572194&view=rev
Log:
Removed useless imports
Fixed some warning by using generic
Cleaing some code (minor refactoring)

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/Permission.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NormalizingComparator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AbstractSimpleComponentsMonitor.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeSerializerUtils.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
Sun Sep  2 16:58:18 2007
@@ -23,7 +23,6 @@
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 
@@ -123,13 +122,15 @@
      * Converts a set of {@link GrantAndDenial}s into a set of
      * {@link MicroOperation}s and returns it.
      */
-    protected static Set toMicroOperations( Set grantsAndDenials )
+    protected static Set<MicroOperation> toMicroOperations( Set<GrantAndDenial>
grantsAndDenials )
     {
         Set<MicroOperation> microOps = new HashSet<MicroOperation>();
-        for ( Iterator j = grantsAndDenials.iterator(); j.hasNext(); )
+        
+        for ( GrantAndDenial grantAndDenial:grantsAndDenials )
         {
-            microOps.add( ( ( GrantAndDenial ) j.next() ).getMicroOperation() );
+            microOps.add( grantAndDenial.getMicroOperation() );
         }
+        
         return microOps;
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemChecker.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemChecker.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemChecker.java
Sun Sep  2 16:58:18 2007
@@ -23,9 +23,6 @@
 
 import java.io.StringReader;
 import java.text.ParseException;
-import java.util.Map;
-
-import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 
 import antlr.RecognitionException;
 import antlr.TokenStreamException;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java
Sun Sep  2 16:58:18 2007
@@ -23,7 +23,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.Set;
 
 
@@ -38,9 +37,9 @@
 {
     private static final long serialVersionUID = -8199453391060356463L;
 
-    private final Collection protectedItems;
+    private final Collection<ProtectedItem> protectedItems;
 
-    private final Collection itemPermissions;
+    private final Collection<ItemPermission> itemPermissions;
 
 
     /**
@@ -58,37 +57,20 @@
      *            the collection of {@link ItemPermission}s each
      *            <tt>protectedItems</tt> will have
      */
-    public ItemFirstACIItem(String identificationTag, int precedence, AuthenticationLevel
authenticationLevel,
-        Collection protectedItems, Collection itemPermissions)
+    public ItemFirstACIItem( String identificationTag, int precedence, AuthenticationLevel
authenticationLevel,
+        Collection<ProtectedItem> protectedItems, Collection<ItemPermission>
itemPermissions )
     {
         super( identificationTag, precedence, authenticationLevel );
 
-        for ( Iterator i = protectedItems.iterator(); i.hasNext(); )
-        {
-            if ( !ProtectedItem.class.isAssignableFrom( i.next().getClass() ) )
-            {
-                throw new IllegalArgumentException( "protectedItems contains an element which
is not a protected item." );
-            }
-        }
-
-        for ( Iterator i = itemPermissions.iterator(); i.hasNext(); )
-        {
-            if ( !ItemPermission.class.isAssignableFrom( i.next().getClass() ) )
-            {
-                throw new IllegalArgumentException(
-                    "itemPermissions contains an element which is not an item permission."
);
-            }
-        }
-
-        this.protectedItems = Collections.unmodifiableCollection( new ArrayList( protectedItems
) );
-        this.itemPermissions = Collections.unmodifiableCollection( new ArrayList( itemPermissions
) );
+        this.protectedItems = Collections.unmodifiableCollection( new ArrayList<ProtectedItem>(
protectedItems ) );
+        this.itemPermissions = Collections.unmodifiableCollection( new ArrayList<ItemPermission>(
itemPermissions ) );
     }
 
 
     /**
      * Returns the collection of {@link ProtectedItem}s.
      */
-    public Collection getProtectedItems()
+    public Collection<ProtectedItem> getProtectedItems()
     {
         return protectedItems;
     }
@@ -97,7 +79,7 @@
     /**
      * Returns the collection of {@link ItemPermission}s.
      */
-    public Collection getItemPermissions()
+    public Collection<ItemPermission> getItemPermissions()
     {
         return itemPermissions;
     }
@@ -111,14 +93,14 @@
     }
 
 
-    public Collection toTuples()
+    public Collection<ACITuple> toTuples()
     {
-        Collection tuples = new ArrayList();
-        for ( Iterator i = itemPermissions.iterator(); i.hasNext(); )
+        Collection<ACITuple> tuples = new ArrayList<ACITuple>();
+        
+        for ( ItemPermission itemPermission:itemPermissions )
         {
-            ItemPermission itemPermission = ( ItemPermission ) i.next();
-            Set grants = itemPermission.getGrants();
-            Set denials = itemPermission.getDenials();
+            Set<GrantAndDenial> grants = itemPermission.getGrants();
+            Set<GrantAndDenial> denials = itemPermission.getDenials();
             int precedence = itemPermission.getPrecedence() >= 0 ? itemPermission.getPrecedence()
: this
                 .getPrecedence();
 
@@ -145,85 +127,59 @@
      */
     public void printToBuffer( StringBuffer buffer )
     {
-        buffer.append( '{' );
-        buffer.append( ' ' );
-        
         // identificationTag
-        buffer.append( "identificationTag" );
-        buffer.append( ' ' );
-        buffer.append( '"' );
+        buffer.append( "{ identificationTag \"" );
         buffer.append( getIdentificationTag() );
-        buffer.append( '"' );
-        buffer.append( ',' );
-        buffer.append( ' ' );
-        
+
         // precedence
-        buffer.append( "precedence" );
-        buffer.append( ' ' );
+        buffer.append( "\", precedence " );
         buffer.append( getPrecedence() );
-        buffer.append( ',' );
-        buffer.append( ' ' );
         
         // authenticationLevel
-        buffer.append( "authenticationLevel" );
-        buffer.append( ' ' );
+        buffer.append( ", authenticationLevel " );
         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( ' ' );
+        buffer.append( ", itemOrUserFirst itemFirst: { " );
         
         // protectedItems
-        buffer.append( "protectedItems" );
-        buffer.append( ' ' );
-        buffer.append( '{' );
-        buffer.append( ' ' );
-        for ( Iterator it = protectedItems.iterator(); it.hasNext(); )
+        buffer.append( "protectedItems { " );
+        
+        boolean isFirst = true;
+
+        for ( ProtectedItem item:protectedItems )
         {
-            ProtectedItem item =  ( ProtectedItem ) it.next();
             item.printToBuffer( buffer );
             
-            if(it.hasNext()) {
-                buffer.append( ',' );
-                buffer.append( ' ' );
+            if ( isFirst )
+            {
+                isFirst = false;
+            }
+            else
+            {
+                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(); )
+        buffer.append( " }, itemPermissions { " );
+
+        isFirst = true;
+        
+        for ( ItemPermission permission:itemPermissions )
         {
-            ItemPermission permission = ( ItemPermission ) it.next();
             permission.printToBuffer( buffer );
             
-            if(it.hasNext()) {
-                buffer.append( ',' );
-                buffer.append( ' ' );
+            if ( isFirst )
+            {
+                isFirst = false;
+            }
+            else
+            {
+                buffer.append( ", " );
             }
         }
-        buffer.append( ' ' );
-        buffer.append( '}' );
-        
-        buffer.append( ' ' );
-        buffer.append( '}' );
-        
-        buffer.append( ' ' );
-        buffer.append( '}' );
+
+        buffer.append( " } } }" );
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
Sun Sep  2 16:58:18 2007
@@ -23,7 +23,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 
 
 /**
@@ -37,7 +36,7 @@
 {
     private static final long serialVersionUID = 3940100745409337694L;
 
-    private final Collection userClasses;
+    private final Collection<UserClass> userClasses;
 
 
     /**
@@ -51,27 +50,18 @@
      * @param userClasses
      *            the collection of {@link UserClass}es
      */
-    public ItemPermission(int precedence, Collection grantsAndDenials, Collection userClasses)
+    public ItemPermission( int precedence, Collection<GrantAndDenial> grantsAndDenials,
Collection<UserClass> userClasses )
     {
         super( precedence, grantsAndDenials );
 
-        for ( Iterator i = userClasses.iterator(); i.hasNext(); )
-        {
-            Object val = i.next();
-            if ( !( val instanceof UserClass ) )
-            {
-                throw new IllegalArgumentException( "userClasses contains a wrong element."
);
-            }
-        }
-
-        this.userClasses = Collections.unmodifiableCollection( new ArrayList( userClasses
) );
+        this.userClasses = Collections.unmodifiableCollection( new ArrayList<UserClass>(
userClasses ) );
     }
 
 
     /**
      * Returns the collection of {@link UserClass}es.
      */
-    public Collection getUserClasses()
+    public Collection<UserClass> getUserClasses()
     {
         return userClasses;
     }
@@ -91,56 +81,51 @@
      */
     public void printToBuffer( StringBuffer buffer )
     {
-        buffer.append( '{' );
-        buffer.append( ' ' );
+        buffer.append( "{ " );
 
         if ( getPrecedence() >= 0 && getPrecedence() <= 255 )
         {
-            buffer.append( "precedence" );
-            buffer.append( ' ' );
+            buffer.append( "precedence " );
             buffer.append( getPrecedence() );
-            buffer.append( ',' );
-            buffer.append( ' ' );
+            buffer.append( ", " );
         }
         
-        buffer.append( "userClasses" );
-        buffer.append( ' ' );
-        buffer.append( '{' );
-        buffer.append( ' ' );
-        for ( Iterator it = userClasses.iterator(); it.hasNext(); )
+        buffer.append( "userClasses { " );
+        
+        boolean isFirst = true;
+        
+        for ( UserClass userClass:userClasses )
         {
-            UserClass userClass = ( UserClass ) it.next();
             userClass.printToBuffer( buffer );
             
-            if(it.hasNext()) {
-                buffer.append( ',' );
-                buffer.append( ' ' );
+            if ( isFirst ) 
+            {
+                isFirst = false;
+            }
+            else
+            {
+                buffer.append( ", " );
             }
         }
-        buffer.append( ' ' );
-        buffer.append( '}' );
         
-        buffer.append( ',' );
-        buffer.append( ' ' );
+        buffer.append( " }, grantsAndDenials { " );
+        
+        isFirst = true;
         
-        buffer.append( "grantsAndDenials" );
-        buffer.append( ' ' );
-        buffer.append( '{' );
-        buffer.append( ' ' );
-        for ( Iterator it = getGrantsAndDenials().iterator(); it.hasNext(); )
+        for ( GrantAndDenial grantAndDenial:getGrantsAndDenials() )
         {
-            GrantAndDenial grantAndDenial = ( GrantAndDenial ) it.next();
             grantAndDenial.printToBuffer( buffer );
             
-            if(it.hasNext()) {
-                buffer.append( ',' );
-                buffer.append( ' ' );
+            if ( isFirst )
+            {
+                isFirst = false;
+            }
+            else
+            {
+                buffer.append( ", " );
             }
         }
-        buffer.append( ' ' );
-        buffer.append( '}' );
         
-        buffer.append( ' ' );
-        buffer.append( '}' );
+        buffer.append( " } }" );
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/Permission.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/Permission.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/Permission.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/Permission.java
Sun Sep  2 16:58:18 2007
@@ -24,7 +24,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 
@@ -38,11 +37,11 @@
 {
     private final int precedence;
 
-    private final Set grantsAndDenials;
+    private final Set<GrantAndDenial> grantsAndDenials;
 
-    private final Set grants;
+    private final Set<GrantAndDenial> grants;
 
-    private final Set denials;
+    private final Set<GrantAndDenial> denials;
 
 
     /**
@@ -54,7 +53,7 @@
      * @param grantsAndDenials
      *            the set of {@link GrantAndDenial}s
      */
-    protected Permission(int precedence, Collection grantsAndDenials)
+    protected Permission(int precedence, Collection<GrantAndDenial> grantsAndDenials)
     {
         if ( precedence < 0 || precedence > 255 )
         {
@@ -63,18 +62,12 @@
 
         this.precedence = precedence;
 
-        Set tmpGrantsAndDenials = new HashSet();
-        Set tmpGrants = new HashSet();
-        Set tmpDenials = new HashSet();
-        for ( Iterator i = grantsAndDenials.iterator(); i.hasNext(); )
+        Set<GrantAndDenial> tmpGrantsAndDenials = new HashSet<GrantAndDenial>();
+        Set<GrantAndDenial> tmpGrants = new HashSet<GrantAndDenial>();
+        Set<GrantAndDenial> tmpDenials = new HashSet<GrantAndDenial>();
+        
+        for ( GrantAndDenial gad:grantsAndDenials )
         {
-            Object val = i.next();
-            if ( !( val instanceof GrantAndDenial ) )
-            {
-                throw new IllegalArgumentException( "grantsAndDenials contains a wrong element."
);
-            }
-
-            GrantAndDenial gad = ( GrantAndDenial ) val;
             if ( gad.isGrant() )
             {
                 tmpGrants.add( gad );
@@ -83,6 +76,7 @@
             {
                 tmpDenials.add( gad );
             }
+
             tmpGrantsAndDenials.add( gad );
         }
 
@@ -104,7 +98,7 @@
     /**
      * Returns the set of {@link GrantAndDenial}s.
      */
-    public Set getGrantsAndDenials()
+    public Set<GrantAndDenial> getGrantsAndDenials()
     {
         return grantsAndDenials;
     }
@@ -113,7 +107,7 @@
     /**
      * Returns the set of grants only.
      */
-    public Set getGrants()
+    public Set<GrantAndDenial> getGrants()
     {
         return grants;
     }
@@ -122,7 +116,7 @@
     /**
      * Returns the set of denials only.
      */
-    public Set getDenials()
+    public Set<GrantAndDenial> getDenials()
     {
         return denials;
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java
Sun Sep  2 16:58:18 2007
@@ -38,9 +38,9 @@
 {
     private static final long serialVersionUID = 5587483838404246148L;
 
-    private final Collection userClasses;
+    private final Collection<UserClass> userClasses;
 
-    private final Collection userPermissions;
+    private final Collection<UserPermission> userPermissions;
 
 
     /**
@@ -59,36 +59,19 @@
      *            <tt>protectedItems</tt> will have
      */
     public UserFirstACIItem(String identificationTag, int precedence, AuthenticationLevel
authenticationLevel,
-        Collection userClasses, Collection userPermissions)
+        Collection<UserClass> userClasses, Collection<UserPermission> userPermissions)
     {
         super( identificationTag, precedence, authenticationLevel );
 
-        for ( Iterator i = userClasses.iterator(); i.hasNext(); )
-        {
-            if ( !UserClass.class.isAssignableFrom( i.next().getClass() ) )
-            {
-                throw new IllegalArgumentException( "userClasses contains an element which
is not a user class." );
-            }
-        }
-
-        for ( Iterator i = userPermissions.iterator(); i.hasNext(); )
-        {
-            if ( !UserPermission.class.isAssignableFrom( i.next().getClass() ) )
-            {
-                throw new IllegalArgumentException(
-                    "userPermissions contains an element which is not a user permission."
);
-            }
-        }
-
-        this.userClasses = Collections.unmodifiableCollection( new ArrayList( userClasses
) );
-        this.userPermissions = Collections.unmodifiableCollection( new ArrayList( userPermissions
) );
+        this.userClasses = Collections.unmodifiableCollection( new ArrayList<UserClass>(
userClasses ) );
+        this.userPermissions = Collections.unmodifiableCollection( new ArrayList<UserPermission>(
userPermissions ) );
     }
 
 
     /**
      * Returns the set of {@link UserClass}es.
      */
-    public Collection getUserClasses()
+    public Collection<UserClass> getUserClasses()
     {
         return userClasses;
     }
@@ -97,7 +80,7 @@
     /**
      * Returns the set of {@link UserPermission}s.
      */
-    public Collection getUserPermission()
+    public Collection<UserPermission> getUserPermission()
     {
         return userPermissions;
     }
@@ -111,14 +94,14 @@
     }
 
 
-    public Collection toTuples()
+    public Collection<ACITuple> toTuples()
     {
-        Collection tuples = new ArrayList();
-        for ( Iterator i = userPermissions.iterator(); i.hasNext(); )
+        Collection<ACITuple> tuples = new ArrayList<ACITuple>();
+
+        for ( UserPermission userPermission:userPermissions )
         {
-            UserPermission userPermission = ( UserPermission ) i.next();
-            Set grants = userPermission.getGrants();
-            Set denials = userPermission.getDenials();
+            Set<GrantAndDenial> grants = userPermission.getGrants();
+            Set<GrantAndDenial> denials = userPermission.getDenials();
             int precedence = userPermission.getPrecedence() >= 0 ? userPermission.getPrecedence()
: this
                 .getPrecedence();
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java
Sun Sep  2 16:58:18 2007
@@ -36,7 +36,7 @@
 {
     private static final long serialVersionUID = 3940100745409337694L;
 
-    private final Collection protectedItems;
+    private final Collection<ProtectedItem> protectedItems;
 
 
     /**
@@ -50,19 +50,10 @@
      * @param protectedItems
      *            the collection of {@link ProtectedItem}s
      */
-    public UserPermission(int precedence, Collection grantsAndDenials, Collection protectedItems)
+    public UserPermission( int precedence, Collection<GrantAndDenial> grantsAndDenials,
Collection<ProtectedItem> protectedItems )
     {
         super( precedence, grantsAndDenials );
 
-        for ( Iterator i = protectedItems.iterator(); i.hasNext(); )
-        {
-            Object val = i.next();
-            if ( !( val instanceof ProtectedItem ) )
-            {
-                throw new IllegalArgumentException( "protectedItems contains a wrong element."
);
-            }
-        }
-
         this.protectedItems = Collections.unmodifiableCollection( protectedItems );
     }
 
@@ -70,7 +61,7 @@
     /**
      * Returns the collection of {@link ProtectedItem}s.
      */
-    public Collection getProtectedItems()
+    public Collection<ProtectedItem> getProtectedItems()
     {
         return protectedItems;
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
Sun Sep  2 16:58:18 2007
@@ -20,8 +20,6 @@
 package org.apache.directory.shared.ldap.codec.actions;
 
 
-import javax.naming.directory.Attributes;
-
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/EntryChangeControl.java
Sun Sep  2 16:58:18 2007
@@ -21,7 +21,6 @@
 
 
 import org.apache.directory.shared.asn1.codec.EncoderException;
-import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
 import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.slf4j.Logger;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
Sun Sep  2 16:58:18 2007
@@ -22,7 +22,6 @@
 
 import java.io.InputStream;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Set;
@@ -54,9 +53,11 @@
     private static final Logger log = LoggerFactory.getLogger( MessageDecoder.class );
 
     private static final String BINARY_KEY = JndiPropertyConstants.JNDI_LDAP_ATTRIBUTES_BINARY;
+    
+    private final static Set<String> EMPTY_SET_STRING = new HashSet<String>();
 
     /** Environment parameters stored here */
-    private final Hashtable env;
+    private final Hashtable<String, Object> env;
 
     /** the ASN.1 provider */
     private final Provider provider;
@@ -80,9 +81,9 @@
      * @throws MessageException
      *             if there is a problem creating this decoder.
      */
-    public MessageDecoder(final Hashtable env) throws MessageException
+    public MessageDecoder(final Hashtable<String, Object> env) throws MessageException
     {
-        this.env = ( Hashtable ) env.clone();
+        this.env = ( Hashtable<String, Object> ) env.clone();
         
         // We need to get the encoder class name
         Hashtable providerEnv = Provider.getEnvironment();
@@ -103,7 +104,7 @@
                     log.warn( "Null value for " + BINARY_KEY + " key in environment.  Using
empty set for binaries." );
                 }
                 
-                binaries = Collections.EMPTY_SET;
+                binaries = EMPTY_SET_STRING;
             }
             else if ( val instanceof String )
             {
@@ -125,7 +126,7 @@
             else if ( val instanceof Collection )
             {
                 binaries = new HashSet<String>();
-                binaries.addAll( ( Set ) val );
+                binaries.addAll( ( Set<String> ) val );
             } // complain if it's something else
             else
             {
@@ -134,7 +135,8 @@
                     log.warn( "Unrecognized value for " + BINARY_KEY
                         + " key in environment.  Using empty set for binaries." );
                 }
-                binaries = Collections.EMPTY_SET;
+                
+                binaries = EMPTY_SET_STRING;
             }
         }
         else
@@ -143,7 +145,7 @@
             {
                 log.warn( "Could not find " + BINARY_KEY + " key in environment.  Using empty
set for binaries." );
             }
-            binaries = Collections.EMPTY_SET;
+            binaries = EMPTY_SET_STRING;
         }
 
         this.decoder = this.provider.getDecoder( binaries );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequest.java
Sun Sep  2 16:58:18 2007
@@ -25,6 +25,7 @@
 import javax.naming.directory.ModificationItem;
 
 
+
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -142,7 +143,7 @@
      * @param mod
      *            a ModificationItem to add.
      */
-    void addModification( ModificationItemImpl mod );
+    void addModification( ModificationItem mod );
 
 
     /**
@@ -152,5 +153,5 @@
      * @param mod
      *            a ModificationItem to remove.
      */
-    void removeModification( ModificationItemImpl mod );
+    void removeModification( ModificationItem mod );
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
Sun Sep  2 16:58:18 2007
@@ -25,12 +25,14 @@
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -55,7 +57,7 @@
     private LdapDN name;
 
     /** Sequence of modifications or PDU's <b>modification</b> seqence field
*/
-    private ArrayList mods = new ArrayList();
+    private List<ModificationItem> mods = new ArrayList<ModificationItem>();
 
     private ModifyResponse response;
 
@@ -88,7 +90,7 @@
      * @return an immutatble Collection of ModificationItem instances.
      * @see <{javax.naming.directory.ModificationItem}>
      */
-    public Collection getModificationItems()
+    public Collection<ModificationItem> getModificationItems()
     {
         return Collections.unmodifiableCollection( mods );
     }
@@ -126,7 +128,7 @@
      * @param mod
      *            a ModificationItem to add.
      */
-    public void addModification( ModificationItemImpl mod )
+    public void addModification( ModificationItem mod )
     {
         mods.add( mod );
     }
@@ -139,7 +141,7 @@
      * @param mod
      *            a ModificationItem to remove.
      */
-    public void removeModification( ModificationItemImpl mod )
+    public void removeModification( ModificationItem mod )
     {
         mods.remove( mod );
     }
@@ -222,7 +224,7 @@
             return false;
         }
 
-        Iterator list = req.getModificationItems().iterator();
+        Iterator<ModificationItem> list = req.getModificationItems().iterator();
 
         for ( int ii = 0; ii < mods.size(); ii++ )
         {
@@ -271,7 +273,7 @@
             Attribute attr0 = item0.getAttribute();
             Attribute attr1 = item1.getAttribute();
 
-            Set attrHash0 = new HashSet();
+            Set<Object> attrHash0 = new HashSet<Object>();
 
             NamingEnumeration iter0 = attr0.getAll();
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NormalizingComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NormalizingComparator.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NormalizingComparator.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/NormalizingComparator.java
Sun Sep  2 16:58:18 2007
@@ -42,7 +42,7 @@
     private Normalizer normalizer;
 
     /** the underlying comparator to use for comparisons */
-    private Comparator comparator;
+    private Comparator<Object> comparator;
 
 
     /**
@@ -51,7 +51,7 @@
      * @param normalizer the Normalizer to normalize values with before comparing
      * @param comparator the underlying comparator to use for comparisons
      */
-    public NormalizingComparator( Normalizer normalizer, Comparator comparator )
+    public NormalizingComparator( Normalizer normalizer, Comparator<Object> comparator
)
     {
         this.normalizer = normalizer;
         this.comparator = comparator;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AbstractSimpleComponentsMonitor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AbstractSimpleComponentsMonitor.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AbstractSimpleComponentsMonitor.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AbstractSimpleComponentsMonitor.java
Sun Sep  2 16:58:18 2007
@@ -29,13 +29,13 @@
 
 public abstract class AbstractSimpleComponentsMonitor implements ComponentsMonitor
 {
-    private List components;
+    private List<String> components;
 
 
     public AbstractSimpleComponentsMonitor(String[] components)
     {
         // register components
-        this.components = new LinkedList( Arrays.asList( components ) );
+        this.components = new LinkedList<String>( Arrays.asList( components ) );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeSerializerUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeSerializerUtils.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeSerializerUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeSerializerUtils.java
Sun Sep  2 16:58:18 2007
@@ -22,8 +22,6 @@
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java?rev=572194&r1=572193&r2=572194&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java
Sun Sep  2 16:58:18 2007
@@ -24,6 +24,7 @@
 
 import javax.naming.InvalidNameException;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
 import javax.naming.ldap.Control;
 
 import org.apache.directory.shared.ldap.message.AbandonListener;
@@ -250,9 +251,9 @@
     {
         ModifyRequest req0 = new ModifyRequest()
         {
-            public Collection getModificationItems()
+            public Collection<ModificationItem> getModificationItems()
             {
-                List<ModificationItemImpl> list = new ArrayList<ModificationItemImpl>();
+                List<ModificationItem> list = new ArrayList<ModificationItem>();
                 AttributeImpl attr = new AttributeImpl( "attr0" );
                 attr.add( "val0" );
                 attr.add( "val1" );
@@ -275,12 +276,12 @@
             }
 
 
-            public void addModification( ModificationItemImpl a_mod )
+            public void addModification( ModificationItem mod )
             {
             }
 
 
-            public void removeModification( ModificationItemImpl a_mod )
+            public void removeModification( ModificationItem mod )
             {
             }
 



Mime
View raw message