directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r638228 [10/20] - in /directory/sandbox/akarasulu/bigbang/apacheds: ./ apacheds-xbean-spring/src/site/ benchmarks/src/site/ bootstrap-extract/src/site/ bootstrap-partition/src/site/ bootstrap-plugin/src/main/java/org/apache/directory/server...
Date Tue, 18 Mar 2008 06:13:18 GMT
Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Mon Mar 17 23:12:41 2008
@@ -28,6 +28,7 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
@@ -58,8 +59,6 @@
 import javax.naming.ConfigurationException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
 
 
 /**
@@ -145,21 +144,21 @@
         }
 
 
-        public NamingEnumeration<SearchResult> list( NextInterceptor next, ListOperationContext opContext ) throws NamingException
+        public NamingEnumeration<ServerSearchResult> list( NextInterceptor next, ListOperationContext opContext ) throws NamingException
         {
             return nexus.list( opContext );
         }
 
 
-        public NamingEnumeration<SearchResult> search( NextInterceptor next, SearchOperationContext opContext ) throws NamingException
+        public NamingEnumeration<ServerSearchResult> search( NextInterceptor next, SearchOperationContext opContext ) throws NamingException
         {
             return nexus.search( opContext );
         }
 
 
-        public Attributes lookup( NextInterceptor next, LookupOperationContext opContext ) throws NamingException
+        public ServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws NamingException
         {
-            return ( Attributes ) nexus.lookup( opContext ).clone();
+            return ( ServerEntry ) nexus.lookup( opContext ).clone();
         }
 
 
@@ -796,7 +795,7 @@
     }
 
 
-    public NamingEnumeration<SearchResult> list( ListOperationContext opContext ) throws NamingException
+    public NamingEnumeration<ServerSearchResult> list( ListOperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.interceptor;
@@ -818,7 +817,7 @@
     }
 
 
-    public NamingEnumeration<SearchResult> search( SearchOperationContext opContext )
+    public NamingEnumeration<ServerSearchResult> search( SearchOperationContext opContext )
         throws NamingException
     {
         Entry entry = getStartingEntry();
@@ -841,7 +840,7 @@
     }
 
 
-    public Attributes lookup( LookupOperationContext opContext ) throws NamingException
+    public ServerEntry lookup( LookupOperationContext opContext ) throws NamingException
     {
         Entry entry = getStartingEntry();
         Interceptor head = entry.interceptor;
@@ -1186,7 +1185,7 @@
                 }
 
                 
-                public NamingEnumeration<SearchResult> list( ListOperationContext opContext ) throws NamingException
+                public NamingEnumeration<ServerSearchResult> list( ListOperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.interceptor;
@@ -1207,7 +1206,7 @@
                 }
 
 
-                public NamingEnumeration<SearchResult> search( SearchOperationContext opContext )
+                public NamingEnumeration<ServerSearchResult> search( SearchOperationContext opContext )
                     throws NamingException
                 {
                     Entry next = getNextEntry();
@@ -1229,7 +1228,7 @@
                 }
 
 
-                public Attributes lookup( LookupOperationContext opContext ) throws NamingException
+                public ServerEntry lookup( LookupOperationContext opContext ) throws NamingException
                 {
                     Entry next = getNextEntry();
                     Interceptor interceptor = next.interceptor;

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/NextInterceptor.java Mon Mar 17 23:12:41 2008
@@ -24,10 +24,9 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
@@ -123,20 +122,20 @@
     /**
      * Calls the next interceptor's {@link Interceptor#list( NextInterceptor, ListOperationContext )}.
      */
-    NamingEnumeration<SearchResult> list( ListOperationContext opContext ) throws NamingException;
+    NamingEnumeration<ServerSearchResult> list( ListOperationContext opContext ) throws NamingException;
 
 
     /**
      * Calls the next interceptor's {@link Interceptor#search( NextInterceptor, SearchOperationContext opContext )}.
      */
-    NamingEnumeration<SearchResult> search( SearchOperationContext opContext )
+    NamingEnumeration<ServerSearchResult> search( SearchOperationContext opContext )
         throws NamingException;
 
 
     /**
      * Calls the next interceptor's {@link Interceptor#lookup( NextInterceptor, LookupOperationContext )}.
      */
-    Attributes lookup( LookupOperationContext opContext ) throws NamingException;
+    ServerEntry lookup( LookupOperationContext opContext ) throws NamingException;
 
 
     /**

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Mon Mar 17 23:12:41 2008
@@ -22,14 +22,14 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.ModificationItem;
 
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 /**
@@ -44,7 +44,7 @@
 public class ModifyOperationContext extends AbstractOperationContext
 {
     /** The modification items */
-    private List<ModificationItemImpl> modItems;
+    private List<Modification> modItems;
 
 
     /**
@@ -54,7 +54,7 @@
      */
     public ModifyOperationContext( Registries registries )
     {
-    	super( registries );
+        super( registries );
     }
 
 
@@ -64,7 +64,7 @@
      * @param dn the dn of the entry to be modified
      * @param modItems the modifications to be performed on the entry
      */
