directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r691168 - in /directory: apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ apacheds/trunk/core-integ/src/test/java/org/apache/dire...
Date Tue, 02 Sep 2008 09:06:49 GMT
Author: elecharny
Date: Tue Sep  2 02:06:46 2008
New Revision: 691168

URL: http://svn.apache.org/viewvc?rev=691168&view=rev
Log:
o Completely removed any references to the Attribute(s)Impl classes
o Removed the AttributeImpl and AttributesImpl classes with the associated tests

Modified:
    directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
    directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/EventListenerAdapter.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/NamingEnumerationAdapter.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java
    directory/shared/trunk/ldap/src/main/antlr/ACIItem.g
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModificationItemImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModificationItemImplTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
(original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
Tue Sep  2 02:06:46 2008
@@ -28,6 +28,7 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.InvalidAttributeIdentifierException;
@@ -41,8 +42,6 @@
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -65,14 +64,14 @@
      *
      * @return An instance of a AttributesImpl() object
      */
-    public static Attributes toAttributesImpl( ServerEntry entry )
+    public static Attributes toBasicAttributes( ServerEntry entry )
     {
         if ( entry == null )
         {
             return null;
         }
         
-        Attributes attributes = new AttributesImpl();
+        Attributes attributes = new BasicAttributes( true );
 
         for ( AttributeType attributeType:entry.getAttributeTypes() )
         {
@@ -88,7 +87,7 @@
                 }
             }
             
-            Attribute attribute = new AttributeImpl( attributeType.getName() );
+            Attribute attribute = new BasicAttribute( attributeType.getName() );
             
             for ( Value<?> value: attr )
             {
@@ -180,7 +179,7 @@
     public static ServerEntry toServerEntry( Attributes attributes, LdapDN dn, Registries
registries ) 
             throws InvalidAttributeIdentifierException
     {
-        if ( ( attributes instanceof BasicAttributes ) || ( attributes instanceof AttributesImpl
) )
+        if ( attributes instanceof BasicAttributes )
         {
             try 
             {
@@ -224,7 +223,7 @@
      */
     public static Attribute toAttributeImpl( EntryAttribute attr )
     {
-        Attribute attribute = new AttributeImpl( attr.getUpId() );
+        Attribute attribute = new BasicAttribute( attr.getUpId() );
 
         for ( Value<?> value:attr )
         {
@@ -559,7 +558,7 @@
                 SearchResult searchResult = new SearchResult( 
                         rec.getDn().getUpName(), 
                         rec.getObject(), 
-                        toAttributesImpl( rec.getServerEntry() ), 
+                        toBasicAttributes( rec.getServerEntry() ), 
                         rec.isRelative() );
                 
                 return searchResult;
@@ -587,7 +586,7 @@
                     SearchResult searchResult = new SearchResult( 
                             rec.getDn().getUpName(), 
                             rec.getObject(), 
-                            toAttributesImpl( rec.getServerEntry() ), 
+                            toBasicAttributes( rec.getServerEntry() ), 
                             rec.isRelative() );
                     
                     return searchResult;

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
(original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
Tue Sep  2 02:06:46 2008
@@ -29,6 +29,7 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.NoSuchAttributeException;
 
 import org.apache.directory.server.schema.bootstrap.ApacheSchema;
@@ -52,7 +53,6 @@
 import org.apache.directory.shared.ldap.entry.client.ClientEntry;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -3792,9 +3792,9 @@
       
     
     /**
-     * Test a conversion from a ServerEntry to an AttributesImpl
+     * Test a conversion from a ServerEntry to an BasicAttributes
      */
-    @Test public void testToAttributesImpl() throws InvalidNameException, Exception
+    @Test public void testToBasicAttributes() throws InvalidNameException, Exception
     {
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
@@ -3804,10 +3804,10 @@
         entry.put( "objectClass", OBJECT_CLASS_AT, "top", "person", "inetOrgPerson", "organizationalPerson"
);
         entry.put( "cn", registries.getAttributeTypeRegistry().lookup( "cn" ), "test" );
         
-        Attributes attributes = ServerEntryUtils.toAttributesImpl( entry );
+        Attributes attributes = ServerEntryUtils.toBasicAttributes( entry );
         
         assertNotNull( attributes );
-        assertTrue( attributes instanceof AttributesImpl );
+        assertTrue( attributes instanceof BasicAttributes );
         
         Set<String> expected = new HashSet<String>();
         expected.add( "objectClass" );

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java
Tue Sep  2 02:06:46 2008
@@ -26,7 +26,6 @@
 
 import static org.apache.directory.server.core.integ.IntegrationUtils.*;
 
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ArrayUtils;
@@ -42,6 +41,7 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.DirContext;
 import javax.naming.ldap.LdapContext;
 
@@ -196,7 +196,7 @@
         assertTrue( attrs.get( "roomnumber" ).contains( "4612" ) );
 
         // now modify the password for akarasulu
-        AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "newpwd"
);
+        Attribute userPasswordAttribute = new BasicAttribute( "userPassword", "newpwd" );
         ctx.modifyAttributes( "", new ModificationItemImpl[] {
             new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute
) } );
 
@@ -255,7 +255,7 @@
         assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'secret', encrypted using SHA
-        AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "{SHA}5en6G6MezRroT3XKqkdPOmY/BfQ="
);
+        Attribute userPasswordAttribute = new BasicAttribute( "userPassword", "{SHA}5en6G6MezRroT3XKqkdPOmY/BfQ="
);
         ctx.modifyAttributes( "", new ModificationItemImpl[] {
             new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute
) } );
 
@@ -312,7 +312,7 @@
         assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'secret', encrypted using SHA
-        AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "{SSHA}mjVVxasFkk59wMW4L1Ldt+YCblfhULHs03WW7g=="
);
+        BasicAttribute userPasswordAttribute = new BasicAttribute( "userPassword", "{SSHA}mjVVxasFkk59wMW4L1Ldt+YCblfhULHs03WW7g=="
);
         ctx.modifyAttributes( "", new ModificationItemImpl[] {
             new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute
) } );
 
@@ -368,7 +368,7 @@
         assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'secret', encrypted using MD5
-        AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "{MD5}Xr4ilOzQ4PCOq3aQ0qbuaQ=="
);
+        Attribute userPasswordAttribute = new BasicAttribute( "userPassword", "{MD5}Xr4ilOzQ4PCOq3aQ0qbuaQ=="
);
         ctx.modifyAttributes( "", new ModificationItemImpl[] {
             new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute
) } );
 
@@ -424,7 +424,7 @@
         assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'secret', encrypted using SHA
-        AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "{SMD5}tQ9wo/VBuKsqBtylMMCcORbnYOJFMyDJ"
);
+        Attribute userPasswordAttribute = new BasicAttribute( "userPassword", "{SMD5}tQ9wo/VBuKsqBtylMMCcORbnYOJFMyDJ"
);
         ctx.modifyAttributes( "", new ModificationItemImpl[] {
             new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute
) } );
 
