directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r659731 - /directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
Date Sat, 24 May 2008 00:46:06 GMT
Author: akarasulu
Date: Fri May 23 17:46:05 2008
New Revision: 659731

URL: http://svn.apache.org/viewvc?rev=659731&view=rev
Log:
fixing returns for search and list operations in the dir context

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=659731&r1=659730&r2=659731&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
Fri May 23 17:46:05 2008
@@ -20,7 +20,6 @@
 package org.apache.directory.server.core.jndi;
 
 
-import org.apache.commons.lang.NotImplementedException;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.entry.ServerEntry;
@@ -638,6 +637,7 @@
         throws NamingException
     {
         SearchControls ctls = new SearchControls();
+        LdapDN target = buildTarget( name );
 
         // If we need to return specific attributes add em to the SearchControls
         if ( null != attributesToReturn )
@@ -652,9 +652,15 @@
         {
             PresenceNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT );
             AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-//            return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode,
filter, ctls ) );
-            // TODO not implemented
-            throw new NotImplementedException();
+            try
+            {
+                return new NamingEnumerationAdapter ( 
+                    doSearchOperation( target, aliasDerefMode, filter, ctls ) );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
         }
 
         // Handle simple filter expressions without multiple terms
@@ -667,21 +673,28 @@
             if ( attr.size() == 1 )
             {
                 Object value = attr.get();
-                SimpleNode node;
+                SimpleNode<?> node;
 
                 if ( value instanceof byte[] )
                 {
-                    node = new EqualityNode( attr.getID(), new ClientBinaryValue( ( byte[]
) value ) );
+                    node = new EqualityNode<byte[]>( attr.getID(), new ClientBinaryValue(
( byte[] ) value ) );
                 }
                 else
                 {
-                    node = new EqualityNode( attr.getID(), new ClientStringValue( ( String
) value ) );
+                    node = new EqualityNode<String>( attr.getID(), new ClientStringValue(
( String ) value ) );
                 }
 
                 AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment()
);
-//                return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target,
aliasDerefMode, node, ctls ) );
-                // TODO not implemented
-                throw new NotImplementedException();
+                try
+                {
+                    return new NamingEnumerationAdapter ( 
+                        doSearchOperation( target, aliasDerefMode, node, ctls ) );
+                }
+                catch ( Exception e )
+                {
+                    JndiUtils.wrap( e );
+                    return null; // shut compiler up
+                }
             }
         }
 
@@ -721,16 +734,22 @@
                 // Add simpel AVA node if its value is a String 
                 if ( val instanceof String )
                 {
-                    node = new EqualityNode( attr.getID(), new ClientStringValue( ( String
) val ) );
+                    node = new EqualityNode<String>( attr.getID(), new ClientStringValue(
( String ) val ) );
                     filter.addNode( node );
                 }
             }
         }
 
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-//        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode,
filter, ctls ) );
-        // TODO not implemented
-        throw new NotImplementedException();
+        try
+        {
+            return new NamingEnumerationAdapter( doSearchOperation( target, aliasDerefMode,
filter, ctls ) );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+            return null; // shut compiler up
+        }
     }
 
 
@@ -761,9 +780,15 @@
     {
         LdapDN target = buildTarget( name );
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-//        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode,
filter, cons ) );
-        // TODO not implemented
-        throw new NotImplementedException();
+        try
+        {
+            return new NamingEnumerationAdapter( doSearchOperation( target, aliasDerefMode,
filter, cons ) );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+            return null; // shut compiler up
+        }
     }
 
 
@@ -790,9 +815,15 @@
         }
 
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-//        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode,
filterNode, cons ) );
-        // TODO not implemented
-        throw new NotImplementedException();
+        try
+        {
+            return new NamingEnumerationAdapter( doSearchOperation( target, aliasDerefMode,
filterNode, cons ) );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+            return null; // shut compiler up
+        }
     }
 
 



Mime
View raw message