-    public ModifyOperationContext( Registries registries, LdapDN dn, List<ModificationItemImpl> modItems )
+    public ModifyOperationContext( Registries registries, LdapDN dn, List<Modification> modItems )
     {
         super( registries, dn );
         this.modItems = modItems;
@@ -78,7 +78,7 @@
      * @param modItems the modifications to be performed on the entry
      * @param collateralOperation true if op is collateral, false otherwise
      */
-    public ModifyOperationContext( Registries registries, LdapDN dn, List<ModificationItemImpl> modItems, boolean collateralOperation )
+    public ModifyOperationContext( Registries registries, LdapDN dn, List<Modification> modItems, boolean collateralOperation )
     {
         super( registries, dn, collateralOperation );
         this.modItems = modItems;
@@ -89,7 +89,7 @@
      * Set the modified attributes
      * @param modItems The modified attributes
      */
-    public void setModItems( List<ModificationItemImpl> modItems )
+    public void setModItems( List<Modification> modItems )
     {
         this.modItems = modItems;
     }
@@ -98,21 +98,19 @@
     /**
      * @return The modifications
      */
-    public List<ModificationItemImpl> getModItems() 
+    public List<Modification> getModItems() 
     {
         return modItems;
     }
 
 
-    @SuppressWarnings( value = "unchecked" )
-    public static List<ModificationItemImpl> createModItems( Attributes attributes, int modOp ) throws NamingException
+    public static List<Modification> createModItems( ServerEntry serverEntry, ModificationOperation modOp ) throws NamingException
     {
-        List<ModificationItemImpl> items = new ArrayList<ModificationItemImpl>( attributes.size() );
-        NamingEnumeration<Attribute> e = ( NamingEnumeration<Attribute> ) attributes.getAll();
+        List<Modification> items = new ArrayList<Modification>( serverEntry.size() );
         
-        while ( e.hasMore() )
+        for ( ServerAttribute attribute:serverEntry )
         {
-            items.add( new ModificationItemImpl( modOp, e.next() ) );
+            items.add( new ServerModification( modOp, attribute ) );
         }
 
         return items;
@@ -128,7 +126,7 @@
         
         sb.append("ModifyContext for DN '").append( getDn().getUpName() ).append( "', modifications :\n" );
         
-        for ( ModificationItem mod:modItems )
+        for ( Modification mod:modItems )
         {
             sb.append( mod ).append( '\n' );
         }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java Mon Mar 17 23:12:41 2008
@@ -20,8 +20,12 @@
 package org.apache.directory.server.core.jndi;
 
 
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -30,8 +34,6 @@
 import java.io.ObjectOutputStream;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.Attribute;
 
 
 /**
@@ -77,14 +79,14 @@
      * @return the deserialized object
      * @throws NamingException if the object cannot be serialized
      */
-    static Object deserialize( Attributes attributes ) throws NamingException
+    static Object deserialize( ServerEntry serverEntry ) throws NamingException
     {
         ObjectInputStream in = null;
-        String className = ( String ) attributes.get( JCLASSNAME_ATTR ).get();
+        String className = ( String ) serverEntry.get( JCLASSNAME_ATTR ).getString();
 
         try
         {
-            byte[] data = ( byte[] ) attributes.get( JSERIALDATA_ATTR ).get();
+            byte[] data = ( byte[] ) serverEntry.get( JSERIALDATA_ATTR ).getBytes();
             in = new ObjectInputStream( new ByteArrayInputStream( data ) );
             return in.readObject();
         }
@@ -162,7 +164,7 @@
      * @param obj the object to serialize
      * @throws NamingException if the object cannot be serialized
      */
-    static void serialize( Attributes entry, Object obj ) throws NamingException
+    static void serialize( ServerEntry entry, Object obj, Registries registries ) throws NamingException
     {
         /* Let's add the object classes first:
          * objectClass: top
@@ -170,20 +172,20 @@
          * objectClass: javaContainer
          * objectClass: javaSerializedObject
          */
-        Attribute objectClass = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
-        objectClass.add( SchemaConstants.TOP_OC );
-        objectClass.add( JOBJECT_ATTR );
-        objectClass.add( JCONTAINER_ATTR );
-        objectClass.add( JSERIALIZEDOBJ_ATTR );
-        entry.put( objectClass );
+        entry.put( SchemaConstants.OBJECT_CLASS_AT,
+        		SchemaConstants.TOP_OC,
+        		JOBJECT_ATTR,
+        		JCONTAINER_ATTR,
+        		JSERIALIZEDOBJ_ATTR );
 
         // Add the javaClassName and javaSerializedData attributes
         entry.put( JCLASSNAME_ATTR, obj.getClass().getName() );
         entry.put( JSERIALDATA_ATTR, serialize( obj ) );
 
         // Add all the class names this object can be cast to:
-        Class[] classes = obj.getClass().getClasses();
-        Attribute javaClassNames = new AttributeImpl( JCLASSNAMES_ATTR );
+        Class<?>[] classes = obj.getClass().getClasses();
+        AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( JCLASSNAMES_ATTR );
+        ServerAttribute javaClassNames = new DefaultServerAttribute( attributeType, JCLASSNAMES_ATTR );
 
         for ( int ii = 0; ii < classes.length; ii++ )
         {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Mon Mar 17 23:12:41 2008
@@ -23,8 +23,11 @@
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
@@ -42,14 +45,12 @@
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
-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.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.AttributeTypeAndValue;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -66,11 +67,9 @@
 import javax.naming.NamingException;
 import javax.naming.Reference;
 import javax.naming.Referenceable;
-import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
 import javax.naming.event.EventContext;
 import javax.naming.event.NamingListener;
 import javax.naming.ldap.Control;
@@ -79,7 +78,6 @@
 import java.io.Serializable;
 import java.util.HashSet;
 import java.util.Hashtable;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -209,7 +207,7 @@
     
     /**
      * Used to encapsulate [de]marshalling of controls before and after add operations.
-     * @param attributes
+     * @param entry
      * @param target
      */
     protected void doAddOperation( LdapDN target, ServerEntry entry ) throws NamingException
@@ -258,7 +256,7 @@
      * @param searchControls
      * @return
      */
-    protected NamingEnumeration<SearchResult> doSearchOperation( LdapDN dn, AliasDerefMode aliasDerefMode,
+    protected NamingEnumeration<ServerSearchResult> doSearchOperation( LdapDN dn, AliasDerefMode aliasDerefMode,
                                                                  ExprNode filter, SearchControls searchControls )
         throws NamingException
     {
@@ -267,7 +265,7 @@
         opCtx.addRequestControls( requestControls );
         
         // execute search operation
-        NamingEnumeration<SearchResult> results = nexusProxy.search( opCtx );
+        NamingEnumeration<ServerSearchResult> results = nexusProxy.search( opCtx );
 
         // clear the request controls and set the response controls 
         requestControls = EMPTY_CONTROLS;
@@ -280,14 +278,14 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after list operations.
      */
-    protected NamingEnumeration<SearchResult> doListOperation( LdapDN target ) throws NamingException
+    protected NamingEnumeration<ServerSearchResult> doListOperation( LdapDN target ) throws NamingException
     {
         // setup the op context and populate with request controls
         ListOperationContext opCtx = new ListOperationContext( registries, target );
         opCtx.addRequestControls( requestControls );
         
         // execute list operation
-        NamingEnumeration<SearchResult> results = nexusProxy.list( opCtx );
+        NamingEnumeration<ServerSearchResult> results = nexusProxy.list( opCtx );
 
         // clear the request controls and set the response controls 
         requestControls = EMPTY_CONTROLS;
@@ -311,7 +309,7 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after lookup operations.
      */
-    protected Attributes doLookupOperation( LdapDN target ) throws NamingException
+    protected ServerEntry doLookupOperation( LdapDN target ) throws NamingException
     {
         // setup the op context and populate with request controls
         LookupOperationContext opCtx;
@@ -319,19 +317,19 @@
         // execute lookup/getRootDSE operation
         opCtx = new LookupOperationContext( registries, target );
         opCtx.addRequestControls( requestControls );
-        Attributes attributes = nexusProxy.lookup( opCtx );
+        ServerEntry serverEntry = nexusProxy.lookup( opCtx );
 
         // clear the request controls and set the response controls 
         requestControls = EMPTY_CONTROLS;
         responseControls = opCtx.getResponseControls();
-        return attributes;
+        return serverEntry;
     }
     
     
     /**
      * Used to encapsulate [de]marshalling of controls before and after lookup operations.
      */
-    protected Attributes doLookupOperation( LdapDN target, String[] attrIds ) throws NamingException
+    protected ServerEntry doLookupOperation( LdapDN target, String[] attrIds ) throws NamingException
     {
         // setup the op context and populate with request controls
         LookupOperationContext opCtx;
@@ -339,13 +337,23 @@
         // execute lookup/getRootDSE operation
         opCtx = new LookupOperationContext( registries, target, attrIds );
         opCtx.addRequestControls( requestControls );
-        Attributes attributes = nexusProxy.lookup( opCtx );
+        ServerEntry serverEntry = nexusProxy.lookup( opCtx );
 
         // clear the request controls and set the response controls 
         requestControls = EMPTY_CONTROLS;
         responseControls = opCtx.getResponseControls();
         
-        return attributes;
+        // Now remove the ObjectClass attribute if it has not been requested
+        if ( ( opCtx.getAttrsId() != null ) && ( opCtx.getAttrsId().size() != 0 ) )
+        {
+            if ( ( serverEntry.get( SchemaConstants.OBJECT_CLASS_AT ) != null ) && 
+                 (serverEntry.get( SchemaConstants.OBJECT_CLASS_AT ).size() == 0 ) )
+            {
+            	serverEntry.remove( SchemaConstants.OBJECT_CLASS_AT );
+            }
+        }
+        
+        return serverEntry;
     }
     
     
@@ -395,10 +403,10 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after modify operations.
      */
-    protected void doModifyOperation( LdapDN dn, List<ModificationItemImpl> modItems ) throws NamingException
+    protected void doModifyOperation( LdapDN dn, List<Modification> modifications ) throws NamingException
     {
         // setup the op context and populate with request controls
-        ModifyOperationContext opCtx = new ModifyOperationContext( registries, dn, modItems );
+        ModifyOperationContext opCtx = new ModifyOperationContext( registries, dn, modifications );
         opCtx.addRequestControls( requestControls );
         
         // execute modify operation
@@ -591,13 +599,9 @@
      */
     public Context createSubcontext( Name name ) throws NamingException
     {
-        Attributes attributes = new AttributesImpl();
         LdapDN target = buildTarget( name );
-        
-        Attribute attribute = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
-        attribute.add( SchemaConstants.TOP_OC );
-        attribute.add( JavaLdapSupport.JCONTAINER_ATTR );
-        attributes.put( attribute );
+        ServerEntry serverEntry = new DefaultServerEntry( registries, target );
+        serverEntry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, JavaLdapSupport.JCONTAINER_ATTR );
         
         // Now add the CN attribute, which is mandatory
         Rdn rdn = target.getRdn();
@@ -606,7 +610,7 @@
         {
             if ( SchemaConstants.CN_AT.equals( rdn.getNormType() )  )
             {
-                attributes.put( rdn.getUpType(), rdn.getUpValue() );
+                serverEntry.put( rdn.getUpType(), (String)rdn.getUpValue() );
             }
             else
             {
@@ -624,12 +628,12 @@
 
         /*
          * Add the new context to the server which as a side effect adds 
-         * operational attributes to the attributes refering instance which
+         * operational attributes to the serverEntry refering instance which
          * can them be used to initialize a new ServerLdapContext.  Remember
          * we need to copy over the controls as well to propagate the complete 
-         * environment besides whats in the hashtable for env.
+         * environment besides what's in the hashtable for env.
          */
-        doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
+        doAddOperation( target, serverEntry );
         return new ServerLdapContext( service, principal, target );
     }
 
@@ -668,20 +672,20 @@
     }
 
     
-    private void injectRdnAttributeValues( LdapDN target, Attributes attributes )
+    private void injectRdnAttributeValues( LdapDN target, ServerEntry serverEntry ) throws NamingException
     {
         // Add all the RDN attributes and their values to this entry
         Rdn rdn = target.getRdn( target.size() - 1 );
+        
         if ( rdn.size() == 1 )
         {
-            attributes.put( rdn.getUpType(), rdn.getValue() );
+            serverEntry.put( rdn.getUpType(), (String)rdn.getValue() );
         }
         else
         {
-            for ( Iterator<AttributeTypeAndValue> ii = rdn.iterator(); ii.hasNext(); /**/ )
-            {
-                AttributeTypeAndValue atav = ( AttributeTypeAndValue ) ii.next();
-                attributes.put( atav.getUpType(), atav.getValue() );
+        	for ( AttributeTypeAndValue atav:rdn )
+        	{
+                serverEntry.put( atav.getUpType(), (String)atav.getNormValue() );
             }
         }
     }
@@ -695,13 +699,14 @@
         // First, use state factories to do a transformation
         DirStateFactory.Result res = DirectoryManager.getStateToBind( obj, name, this, env, null );
 
+        LdapDN target = buildTarget( name );
+        
         // let's be sure that the Attributes is case insensitive
-        Attributes outAttrs = AttributeUtils.toCaseInsensitive( res.getAttributes() );
+        ServerEntry outServerEntry = ServerEntryUtils.toServerEntry( AttributeUtils.toCaseInsensitive( res.getAttributes() ), dn, registries );
 
-        if ( outAttrs != null )
+        if ( outServerEntry != null )
         {
-            LdapDN target = buildTarget( name );
-            doAddOperation( target, ServerEntryUtils.toServerEntry( outAttrs, target, registries ) );
+            doAddOperation( target, outServerEntry );
             return;
         }
 
@@ -709,9 +714,12 @@
         {
 			Attributes attributes = (Attributes)obj;
 			
-			LdapDN target = buildTarget( name );
             doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
 		}
+        else if ( obj instanceof ServerEntry ) 
+        {
+            doAddOperation( target, (ServerEntry)obj );
+		}
         // Check for Referenceable
         else if ( obj instanceof Referenceable )
         {
@@ -726,43 +734,38 @@
         else if ( obj instanceof Serializable )
         {
             // Serialize and add outAttrs
-            Attributes attributes = new AttributesImpl();
+            ServerEntry serverEntry = new DefaultServerEntry( registries, target );
             
-            if ( outAttrs != null && outAttrs.size() > 0 )
+            if ( ( outServerEntry != null ) && ( outServerEntry.size() > 0 ) )
             {
-                NamingEnumeration<? extends Attribute> list = outAttrs.getAll();
-                
-                while ( list.hasMore() )
-                {
-                    attributes.put( list.next() );
-                }
+            	for ( ServerAttribute serverAttribute:outServerEntry )
+            	{
+            		serverEntry.put( serverAttribute );
+            	}
             }
 
             // Get target and inject all rdn attributes into entry
-            LdapDN target = buildTarget( name );
-            injectRdnAttributeValues( target, attributes );
+            injectRdnAttributeValues( target, serverEntry );
 
             // Serialize object into entry attributes and add it.
-            JavaLdapSupport.serialize( attributes, obj );
-            doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
+            JavaLdapSupport.serialize( serverEntry, obj, registries );
+            doAddOperation( target, serverEntry );
         }
         else if ( obj instanceof DirContext )
         {
             // Grab attributes and merge with outAttrs
-            Attributes attributes = ( ( DirContext ) obj ).getAttributes( "" );
-            if ( outAttrs != null && outAttrs.size() > 0 )
+            ServerEntry serverEntry = ServerEntryUtils.toServerEntry( ((DirContext)obj).getAttributes( "" ), target, registries );
+            
+            if ( ( outServerEntry != null ) && ( outServerEntry.size() > 0 ) )
             {
-                NamingEnumeration<? extends Attribute> list = outAttrs.getAll();
-                
-                while ( list.hasMore() )
-                {
-                    attributes.put( list.next() );
-                }
+            	for ( ServerAttribute serverAttribute:outServerEntry )
+            	{
+            		serverEntry.put( serverAttribute );
+            	}
             }
 
-            LdapDN target = buildTarget( name );
-            injectRdnAttributeValues( target, attributes );
-            doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
+            injectRdnAttributeValues( target, serverEntry );
+            doAddOperation( target, serverEntry );
         }
         else
         {
@@ -911,20 +914,20 @@
         Object obj;
         LdapDN target = buildTarget( name );
         
-        Attributes attributes;
+        ServerEntry serverEntry;
         
         if ( name.size() == 0 )
         {
-            attributes = ServerEntryUtils.toAttributesImpl( doGetRootDSEOperation( target ) );
+            serverEntry = doGetRootDSEOperation( target );
         }
         else
         {
-            attributes = doLookupOperation( target );
+            serverEntry = doLookupOperation( target );
         }
 
         try
         {
-            obj = DirectoryManager.getObjectInstance( null, name, this, env, attributes );
+            obj = DirectoryManager.getObjectInstance( null, name, this, env, ServerEntryUtils.toAttributesImpl( serverEntry ) );
         }
         catch ( Exception e )
         {
@@ -941,10 +944,10 @@
         }
 
         // First lets test and see if the entry is a serialized java object
-        if ( attributes.get( JavaLdapSupport.JCLASSNAME_ATTR ) != null )
+        if ( serverEntry.get( JavaLdapSupport.JCLASSNAME_ATTR ) != null )
         {
             // Give back serialized object and not a context
-            return JavaLdapSupport.deserialize( attributes );
+            return JavaLdapSupport.deserialize( serverEntry );
         }
 
         // Initialize and return a context since the entry is not a java object
@@ -1026,7 +1029,7 @@
     @SuppressWarnings(value={"unchecked"})
     public NamingEnumeration list( Name name ) throws NamingException
     {
-        return doListOperation( buildTarget( name ) );
+        return ServerEntryUtils.toSearchResultEnum( doListOperation( buildTarget( name ) ) );
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Mon Mar 17 23:12:41 2008
@@ -22,10 +22,13 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
@@ -122,7 +125,7 @@
      */
     public Attributes getAttributes( Name name ) throws NamingException
     {
-        return doLookupOperation( buildTarget( name ) );
+        return ServerEntryUtils.toAttributesImpl( doLookupOperation( buildTarget( name ) ) );
     }
 
 
@@ -142,7 +145,7 @@
      */
     public Attributes getAttributes( Name name, String[] attrIds ) throws NamingException
     {
-        return doLookupOperation( buildTarget( name ), attrIds );
+        return ServerEntryUtils.toAttributesImpl( doLookupOperation( buildTarget( name ), attrIds ) );
     }
 
 
@@ -174,13 +177,15 @@
             }
         }
 
+        List<Modification> newMods = ServerEntryUtils.toServerModification( modItems, registries.getAttributeTypeRegistry() );
+
     	if ( name instanceof LdapDN )
     	{
-            doModifyOperation( buildTarget( name ), modItems );
+            doModifyOperation( buildTarget( name ), newMods );
     	}
     	else
     	{
-            doModifyOperation( buildTarget( new LdapDN( name ) ), modItems );
+            doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
     	}
     }
 
@@ -217,13 +222,7 @@
      */
     public void modifyAttributes( Name name, ModificationItem[] mods ) throws NamingException
     {
-        List<ModificationItemImpl> newMods = new ArrayList<ModificationItemImpl>( mods.length );
-        
-        for ( ModificationItem mod:mods )
-        {
-            newMods.add( new ModificationItemImpl( mod ) );
-        }
-        
+        List<Modification> newMods = ServerEntryUtils.toServerModification( mods, registries.getAttributeTypeRegistry() );
         doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
     }
 
@@ -234,7 +233,8 @@
      */
     public void modifyAttributes( Name name, List<ModificationItemImpl> mods ) throws NamingException
     {
-        doModifyOperation( buildTarget( new LdapDN( name ) ), mods );
+        List<Modification> newMods = ServerEntryUtils.toServerModification( mods, registries.getAttributeTypeRegistry() );
+        doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
     }
 
 
@@ -267,35 +267,35 @@
             return;
         }
 
-        attrs = AttributeUtils.toCaseInsensitive( attrs );
+        LdapDN target = buildTarget( name );
+
+        ServerEntry serverEntry = ServerEntryUtils.toServerEntry( AttributeUtils.toCaseInsensitive( attrs ), target, registries );
         
         // No object binding so we just add the attributes
         if ( null == obj )
         {
-            Attributes clone = ( Attributes ) attrs.clone();
-            LdapDN target = buildTarget( name );
-            doAddOperation( target, ServerEntryUtils.toServerEntry( clone, target, registries ) );
+        	ServerEntry clone = ( ServerEntry ) serverEntry.clone();
+            doAddOperation( target, clone );
             return;
         }
 
         // First, use state factories to do a transformation
         DirStateFactory.Result res = DirectoryManager.getStateToBind( obj, name, this, getEnvironment(), attrs );
-        Attributes outAttrs = res.getAttributes();
+        ServerEntry outServerEntry = ServerEntryUtils.toServerEntry( res.getAttributes(), target, registries );
 
-        if ( outAttrs != attrs )
+        if ( outServerEntry != serverEntry )
         {
-            LdapDN target = buildTarget( name );
-            Attributes attributes = ( Attributes ) attrs.clone();
-            if ( outAttrs != null && outAttrs.size() > 0 )
+        	ServerEntry clone = ( ServerEntry ) serverEntry.clone();
+
+        	if ( ( outServerEntry != null ) && ( outServerEntry.size() > 0 ) )
             {
-                NamingEnumeration<? extends Attribute> list = outAttrs.getAll();
-                while ( list.hasMore() )
-                {
-                    attributes.put( ( Attribute ) list.next() );
-                }
+        		for ( ServerAttribute attribute:outServerEntry )
+        		{
+        			clone.put( attribute );
+        		}
             }
 
-            doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
+            doAddOperation( target, clone );
             return;
         }
 
@@ -314,38 +314,34 @@
         else if ( obj instanceof Serializable )
         {
             // Serialize and add outAttrs
-            Attributes attributes = ( Attributes ) attrs.clone();
-            if ( outAttrs != null && outAttrs.size() > 0 )
+            ServerEntry clone = ( ServerEntry ) serverEntry.clone();
+            
+            if ( outServerEntry != null && outServerEntry.size() > 0 )
             {
-                NamingEnumeration<? extends Attribute> list = outAttrs.getAll();
-                
-                while ( list.hasMore() )
-                {
-                    attributes.put( ( Attribute ) list.next() );
-                }
+        		for ( ServerAttribute attribute:outServerEntry )
+        		{
+        			clone.put( attribute );
+        		}
             }
-            LdapDN target = buildTarget( name );
-
+            
             // Serialize object into entry attributes and add it.
-            JavaLdapSupport.serialize( attributes, obj );
-            doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
+            JavaLdapSupport.serialize( serverEntry, obj, registries );
+            doAddOperation( target, clone );
         }
         else if ( obj instanceof DirContext )
         {
             // Grab attributes and merge with outAttrs
-            Attributes attributes = ( ( DirContext ) obj ).getAttributes( "" );
-            if ( outAttrs != null && outAttrs.size() > 0 )
+            ServerEntry entry = ServerEntryUtils.toServerEntry( ( ( DirContext ) obj ).getAttributes( "" ), target, registries );
+            
+            if ( ( outServerEntry != null ) && ( outServerEntry.size() > 0 ) )
             {
-                NamingEnumeration<? extends Attribute> list = outAttrs.getAll();
-                
-                while ( list.hasMore() )
-                {
-                    attributes.put( ( Attribute ) list.next() );
-                }
+        		for ( ServerAttribute attribute:outServerEntry )
+        		{
+        			entry.put( attribute );
+        		}
             }
             
-            LdapDN target = buildTarget( name );
-            doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
+            doAddOperation( target, entry );
         }
         else
         {
@@ -427,20 +423,20 @@
         }
         else
         {
-            for ( Iterator ii = rdn.iterator(); ii.hasNext(); /**/ )
+            for ( Iterator<AttributeTypeAndValue> ii = rdn.iterator(); ii.hasNext(); /**/ )
             {
-                AttributeTypeAndValue atav = ( AttributeTypeAndValue ) ii.next();
+                AttributeTypeAndValue atav = ii.next();
 
                 // Add the Rdn attribute
                 boolean doRdnPut = attributes.get( atav.getNormType() ) == null;
                 doRdnPut = doRdnPut || attributes.get( atav.getNormType() ).size() == 0;
                 
                 // TODO Fix DIRSERVER-832
-                doRdnPut = doRdnPut || !attributes.get( atav.getNormType() ).contains( atav.getValue() );
+                doRdnPut = doRdnPut || !attributes.get( atav.getNormType() ).contains( atav.getNormValue() );
         
                 if ( doRdnPut )
                 {
-                    attributes.put( atav.getNormType(), atav.getValue() );
+                    attributes.put( atav.getNormType(), atav.getNormValue() );
                 }
             }
         }
@@ -547,7 +543,7 @@
         {
             PresenceNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT );
             AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-            return doSearchOperation( target, aliasDerefMode, filter, ctls );
+            return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filter, ctls ) );
         }
 
         // Handle simple filter expressions without multiple terms
@@ -572,7 +568,7 @@
                 }
 
                 AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-                return doSearchOperation( target, aliasDerefMode, node, ctls );
+                return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, node, ctls ) );
             }
         }
         
@@ -619,7 +615,7 @@
         }
 
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-        return doSearchOperation( target, aliasDerefMode, filter, ctls );
+        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filter, ctls ) );
     }
 
 