@@ -480,7 +480,7 @@
         assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
 
         // now modify the password for akarasulu : 'secret', encrypted using CRYPT
-        AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "{crypt}qFkH8Z1woBlXw"
);
+        Attribute userPasswordAttribute = new BasicAttribute( "userPassword", "{crypt}qFkH8Z1woBlXw"
);
         ctx.modifyAttributes( "", new ModificationItemImpl[] {
             new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute
) } );
 
@@ -539,7 +539,7 @@
             service.getSession( new LdapDN( userDn ), "secret".getBytes() ), new LdapDN(
userDn ) );
 
         // now modify the password for akarasulu (while we're admin)
-        AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "newpwd"
);
+        Attribute userPasswordAttribute = new BasicAttribute( "userPassword", "newpwd" );
         ctx.modifyAttributes( "", new ModificationItemImpl[] {
             new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute
) } );
         ctx.close();

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/EventListenerAdapter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/EventListenerAdapter.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/EventListenerAdapter.java
(original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/EventListenerAdapter.java
Tue Sep  2 02:06:46 2008
@@ -118,7 +118,7 @@
         try
         {
             Binding binding = new Binding( opContext.getDn().getUpName(), 
-                ServerEntryUtils.toAttributesImpl( opContext.getEntry() ), false );
+                ServerEntryUtils.toBasicAttributes( opContext.getEntry() ), false );
             NamingEvent evt = new NamingEvent( source, NamingEvent.OBJECT_ADDED, 
                 binding, null, opContext );
 
@@ -144,7 +144,7 @@
             if ( listener instanceof NamespaceChangeListener )
             {
                 Binding binding = new Binding( opContext.getDn().getUpName(), 
-                    ServerEntryUtils.toAttributesImpl( opContext.getEntry() ), false );
+                    ServerEntryUtils.toBasicAttributes( opContext.getEntry() ), false );
                 NamingEvent evt = new NamingEvent( source, NamingEvent.OBJECT_REMOVED, null,

                     binding, opContext );
                 ( ( NamespaceChangeListener ) listener ).objectAdded( evt );
@@ -165,9 +165,9 @@
         try
         {
             Binding newBinding = new Binding( opContext.getDn().getUpName(), 
-                ServerEntryUtils.toAttributesImpl( opContext.getEntry() ), false );
+                ServerEntryUtils.toBasicAttributes( opContext.getEntry() ), false );
             Binding oldBinding = new Binding( opContext.getDn().getUpName(), 
-                ServerEntryUtils.toAttributesImpl( opContext.getEntry().getOriginalEntry()
),  false );
+                ServerEntryUtils.toBasicAttributes( opContext.getEntry().getOriginalEntry()
),  false );
             NamingEvent evt = new NamingEvent( source, NamingEvent.OBJECT_CHANGED, 
                 newBinding, oldBinding, opContext );
 