@@ -648,7 +644,7 @@
     {
         LdapDN target = buildTarget( name );
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-        return doSearchOperation( target, aliasDerefMode, filter, cons );
+        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filter, cons ) );
     }
 
 
@@ -674,7 +670,7 @@
         }
 
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-        return doSearchOperation( target, aliasDerefMode, filterNode, cons );
+        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filterNode, cons ) );
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirObjectFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirObjectFactory.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirObjectFactory.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirObjectFactory.java Mon Mar 17 23:12:41 2008
@@ -69,5 +69,5 @@
      *
      * @return the Class associated with this factory.
      */
-    Class getAssociatedClass();
+    Class<?> getAssociatedClass();
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirStateFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirStateFactory.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirStateFactory.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirStateFactory.java Mon Mar 17 23:12:41 2008
@@ -63,5 +63,5 @@
      *
      * @return the class associated with this factory.
      */
-    Class getAssociatedClass();
+    Class<?> getAssociatedClass();
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Mon Mar 17 23:12:41 2008
@@ -31,11 +31,16 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.entry.ServerBinaryValue;
+import org.apache.directory.server.core.entry.ServerStringValue;
 import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
 import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
 import org.apache.directory.server.core.referral.ReferralInterceptor;
 import org.apache.directory.shared.ldap.NotImplementedException;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -167,8 +172,44 @@
      */
     public boolean compare( LdapDN name, String oid, Object value ) throws NamingException
     {
+        Value<?> val = null;
+        
+        AttributeType attributeType = getService().getRegistries().getAttributeTypeRegistry().lookup( oid );
+        
         // make sure we add the request controls to operation
-        CompareOperationContext opCtx = new CompareOperationContext( registries, name, oid, value );
+        if ( attributeType.getSyntax().isHumanReadable() )
+        {
+            if ( value instanceof String )
+            {
+                val = new ServerStringValue( attributeType, (String)value );
+            }
+            else if ( value instanceof byte[] )
+            {
+                val = new ServerStringValue( attributeType, StringTools.utf8ToString( (byte[])value ) );
+            }
+            else
+            {
+                throw new NamingException( "Bad value for the OID " + oid );
+            }
+        }
+        else
+        {
+            if ( value instanceof String )
+            {
+                val = new ServerBinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
+            }
+            else if ( value instanceof byte[] )
+            {
+                val = new ServerBinaryValue( attributeType, (byte[])value );
+            }
+            else
+            {
+                throw new NamingException( "Bad value for the OID " + oid );
+            }
+        }
+        
+        
+        CompareOperationContext opCtx = new CompareOperationContext( registries, name, oid, val );
         opCtx.addRequestControls( requestControls );
 
         // execute operation

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Mon Mar 17 23:12:41 2008
@@ -21,6 +21,8 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
@@ -53,8 +55,6 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
 import java.util.Map;
 
 
@@ -78,6 +78,9 @@
 
     /** The association between attributeTypes and their normalizers */
     private Map<String, OidNormalizer> attrNormalizers; 
+    
+    /** The globa attributeType registry */
+    private AttributeTypeRegistry attributeRegistry;
 
     /**
      * Initialize the registries, normalizers. 
@@ -85,7 +88,7 @@
     public void init( DirectoryService directoryService ) throws NamingException
     {
         OidRegistry oidRegistry = directoryService.getRegistries().getOidRegistry();
-        AttributeTypeRegistry attributeRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
+        attributeRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry, oidRegistry );
         normVisitor = new NormalizingVisitor( ncn, oidRegistry );
         //expVisitor = new ExpandingVisitor( attributeRegistry );
@@ -158,7 +161,7 @@
     }
 
 
-    public NamingEnumeration<SearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
+    public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
     {
         ExprNode filter = opContext.getFilter();
         opContext.getDn().normalize( attrNormalizers );
@@ -167,11 +170,13 @@
         if ( result == null )
         {
             LOG.warn( "undefined filter based on undefined attributeType not evaluted at all.  Returning empty enumeration." );
-            return new EmptyEnumeration<SearchResult>();
+            return new EmptyEnumeration<ServerSearchResult>();
         }
         else
         {
             opContext.setFilter( result );
+            
+            // TODO Normalize the returned Attributes, storing the UP attributes to format the returned values.
             return nextInterceptor.search( opContext );
         }
     }
@@ -184,16 +189,42 @@
     }
 
 
-    public NamingEnumeration<SearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
+    public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
     {
         opContext.getDn().normalize( attrNormalizers );
         return nextInterceptor.list( opContext );
     }
 
+    
+    private String[] normalizeAttrsId( String[] attrIds ) throws NamingException
+    {
+        if ( attrIds == null )
+        {
+            return attrIds;
+        }
+        
+        String[] normalizedAttrIds = new String[attrIds.length];
+        int pos = 0;
+        
+        for ( String id:attrIds )
+        {
+            String oid = attributeRegistry.lookup( id ).getOid();
+            normalizedAttrIds[pos++] = oid;
+        }
+        
+        return normalizedAttrIds;
+    }
 
-    public Attributes lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws NamingException
+    public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws NamingException
     {
         opContext.getDn().normalize( attrNormalizers );
+        
+        if ( opContext.getAttrsId() != null )
+        {
+            // We have to normalize the requested IDs
+            opContext.setAttrsId( normalizeAttrsId( opContext.getAttrsIdArray() ) );
+        }
+        
         return nextInterceptor.lookup( opContext );
     }
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Mon Mar 17 23:12:41 2008
@@ -27,8 +27,12 @@
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerValue;
+import org.apache.directory.server.core.entry.ServerModification;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
@@ -47,24 +51,19 @@
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-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.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.AttributeTypeAndValue;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.DateUtils;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
 import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
 
 
 /**
@@ -82,11 +81,21 @@
 {
     private final SearchResultFilter DENORMALIZING_SEARCH_FILTER = new SearchResultFilter()
     {
-        public boolean accept( Invocation invocation, SearchResult result, SearchControls controls ) 
+        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls ) 
             throws NamingException
         {
-            return controls.getReturningAttributes() == null || filterDenormalized( result.getAttributes() );
-
+            ServerEntry serverEntry = result.getServerEntry(); 
+            
+            if ( controls.getReturningAttributes() == null )
+            {
+                return true;
+            }
+            
+            boolean denormalized = filterDenormalized( serverEntry );
+            
+            result.setServerEntry( serverEntry );
+            
+            return denormalized;
         }
     };
 
@@ -95,11 +104,12 @@
      */
     private final SearchResultFilter SEARCH_FILTER = new SearchResultFilter()
     {
-        public boolean accept( Invocation invocation, SearchResult result, SearchControls controls )
+        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
             throws NamingException
         {
-            return controls.getReturningAttributes() != null || filter( result.getAttributes() );
-
+            ServerEntry serverEntry = result.getServerEntry(); 
+            
+            return controls.getReturningAttributes() != null || filterOperationalAttributes( serverEntry );
         }
     };
 
@@ -128,7 +138,7 @@
         atRegistry = registries.getAttributeTypeRegistry();
 
         // stuff for dealing with subentries (garbage for now)
-        ServerValue<?> subschemaSubentry = service.getPartitionNexus()
+        Value<?> subschemaSubentry = service.getPartitionNexus()
                 .getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
         subschemaSubentryDn = new LdapDN( (String)subschemaSubentry.get() );
         subschemaSubentryDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
@@ -171,18 +181,26 @@
         // Add the operational attributes for the modifier first
         // -------------------------------------------------------------------
         
-        List<ModificationItemImpl> modItemList = new ArrayList<ModificationItemImpl>(2);
+        List<Modification> modItemList = new ArrayList<Modification>(2);
         
-        Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
-        attribute.add( getPrincipal().getName() );
-        ModificationItemImpl modifiers = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute );
-        modifiers.setServerModified();
+        AttributeType modifiersNameAt = atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT );
+        ServerAttribute attribute = new DefaultServerAttribute( 
+            SchemaConstants.MODIFIERS_NAME_AT,
+            modifiersNameAt, 
+            getPrincipal().getName());
+
+        Modification modifiers = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
+        //modifiers.setServerModified();
         modItemList.add( modifiers );
         