@@ -193,9 +193,9 @@
             if ( listener instanceof NamespaceChangeListener )
             {
                 Binding newBinding = new Binding( opContext.getDn().getUpName(), 
-                    ServerEntryUtils.toAttributesImpl( opContext.getEntry() ), false );
+                    ServerEntryUtils.toBasicAttributes( opContext.getEntry() ), false );
                 Binding oldBinding = new Binding( opContext.getDn().getUpName(), 
-                    ServerEntryUtils.toAttributesImpl( opContext.getEntry().getOriginalEntry()
), false );
+                    ServerEntryUtils.toBasicAttributes( opContext.getEntry().getOriginalEntry()
), false );
                 NamingEvent evt = new NamingEvent( source, NamingEvent.OBJECT_RENAMED, 
                     newBinding, oldBinding, opContext );
                 ( ( NamespaceChangeListener ) listener ).objectRenamed( evt );
@@ -218,9 +218,9 @@
             if ( listener instanceof NamespaceChangeListener )
             {
                 Binding newBinding = new Binding( opContext.getDn().getUpName(), 
-                    ServerEntryUtils.toAttributesImpl( opContext.getEntry() ), false );
+                    ServerEntryUtils.toBasicAttributes( opContext.getEntry() ), false );
                 Binding oldBinding = new Binding( opContext.getDn().getUpName(), 
-                    ServerEntryUtils.toAttributesImpl( opContext.getEntry().getOriginalEntry()
), false );
+                    ServerEntryUtils.toBasicAttributes( opContext.getEntry().getOriginalEntry()
), false );
                 NamingEvent evt = new NamingEvent( source, NamingEvent.OBJECT_RENAMED, 
                     newBinding, oldBinding, opContext );
                 ( ( NamespaceChangeListener ) listener ).objectRenamed( evt );