-        attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
-        attribute.add( DateUtils.getGeneralizedTime() );
-        ModificationItemImpl timestamp = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute );
-        timestamp.setServerModified();
+        AttributeType modifyTimeStampAt = atRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT );
+        attribute = new DefaultServerAttribute( 
+            SchemaConstants.MODIFY_TIMESTAMP_AT,
+            modifyTimeStampAt,
+            DateUtils.getGeneralizedTime() );
+        
+        Modification timestamp = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
+        //timestamp.setServerModified();
         modItemList.add( timestamp );
 
         // -------------------------------------------------------------------
@@ -200,21 +218,16 @@
         nextInterceptor.rename( opContext );
 
         // add operational attributes after call in case the operation fails
-        Attributes attributes = new AttributesImpl( true );
-        Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
-        attribute.add( getPrincipal().getName() );
-        attributes.put( attribute );
-
-        attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
-        attribute.add( DateUtils.getGeneralizedTime() );
-        attributes.put( attribute );
+        ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() );
+        serverEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() );
+        serverEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
         LdapDN newDn = ( LdapDN ) opContext.getDn().clone();
         newDn.remove( opContext.getDn().size() - 1 );
         newDn.add( opContext.getNewRdn() );
         newDn.normalize( atRegistry.getNormalizerMapping() );
         