@@ -243,9 +243,9 @@
             if ( listener instanceof NamespaceChangeListener )
             {
                 Binding newBinding = new Binding( opContext.getDn().getUpName(), 
-                    ServerEntryUtils.toAttributesImpl( opContext.getEntry() ), false );
+                    ServerEntryUtils.toBasicAttributes( opContext.getEntry() ), false );
                 Binding oldBinding = new Binding( opContext.getDn().getUpName(), 
-                    ServerEntryUtils.toAttributesImpl( opContext.getEntry().getOriginalEntry()
), false );
+                    ServerEntryUtils.toBasicAttributes( opContext.getEntry().getOriginalEntry()
), false );
                 NamingEvent evt = new NamingEvent( source, NamingEvent.OBJECT_RENAMED, 
                     newBinding, oldBinding, null );
                 ( ( NamespaceChangeListener ) listener ).objectRenamed( evt );

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/NamingEnumerationAdapter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/NamingEnumerationAdapter.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/NamingEnumerationAdapter.java
(original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/NamingEnumerationAdapter.java
Tue Sep  2 02:06:46 2008
@@ -116,7 +116,8 @@
             JndiUtils.wrap( e );
         }
         
-        SearchResult result = new SearchResult( entry.getDn().getUpName(), null, ServerEntryUtils.toAttributesImpl(
entry ) );
+        SearchResult result = new SearchResult( entry.getDn().getUpName(), null, 
+            ServerEntryUtils.toBasicAttributes( entry ) );
         result.setRelative( false );
         return result;
     }

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
(original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Tue Sep  2 02:06:46 2008
@@ -1015,8 +1015,8 @@
 
         try
         {
-            obj = DirectoryManager.getObjectInstance( null, name, this, env, ServerEntryUtils
-                .toAttributesImpl( serverEntry ) );
+            obj = DirectoryManager.getObjectInstance( null, name, this, env, 
+                ServerEntryUtils.toBasicAttributes( serverEntry ) );
         }
         catch ( Exception e )
         {

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
(original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
Tue Sep  2 02:06:46 2008
@@ -141,7 +141,7 @@
         
         try
         {
-            attrs = ServerEntryUtils.toAttributesImpl( doLookupOperation( buildTarget( name
) ) );
+            attrs = ServerEntryUtils.toBasicAttributes( doLookupOperation( buildTarget( name
) ) );
         }
         catch ( Exception e )
         {
@@ -171,7 +171,7 @@
         Attributes attrs = null;
         try
         {
-            attrs = ServerEntryUtils.toAttributesImpl( doLookupOperation( buildTarget( name
), attrIds ) );
+            attrs = ServerEntryUtils.toBasicAttributes( doLookupOperation( buildTarget( name
), attrIds ) );
         }
         catch ( Exception e )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
Tue Sep  2 02:06:46 2008
@@ -297,7 +297,7 @@
         forward.setNewRdn( renameContext.getNewRdn().getUpName() );
         forward.setDeleteOldRdn( renameContext.getDelOldDn() );
 
-        List<LdifEntry> reverses = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl(
serverEntry ), 
+        List<LdifEntry> reverses = LdifUtils.reverseModifyRdn( ServerEntryUtils.toBasicAttributes(
serverEntry ), 
             null, renameContext.getDn(), new Rdn( renameContext.getNewRdn() ) );
         
         renameContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverses
) );
@@ -329,7 +329,7 @@
         forward.setNewRdn( opCtx.getNewRdn().getUpName() );
         forward.setNewSuperior( opCtx.getParent().getUpName() );
 
-        List<LdifEntry> reverses = LdifUtils.reverseModifyRdn( ServerEntryUtils.toAttributesImpl(
serverEntry ), 
+        List<LdifEntry> reverses = LdifUtils.reverseModifyRdn( ServerEntryUtils.toBasicAttributes(
serverEntry ), 
             opCtx.getParent(), opCtx.getDn(), new Rdn( opCtx.getNewRdn() ) );
         opCtx.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverses ) );
     }

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modify/ModifyReferralIT.java
Tue Sep  2 02:06:46 2008
@@ -22,6 +22,7 @@
 
 import javax.naming.ReferralException;
 import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.ldap.LdapContext;
@@ -35,7 +36,6 @@
 
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.operations.compare.CompareIT;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -175,7 +175,7 @@
         LdapContext ctx = getWiredContextThrowOnRefferal( ldapServer );
         
         // modify failure
-        Attribute attr = new AttributeImpl( "description", "referral to akarasulu" );
+        Attribute attr = new BasicAttribute( "description", "referral to akarasulu" );
         ModificationItem mod = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
         
         try

Modified: directory/shared/trunk/ldap/src/main/antlr/ACIItem.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/ACIItem.g?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/ACIItem.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/ACIItem.g Tue Sep  2 02:06:46 2008
@@ -32,6 +32,7 @@
 import java.util.Enumeration;
 
 import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
 
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.AndNode;
@@ -41,7 +42,6 @@
 import org.apache.directory.shared.ldap.filter.LeafNode;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationModifier;
@@ -507,7 +507,7 @@
             attributeTypeAndValue = ( String ) attributeTypeAndValueSet.nextElement();
             attributeType = NamespaceTools.getRdnAttribute( attributeTypeAndValue );
             attributeValue = NamespaceTools.getRdnValue( attributeTypeAndValue );
-            attributeSet.add( new AttributeImpl( attributeType, attributeValue ) );
+            attributeSet.add( new BasicAttribute( attributeType, attributeValue ) );
             log.debug( "An attributeTypeAndValue from the set: " + attributeType + "=" +
 attributeValue);
         }
         

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
Tue Sep  2 02:06:46 2008
@@ -29,6 +29,7 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.DirContext;
 
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
@@ -37,7 +38,6 @@
 import org.apache.directory.shared.asn1.codec.EncoderException;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.LdapMessage;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -180,7 +180,7 @@
      */
     public void addAttributeTypeAndValues( String type )
     {
-        currentAttribute = new AttributeImpl( StringTools.lowerCaseAscii( type ) );
+        currentAttribute = new BasicAttribute( StringTools.lowerCaseAscii( type ) );
 
         int operation = 0;
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
Tue Sep  2 02:06:46 2008
@@ -42,6 +42,7 @@
 import javax.naming.InvalidNameException;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.DirContext;
 import javax.naming.ldap.Control;
 
@@ -49,7 +50,6 @@
 import org.apache.directory.shared.asn1.primitives.OID;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.LdapDnParser;
 import org.apache.directory.shared.ldap.name.Rdn;
@@ -868,7 +868,7 @@
             Object attributeValue = parseSimpleValue( line, colonIndex );
 
             // Create an attribute
-            return new AttributeImpl( attributeType, attributeValue );
+            return new BasicAttribute( attributeType, attributeValue );
         }
         else
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModificationItemImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModificationItemImpl.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModificationItemImpl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModificationItemImpl.java
Tue Sep  2 02:06:46 2008
@@ -54,7 +54,7 @@
      */
     public ModificationItemImpl( int modificationOp, Attribute attribute ) 
     {
-        super( modificationOp, AttributeUtils.toAttributeImpl( attribute ) );
+        super( modificationOp, AttributeUtils.toBasicAttribute( attribute ) );
         
         serverModified = false;
     }
@@ -70,7 +70,7 @@
     public ModificationItemImpl( ModificationItem modification ) 
     {
         super( modification.getModificationOp(), 
-            AttributeUtils.toAttributeImpl( modification.getAttribute() ) );
+            AttributeUtils.toBasicAttribute( modification.getAttribute() ) );
         
         serverModified = false;
     }
@@ -82,7 +82,7 @@
     public ModificationItemImpl( ModificationItemImpl modification ) 
     {
         super( modification.getModificationOp(), 
-            AttributeUtils.toAttributeImpl( modification.getAttribute() ) );
+            AttributeUtils.toBasicAttribute( modification.getAttribute() ) );
         
         serverModified = false;
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
Tue Sep  2 02:06:46 2008
@@ -29,6 +29,7 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.InvalidAttributeIdentifierException;
 import javax.naming.directory.ModificationItem;
@@ -39,8 +40,6 @@
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -163,9 +162,9 @@
      * @param attribute The attribute to transform
      * @return A instance of AttributeImpl
      */