-        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );
 
         ModifyOperationContext newModify = new ModifyOperationContext( registries, newDn, items );
         
@@ -227,16 +240,11 @@
         nextInterceptor.move( opContext );
 
         // add operational attributes after call in case the operation fails
-        Attributes attributes = new AttributesImpl( true );
-        Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
-        attribute.add( getPrincipal().getName() );
-        attributes.put( attribute );
-
-        attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
-        attribute.add( DateUtils.getGeneralizedTime() );
-        attributes.put( attribute );
+        ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() );
+        serverEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() );
+        serverEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );
 
 
         ModifyOperationContext newModify = 
@@ -252,28 +260,23 @@
         nextInterceptor.moveAndRename( opContext );
 
         // add operational attributes after call in case the operation fails
-        Attributes attributes = new AttributesImpl( true );
-        Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
-        attribute.add( getPrincipal().getName() );
-        attributes.put( attribute );
-
-        attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
-        attribute.add( DateUtils.getGeneralizedTime() );
-        attributes.put( attribute );
+        ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() );
+        serverEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() );
+        serverEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );
 
         ModifyOperationContext newModify = 
             new ModifyOperationContext( registries, 
-        		opContext.getParent(), items );
+                opContext.getParent(), items );
         
         service.getPartitionNexus().modify( newModify );
     }
 
 