-    public static final Attribute toAttributeImpl( Attribute attribute )
+    public static final Attribute toBasicAttribute( Attribute attribute )
     {
-        if ( attribute instanceof AttributeImpl )
+        if ( attribute instanceof BasicAttribute )
         {
             // Just return the attribute
             return attribute;
@@ -173,7 +172,7 @@
         else
         {
             // Create a new AttributeImpl from the original attribute
-            AttributeImpl newAttribute = new AttributeImpl( attribute.getID() );
+            Attribute newAttribute = new BasicAttribute( attribute.getID() );
             
             try
             {
@@ -195,46 +194,6 @@
 
 
     /**
-     * Switch from a BasicAttributes to a AttributesImpl. This is
-     * necessary to allow cloning to be correctly handled.
-     * 
-     * @param attributes The attributes to transform
-     * @return A instance of AttributesImpl
-     */
-    public static final Attributes toAttributesImpl( Attributes attributes )
-    {
-        if ( attributes instanceof AttributesImpl )
-        {
-            // Just return the attribute
-            return attributes;
-        }
-        else
-        {
-            // Create a new AttributesImpl from the original attribute
-            AttributesImpl newAttributes = new AttributesImpl( attributes.isCaseIgnored()
);
-            
-            try
-            {
-                NamingEnumeration<?> values = attributes.getAll();
-                
-                while ( values.hasMoreElements() )
-                {
-                    Attribute attribute = (Attribute)values.next();
-                    
-                    newAttributes.put( toAttributeImpl( attribute ) );
-                }
-                
-                return newAttributes;
-            }
-            catch ( NamingException ne )
-            {
-                return newAttributes;
-            }
-        }
-    }
-
-
-    /**
      * Utility method to extract an attribute from Attributes object using
      * all combinationos of the name including aliases.
      * 
@@ -592,7 +551,7 @@
         }
         else if ( attr0 == null )
         {
-            return new AttributeImpl( attr1.getID() );
+            return new BasicAttribute( attr1.getID() );
         }
         else if ( attr1 == null )
         {
@@ -607,7 +566,7 @@
             id = attr0.getID();
         }
 
-        Attribute attr = new AttributeImpl( id );
+        Attribute attr = new BasicAttribute( id );
 
         for ( int ii = 0; ii < attr0.size(); ii++ )
         {
@@ -664,7 +623,7 @@
             id = attr0.getID();
         }
 
-        Attribute attr = new AttributeImpl( id );
+        Attribute attr = new BasicAttribute( id );
 
         if ( attr0 != null )
         {
@@ -1276,7 +1235,7 @@
     public static Entry toClientEntry( Attributes attributes, LdapDN dn ) 
             throws InvalidAttributeIdentifierException
     {
-        if ( ( attributes instanceof BasicAttributes ) || ( attributes instanceof AttributesImpl
) )
+        if ( attributes instanceof BasicAttributes )
         {
             try 
             {

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModificationItemImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModificationItemImplTest.java?rev=691168&r1=691167&r2=691168&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModificationItemImplTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModificationItemImplTest.java
Tue Sep  2 02:06:46 2008
@@ -20,6 +20,7 @@
 package org.apache.directory.shared.ldap.message;
 
 import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.DirContext;
 
 import org.junit.Test;
@@ -40,7 +41,7 @@
     @Test
     public void testEquals()
     {
-        Attribute attr = new AttributeImpl( "cn", "value" );
+        Attribute attr = new BasicAttribute( "cn", "value" );
         attr.add( "another value" );
         
         ModificationItemImpl mod1 = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr
);
@@ -51,8 +52,8 @@
         assertEquals( mod1, mod1 );
         assertEquals( mod2, mod1 );
         
-        ModificationItemImpl mod3 = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE,
new AttributeImpl( "cn" ) );  
-        ModificationItemImpl mod4 = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE,
new AttributeImpl( "cn" ) );
+        ModificationItemImpl mod3 = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE,
new BasicAttribute( "cn" ) );  
+        ModificationItemImpl mod4 = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE,
new BasicAttribute( "cn" ) );
         
         assertEquals( mod3, mod4 );
     }
@@ -63,8 +64,8 @@
     @Test
     public void testDifferentModificationItemImpl()
     {
-        Attribute attr = new AttributeImpl( "cn", "value" );
-        Attribute attr2 = new AttributeImpl( "cn", "value" );
+        Attribute attr = new BasicAttribute( "cn", "value" );
+        Attribute attr2 = new BasicAttribute( "cn", "value" );
         attr.add( "yet another value" );
         
         ModificationItemImpl mod1 = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr
);

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=691168&r1=691167&r2=691168&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
Tue Sep  2 02:06:46 2008
@@ -23,12 +23,13 @@
 import junit.framework.TestCase;
 
 import javax.naming.InvalidNameException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.ldap.Control;
 
 import org.apache.directory.shared.ldap.message.AbandonListener;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.ModifyRequest;
@@ -72,19 +73,19 @@
             // do nothing
         }
 
-        AttributeImpl attr = new AttributeImpl( "attr0" );
+        Attribute attr = new BasicAttribute( "attr0" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
         ModificationItemImpl item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attr
);
         req.addModification( item );
 
-        attr = new AttributeImpl( "attr1" );
+        attr = new BasicAttribute( "attr1" );
         attr.add( "val3" );
         item = new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, attr );
         req.addModification( item );
 
-        attr = new AttributeImpl( "attr2" );
+        attr = new BasicAttribute( "attr2" );
         attr.add( "val4" );
         attr.add( "val5" );
         item = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attr );
@@ -153,7 +154,7 @@
     public void testNotEqualDiffModOps()
     {
         ModifyRequestImpl req0 = getRequest();
-        AttributeImpl attr = new AttributeImpl( "attr3" );
+        Attribute attr = new BasicAttribute( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
@@ -161,7 +162,7 @@
         req0.addModification( item );
 
         ModifyRequestImpl req1 = getRequest();
-        attr = new AttributeImpl( "attr3" );
+        attr = new BasicAttribute( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
@@ -179,7 +180,7 @@
     public void testNotEqualDiffModCount()
     {
         ModifyRequestImpl req0 = getRequest();
-        AttributeImpl attr = new AttributeImpl( "attr3" );
+        Attribute attr = new BasicAttribute( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
@@ -199,7 +200,7 @@
     public void testNotEqualDiffModIds()
     {
         ModifyRequestImpl req0 = getRequest();
-        AttributeImpl attr = new AttributeImpl( "attr3" );
+        Attribute attr = new BasicAttribute( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
@@ -207,7 +208,7 @@
         req0.addModification( item );
 
         ModifyRequestImpl req1 = getRequest();
-        attr = new AttributeImpl( "attr4" );
+        attr = new BasicAttribute( "attr4" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
@@ -225,7 +226,7 @@
     public void testNotEqualDiffModValues()
     {
         ModifyRequestImpl req0 = getRequest();
-        AttributeImpl attr = new AttributeImpl( "attr3" );
+        Attribute attr = new BasicAttribute( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
@@ -233,7 +234,7 @@
         req0.addModification( item );
 
         ModifyRequestImpl req1 = getRequest();
-        attr = new AttributeImpl( "attr3" );
+        attr = new BasicAttribute( "attr3" );
         attr.add( "val0" );
         attr.add( "val1" );
         attr.add( "val2" );
@@ -256,19 +257,19 @@
             public Collection<ModificationItem> getModificationItems()
             {
                 List<ModificationItem> list = new ArrayList<ModificationItem>();
-                AttributeImpl attr = new AttributeImpl( "attr0" );
+                Attribute attr = new BasicAttribute( "attr0" );
                 attr.add( "val0" );
                 attr.add( "val1" );
                 attr.add( "val2" );
                 ModificationItemImpl item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
attr );
                 list.add( item );
 
-                attr = new AttributeImpl( "attr1" );
+                attr = new BasicAttribute( "attr1" );
                 attr.add( "val3" );
                 item = new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, attr );
                 list.add( item );
 
-                attr = new AttributeImpl( "attr2" );
+                attr = new BasicAttribute( "attr2" );
                 attr.add( "val4" );
                 attr.add( "val5" );
                 item = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attr );



Mime
View raw message