-    public Attributes lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws NamingException
+    public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws NamingException
     {
-        Attributes result = nextInterceptor.lookup( opContext );
+        ServerEntry result = nextInterceptor.lookup( opContext );
         
         if ( result == null )
         {
@@ -282,7 +285,7 @@
 
         if ( opContext.getAttrsId() == null )
         {
-            filter( result );
+            filterOperationalAttributes( result );
         }
         else
         {
@@ -293,19 +296,19 @@
     }
 
 
-    public NamingEnumeration<SearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
+    public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
     {
-        NamingEnumeration<SearchResult> result = nextInterceptor.list( opContext );
+        NamingEnumeration<ServerSearchResult> result = nextInterceptor.list( opContext );
         Invocation invocation = InvocationStack.getInstance().peek();
         
         return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, SEARCH_FILTER, "List Operational Filter" );
     }
 
 
-    public NamingEnumeration<SearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
+    public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
     {
         Invocation invocation = InvocationStack.getInstance().peek();
-        NamingEnumeration<SearchResult> result = nextInterceptor.search( opContext );
+        NamingEnumeration<ServerSearchResult> result = nextInterceptor.search( opContext );
         SearchControls searchCtls = opContext.getSearchControls();
         
         if ( searchCtls.getReturningAttributes() != null )
@@ -330,32 +333,30 @@
      * @return true always
      * @throws NamingException if there are failures in evaluation
      */
-    private boolean filter( Attributes attributes ) throws NamingException
+    private boolean filterOperationalAttributes( ServerEntry attributes ) throws NamingException
     {
-        NamingEnumeration<String> list = attributes.getIDs();
+        Set<AttributeType> removedAttributes = new HashSet<AttributeType>();
 
-        while ( list.hasMore() )
+        // Build a list of attributeType to remove
+        for ( AttributeType attributeType:attributes.getAttributeTypes() )
         {
-            String attrId =  list.next();
-
-            AttributeType type = null;
-
-            if ( atRegistry.hasAttributeType( attrId ) )
+            if ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS )
             {
-                type = atRegistry.lookup( attrId );
-            }
-
-            if ( type != null && type.getUsage() != UsageEnum.USER_APPLICATIONS )
-            {
-                attributes.remove( attrId );
+                removedAttributes.add( attributeType );
             }
         }
         
+        // Now remove the attributes which are not USERs
+        for ( AttributeType attributeType:removedAttributes )
+        {
+            attributes.remove( attributeType );
+        }
+        
         return true;
     }
 
 
-    private void filter( LookupOperationContext lookupContext, Attributes entry ) throws NamingException
+    private void filter( LookupOperationContext lookupContext, ServerEntry entry ) throws NamingException
     {
         LdapDN dn = lookupContext.getDn();
         List<String> ids = lookupContext.getAttrsId();
@@ -363,28 +364,19 @@
         // still need to protect against returning op attrs when ids is null
         if ( ids == null )
         {
-            filter( entry );
+            filterOperationalAttributes( entry );
             return;
         }
 
+        Set<AttributeType> attributeTypes = entry.getAttributeTypes();
+
         if ( dn.size() == 0 )
         {
-            Set<String> idsSet = new HashSet<String>( ids.size() );
-
-            for ( String id:ids  )
-            {
-                idsSet.add( id.toLowerCase() );
-            }
-
-            NamingEnumeration<String> list = entry.getIDs();
-
-            while ( list.hasMore() )
+            for ( AttributeType attributeType:attributeTypes )
             {
-                String attrId = list.nextElement().toLowerCase();
-
-                if ( !idsSet.contains( attrId ) )
+                if ( !ids.contains( attributeType.getOid() ) )
                 {
-                    entry.remove( attrId );
+                    entry.remove( attributeType );
                 }
             }
         }
@@ -397,38 +389,35 @@
     }
 
     
-    public void denormalizeEntryOpAttrs( Attributes entry ) throws NamingException
+    public void denormalizeEntryOpAttrs( ServerEntry entry ) throws NamingException
     {
         if ( service.isDenormalizeOpAttrsEnabled() )
         {
-            AttributeType type = atRegistry.lookup( SchemaConstants.CREATORS_NAME_AT );
-            Attribute attr = AttributeUtils.getAttribute( entry, type );
+            ServerAttribute attr = entry.get( SchemaConstants.CREATORS_NAME_AT );
 
             if ( attr != null )
             {
-                LdapDN creatorsName = new LdapDN( ( String ) attr.get() );
+                LdapDN creatorsName = new LdapDN( attr.getString() );
                 
                 attr.clear();
                 attr.add( denormalizeTypes( creatorsName ).getUpName() );
             }
             
-            type = atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT );
-            attr = AttributeUtils.getAttribute( entry, type );
+            attr = entry.get( SchemaConstants.MODIFIERS_NAME_AT );
             
             if ( attr != null )
             {
-                LdapDN modifiersName = new LdapDN( ( String ) attr.get() );
+                LdapDN modifiersName = new LdapDN( attr.getString() );
 
                 attr.clear();
                 attr.add( denormalizeTypes( modifiersName ).getUpName() );
             }
 
-            type = atRegistry.lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT );
-            attr = AttributeUtils.getAttribute( entry, type );
+            attr = entry.get( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT );
             
             if ( attr != null )
             {
-                LdapDN modifiersName = new LdapDN( ( String ) attr.get() );
+                LdapDN modifiersName = new LdapDN( attr.getString() );
 
                 attr.clear();
                 attr.add( denormalizeTypes( modifiersName ).getUpName() );
@@ -459,8 +448,8 @@
             }
             else if ( rdn.size() == 1 )
             {
-            	String name = atRegistry.lookup( rdn.getNormType() ).getName();
-            	String value = (String)rdn.getAtav().getValue(); 
+                String name = atRegistry.lookup( rdn.getNormType() ).getName();
+                String value = (String)rdn.getAtav().getNormValue(); 
                 newDn.add( new Rdn( name, name, value, value ) );
                 continue;
             }
@@ -472,7 +461,7 @@
             {
                 AttributeTypeAndValue atav = atavs.next();
                 String type = atRegistry.lookup( rdn.getNormType() ).getName();
-                buf.append( type ).append( '=' ).append( atav.getValue() );
+                buf.append( type ).append( '=' ).append( atav.getNormValue() );
                 
                 if ( atavs.hasNext() )
                 {
@@ -487,7 +476,7 @@
     }
 
 
-    private boolean filterDenormalized( Attributes entry ) throws NamingException
+    private boolean filterDenormalized( ServerEntry entry ) throws NamingException
     {
         denormalizeEntryOpAttrs( entry );
         return true;

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Mon Mar 17 23:12:41 2008
@@ -21,12 +21,12 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 
 
 /**
@@ -166,7 +166,7 @@
      * with null <tt>attributeIds</tt> by default.  Please override
      * this method if there is more effective way for your implementation.
      */
-    public Attributes lookup( LookupOperationContext lookupContext ) throws NamingException
+    public ServerEntry lookup( LookupOperationContext lookupContext ) throws NamingException
     {
         return null;
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Mon Mar 17 23:12:41 2008
@@ -27,6 +27,7 @@
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
@@ -59,17 +60,16 @@
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.constants.SupportedSASLMechanisms;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeIdentifierException;
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.CascadeControl;
 import org.apache.directory.shared.ldap.message.EntryChangeControl;
 import org.apache.directory.shared.ldap.message.ManageDsaITControl;
 import org.apache.directory.shared.ldap.message.PersistentSearchControl;
-import org.apache.directory.shared.ldap.message.ServerSearchResult;
 import org.apache.directory.shared.ldap.message.SubentriesControl;
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -87,10 +87,8 @@
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
 import javax.naming.ldap.LdapContext;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -584,7 +582,7 @@
 
         AttributeType attrType = registry.lookup( compareContext.getOid() );
         
-        Attribute attr = partition.lookup( new LookupOperationContext( registries, compareContext.getDn() ) ).get( attrType.getName() );
+        ServerAttribute attr = partition.lookup( new LookupOperationContext( registries, compareContext.getDn() ) ).get( attrType.getName() );
 
         // complain if the attribute being compared does not exist in the entry
         if ( attr == null )
@@ -593,8 +591,7 @@
         }
 
         // see first if simple match without normalization succeeds
-        // TODO Fix DIRSERVER-832
-        if ( attr.contains( compareContext.getValue() ) )
+        if ( attr.contains( (Value<?>)compareContext.getValue()  ) )
         {
             return true;
         }
@@ -607,11 +604,11 @@
          * through all values looking for a match.
          */
         Normalizer normalizer = attrType.getEquality().getNormalizer();
-        Object reqVal = normalizer.normalize( compareContext.getValue() );
+        Object reqVal = normalizer.normalize( ((Value<?>)compareContext.getValue()).get() );
 
-        for ( int ii = 0; ii < attr.size(); ii++ )
+        for ( Value<?> value:attr )
         {
-            Object attrValObj = normalizer.normalize( attr.get( ii ) );
+            Object attrValObj = normalizer.normalize( value.get() );
             
             if ( attrValObj instanceof String )
             {
@@ -887,14 +884,14 @@
     /**
      * @see Partition#list(ListOperationContext)
      */
-    public NamingEnumeration<SearchResult> list( ListOperationContext opContext ) throws NamingException
+    public NamingEnumeration<ServerSearchResult> list( ListOperationContext opContext ) throws NamingException
     {
         Partition backend = getPartition( opContext.getDn() );
         return backend.list( opContext );
     }
 
 
-    public NamingEnumeration<SearchResult> search( SearchOperationContext opContext )
+    public NamingEnumeration<ServerSearchResult> search( SearchOperationContext opContext )
         throws NamingException
     {
         LdapDN base = opContext.getDn();
@@ -920,10 +917,11 @@
                 // If nothing is asked for then we just return the entry asis.
                 // We let other mechanisms filter out operational attributes.
                 // -----------------------------------------------------------
-                if ( ids == null || ids.length == 0 )
+                if ( ( ids == null ) || ( ids.length == 0 ) )
                 {
-                    SearchResult result = new ServerSearchResult( "", null, ( Attributes ) getRootDSE( null ).clone(), false );
-                    return new SingletonEnumeration<SearchResult>( result );
+                	ServerEntry rootDSE = (ServerEntry)getRootDSE( null ).clone();
+                    ServerSearchResult result = new ServerSearchResult( LdapDN.EMPTY_LDAPDN, null, rootDSE, false );
+                    return new SingletonEnumeration<ServerSearchResult>( result );
                 }
                 
                 // -----------------------------------------------------------
@@ -968,15 +966,17 @@
                 // return nothing
                 if ( containsOneDotOne )
                 {
-                    SearchResult result = new ServerSearchResult( "", null, new AttributesImpl(), false );
-                    return new SingletonEnumeration<SearchResult>( result );
+                	ServerEntry serverEntry = new DefaultServerEntry( registries, base );
+                    ServerSearchResult result = new ServerSearchResult( LdapDN.EMPTY_LDAPDN, null, serverEntry, false );
+                    return new SingletonEnumeration<ServerSearchResult>( result );
                 }
                 
                 // return everything
                 if ( containsAsterisk && containsPlus )
                 {
-                    SearchResult result = new ServerSearchResult( "", null, ( Attributes ) getRootDSE( null ).clone(), false );
-                    return new SingletonEnumeration<SearchResult>( result );
+                	ServerEntry rootDSE = (ServerEntry)getRootDSE( null ).clone();
+                    ServerSearchResult result = new ServerSearchResult( LdapDN.EMPTY_LDAPDN, null, rootDSE, false );
+                    return new SingletonEnumeration<ServerSearchResult>( result );
                 }
                 
                 ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() );
@@ -995,15 +995,14 @@
                     {
                         serverEntry.put( attribute );
                     }
-                    else if ( containsPlus && ( type.getUsage() == UsageEnum.USER_APPLICATIONS ) )
+                    else if ( containsPlus && ( type.getUsage() != UsageEnum.USER_APPLICATIONS ) )
                     {
                         serverEntry.put( attribute );
                     }
                 }
 
-                Attributes attrs = ServerEntryUtils.toAttributesImpl( serverEntry );
-                SearchResult result = new ServerSearchResult( "", null, attrs, false );
-                return new SingletonEnumeration<SearchResult>( result );
+                ServerSearchResult result = new ServerSearchResult( LdapDN.EMPTY_LDAPDN, null, serverEntry, false );
+                return new SingletonEnumeration<ServerSearchResult>( result );
             }
 
             throw new LdapNameNotFoundException();
@@ -1014,7 +1013,7 @@
     }
 
 
-    public Attributes lookup( LookupOperationContext opContext ) throws NamingException
+    public ServerEntry lookup( LookupOperationContext opContext ) throws NamingException
     {
         LdapDN dn = opContext.getDn();
         
@@ -1027,11 +1026,11 @@
             {
                 for ( AttributeType attributeType:attributeTypes )
                 {
-                    String id = attributeType.getName();
+                    String oid = attributeType.getOid();
                     
-                    if ( opContext.getAttrsId().contains( id ) )
+                    if ( opContext.getAttrsId().contains( oid ) )
                     {
-                        ServerAttribute attr = rootDSE.get( id );
+                        ServerAttribute attr = rootDSE.get( oid );
                         retval.put( (ServerAttribute)attr.clone() );
                     }
                     
@@ -1048,7 +1047,7 @@
                 }
             }
             
-            return ServerEntryUtils.toAttributesImpl( retval );
+            return retval;
         }
 
         Partition backend = getPartition( dn );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java Mon Mar 17 23:12:41 2008
@@ -22,6 +22,7 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
@@ -40,7 +41,6 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
 
 
 /**
@@ -248,7 +248,7 @@
      * @return a NamingEnumeration containing objects of type {@link SearchResult}
      * @throws NamingException if there are any problems
      */
-    NamingEnumeration<SearchResult> list( ListOperationContext opContext ) throws NamingException;
+    NamingEnumeration<ServerSearchResult> list( ListOperationContext opContext ) throws NamingException;
 
 
     /**
@@ -265,7 +265,7 @@
      * <a href="http://java.sun.com/j2se/1.4.2/docs/api/
      * javax/naming/directory/SearchResult.html">SearchResult</a>.
      */
-    NamingEnumeration<SearchResult> search( SearchOperationContext opContext )
+    NamingEnumeration<ServerSearchResult> search( SearchOperationContext opContext )
         throws NamingException;
 
 
@@ -281,7 +281,7 @@
      * @return an Attributes object representing the entry
      * @throws NamingException if there are any problems
      */
-    Attributes lookup( LookupOperationContext lookupContext ) throws NamingException;
+    ServerEntry lookup( LookupOperationContext lookupContext ) throws NamingException;
 
     /**
      * Fast operation to check and see if a particular entry exists.

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java?rev=638228&r1=638227&r2=638228&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java Mon Mar 17 23:12:41 2008
@@ -42,6 +42,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -59,7 +60,8 @@
     public final static String ADMIN_UID = "admin";
     
     /** the initial admin passwd set on startup */
-    public static final String ADMIN_PASSWORD = "secret";
+    public static final String ADMIN_PASSWORD_STRING = "secret";
+    public static final byte[] ADMIN_PASSWORD_BYTES = StringTools.getBytesUtf8( ADMIN_PASSWORD_STRING );
     
    
     /**



Mime
View raw message